Class: Samsara::Types::GetDocumentTypeResponseObjectResponseBody

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/get_document_type_response_object_response_body.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conditional_field_sections: OMIT, field_types: OMIT, id: OMIT, name: OMIT, org_id: OMIT, additional_properties: nil) ⇒ Samsara::Types::GetDocumentTypeResponseObjectResponseBody

Parameters:

  • name (String) (defaults to: OMIT) —

    Name of the document type.

  • org_id (Long) (defaults to: OMIT) —

    ID for the organization this document type belongs to.

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/samsara_api/types/get_document_type_response_object_response_body.rb', line 37

def initialize(conditional_field_sections: OMIT, field_types: OMIT, id: OMIT, name: OMIT, org_id: OMIT, additional_properties: nil)
  @conditional_field_sections = conditional_field_sections if conditional_field_sections != OMIT
  @field_types = field_types if field_types != OMIT
  @id = id if id != OMIT
  @name = name if name != OMIT
  @org_id = org_id if org_id != OMIT
  @additional_properties = additional_properties
  @_field_set = { "conditionalFieldSections": conditional_field_sections, "fieldTypes": field_types, "id": id, "name": name, "orgId": org_id }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



22
23
24
# File 'lib/samsara_api/types/get_document_type_response_object_response_body.rb', line 22

def additional_properties
  @additional_properties
end

#conditional_field_sections ⇒ Array<Samsara::Types::ConditionalFieldSectionObjectResponseBody> (readonly)

Returns List of the document type conditional field sections.

Returns:



11
12
13
# File 'lib/samsara_api/types/get_document_type_response_object_response_body.rb', line 11

def conditional_field_sections
  @conditional_field_sections
end

#field_types ⇒ Array<Samsara::Types::FieldTypesObjectResponseBody> (readonly)

Returns The fields associated with this document type.

Returns:



13
14
15
# File 'lib/samsara_api/types/get_document_type_response_object_response_body.rb', line 13

def field_types
  @field_types
end

#id ⇒ Object (readonly)

as the documentTypeId when creating a document.



16
17
18
# File 'lib/samsara_api/types/get_document_type_response_object_response_body.rb', line 16

def id
  @id
end

#name ⇒ String (readonly)

Returns Name of the document type.

Returns:

  • (String) —

    Name of the document type.



18
19
20
# File 'lib/samsara_api/types/get_document_type_response_object_response_body.rb', line 18

def name
  @name
end

#org_id ⇒ Long (readonly)

Returns ID for the organization this document type belongs to.

Returns:

  • (Long) —

    ID for the organization this document type belongs to.



20
21
22
# File 'lib/samsara_api/types/get_document_type_response_object_response_body.rb', line 20

def org_id
  @org_id
end

Class Method Details

.from_json(json_object:) ⇒ Samsara::Types::GetDocumentTypeResponseObjectResponseBody

Parameters:

  • json_object (String)

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/samsara_api/types/get_document_type_response_object_response_body.rb', line 53

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  conditional_field_sections = parsed_json["conditionalFieldSections"]&.map do | item |
  item = item.to_json
  Samsara::Types::ConditionalFieldSectionObjectResponseBody.from_json(json_object: item)
end
  field_types = parsed_json["fieldTypes"]&.map do | item |
  item = item.to_json
  Samsara::Types::FieldTypesObjectResponseBody.from_json(json_object: item)
end
  id = parsed_json["id"]
  name = parsed_json["name"]
  org_id = parsed_json["orgId"]
  new(
    conditional_field_sections: conditional_field_sections,
    field_types: field_types,
    id: id,
    name: name,
    org_id: org_id,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


89
90
91
92
93
94
95
# File 'lib/samsara_api/types/get_document_type_response_object_response_body.rb', line 89

def self.validate_raw(obj:)
  obj.conditional_field_sections&.is_a?(Array) != false || raise("Passed value for field obj.conditional_field_sections is not the expected type, validation failed.")
  obj.field_types&.is_a?(Array) != false || raise("Passed value for field obj.field_types is not the expected type, validation failed.")
  obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.org_id&.is_a?(Long) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


80
81
82
# File 'lib/samsara_api/types/get_document_type_response_object_response_body.rb', line 80

def to_json
  @_field_set&.to_json
end