Class: Samsara::Types::ContactTinyResponse
- Inherits:
-
Object
- Object
- Samsara::Types::ContactTinyResponse
- Defined in:
- lib/samsara_api/types/contact_tiny_response.rb
Overview
A minified contact object
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#first_name ⇒ String
readonly
First name of the contact.
-
#id ⇒ String
readonly
ID of the contact.
-
#last_name ⇒ String
readonly
Last name of the contact.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(first_name: OMIT, id: OMIT, last_name: OMIT, additional_properties: nil) ⇒ Samsara::Types::ContactTinyResponse constructor
- #to_json ⇒ String
Constructor Details
#initialize(first_name: OMIT, id: OMIT, last_name: OMIT, additional_properties: nil) ⇒ Samsara::Types::ContactTinyResponse
28 29 30 31 32 33 34 35 36 |
# File 'lib/samsara_api/types/contact_tiny_response.rb', line 28 def initialize(first_name: OMIT, id: OMIT, last_name: OMIT, additional_properties: nil) @first_name = first_name if first_name != OMIT @id = id if id != OMIT @last_name = last_name if last_name != OMIT @additional_properties = additional_properties @_field_set = { "firstName": first_name, "id": id, "lastName": last_name }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
16 17 18 |
# File 'lib/samsara_api/types/contact_tiny_response.rb', line 16 def additional_properties @additional_properties end |
#first_name ⇒ String (readonly)
10 11 12 |
# File 'lib/samsara_api/types/contact_tiny_response.rb', line 10 def first_name @first_name end |
#id ⇒ String (readonly)
12 13 14 |
# File 'lib/samsara_api/types/contact_tiny_response.rb', line 12 def id @id end |
#last_name ⇒ String (readonly)
14 15 16 |
# File 'lib/samsara_api/types/contact_tiny_response.rb', line 14 def last_name @last_name end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::ContactTinyResponse
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/samsara_api/types/contact_tiny_response.rb', line 41 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) first_name = parsed_json["firstName"] id = parsed_json["id"] last_name = parsed_json["lastName"] new( first_name: first_name, id: id, last_name: last_name, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
66 67 68 69 70 |
# File 'lib/samsara_api/types/contact_tiny_response.rb', line 66 def self.validate_raw(obj:) obj.first_name&.is_a?(String) != false || raise("Passed value for field obj.first_name 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.last_name&.is_a?(String) != false || raise("Passed value for field obj.last_name is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
57 58 59 |
# File 'lib/samsara_api/types/contact_tiny_response.rb', line 57 def to_json @_field_set&.to_json end |