Class: Samsara::Types::GetAttributesByEntityTypeResponse
- Inherits:
-
Object
- Object
- Samsara::Types::GetAttributesByEntityTypeResponse
- Defined in:
- lib/samsara_api/types/get_attributes_by_entity_type_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #data ⇒ Array<Samsara::Types::Attribute> readonly
- #pagination ⇒ Samsara::Types::PaginationResponse readonly
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::GetAttributesByEntityTypeResponse
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(data: OMIT, pagination: OMIT, additional_properties: nil) ⇒ Samsara::Types::GetAttributesByEntityTypeResponse constructor
- #to_json ⇒ String
Constructor Details
#initialize(data: OMIT, pagination: OMIT, additional_properties: nil) ⇒ Samsara::Types::GetAttributesByEntityTypeResponse
26 27 28 29 30 31 32 33 |
# File 'lib/samsara_api/types/get_attributes_by_entity_type_response.rb', line 26 def initialize(data: OMIT, pagination: OMIT, additional_properties: nil) @data = data if data != OMIT @pagination = pagination if pagination != OMIT @additional_properties = additional_properties @_field_set = { "data": data, "pagination": pagination }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/samsara_api/types/get_attributes_by_entity_type_response.rb', line 15 def additional_properties @additional_properties end |
#data ⇒ Array<Samsara::Types::Attribute> (readonly)
11 12 13 |
# File 'lib/samsara_api/types/get_attributes_by_entity_type_response.rb', line 11 def data @data end |
#pagination ⇒ Samsara::Types::PaginationResponse (readonly)
13 14 15 |
# File 'lib/samsara_api/types/get_attributes_by_entity_type_response.rb', line 13 def pagination @pagination end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::GetAttributesByEntityTypeResponse
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/samsara_api/types/get_attributes_by_entity_type_response.rb', line 38 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) data = parsed_json["data"]&.map do | item | item = item.to_json Samsara::Types::Attribute.from_json(json_object: item) end unless parsed_json["pagination"].nil? pagination = parsed_json["pagination"].to_json pagination = Samsara::Types::PaginationResponse.from_json(json_object: pagination) else pagination = nil end new( data: data, pagination: pagination, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
69 70 71 72 |
# File 'lib/samsara_api/types/get_attributes_by_entity_type_response.rb', line 69 def self.validate_raw(obj:) obj.data&.is_a?(Array) != false || raise("Passed value for field obj.data is not the expected type, validation failed.") obj.pagination.nil? || Samsara::Types::PaginationResponse.validate_raw(obj: obj.pagination) end |
Instance Method Details
#to_json ⇒ String
60 61 62 |
# File 'lib/samsara_api/types/get_attributes_by_entity_type_response.rb', line 60 def to_json @_field_set&.to_json end |