Class: Pinnacle::InboundLocationMessage
- Inherits:
-
Object
- Object
- Pinnacle::InboundLocationMessage
- Defined in:
- lib/rcs/types/inbound_location_message.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #coordinates ⇒ Pinnacle::InboundLocationMessageCoordinates readonly
- #from ⇒ String readonly
- #message_type ⇒ String readonly
- #metadata ⇒ Pinnacle::InboundMessageMetadata readonly
- #to ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Pinnacle::InboundLocationMessage
Deserialize a JSON object to an instance of InboundLocationMessage.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(coordinates:, from:, to:, message_type: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Pinnacle::InboundLocationMessage constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of InboundLocationMessage to a JSON object.
Constructor Details
#initialize(coordinates:, from:, to:, message_type: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Pinnacle::InboundLocationMessage
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rcs/types/inbound_location_message.rb', line 35 def initialize(coordinates:, from:, to:, message_type: OMIT, metadata: OMIT, additional_properties: nil) @message_type = if != OMIT @coordinates = coordinates @from = from @to = to @metadata = if != OMIT @additional_properties = additional_properties @_field_set = { "messageType": , "coordinates": coordinates, "from": from, "to": to, "metadata": }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
21 22 23 |
# File 'lib/rcs/types/inbound_location_message.rb', line 21 def additional_properties @additional_properties end |
#coordinates ⇒ Pinnacle::InboundLocationMessageCoordinates (readonly)
13 14 15 |
# File 'lib/rcs/types/inbound_location_message.rb', line 13 def coordinates @coordinates end |
#from ⇒ String (readonly)
15 16 17 |
# File 'lib/rcs/types/inbound_location_message.rb', line 15 def from @from end |
#message_type ⇒ String (readonly)
11 12 13 |
# File 'lib/rcs/types/inbound_location_message.rb', line 11 def @message_type end |
#metadata ⇒ Pinnacle::InboundMessageMetadata (readonly)
19 20 21 |
# File 'lib/rcs/types/inbound_location_message.rb', line 19 def @metadata end |
#to ⇒ String (readonly)
17 18 19 |
# File 'lib/rcs/types/inbound_location_message.rb', line 17 def to @to end |
Class Method Details
.from_json(json_object:) ⇒ Pinnacle::InboundLocationMessage
Deserialize a JSON object to an instance of InboundLocationMessage
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/rcs/types/inbound_location_message.rb', line 57 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) = parsed_json["messageType"] if parsed_json["coordinates"].nil? coordinates = nil else coordinates = parsed_json["coordinates"].to_json coordinates = Pinnacle::InboundLocationMessageCoordinates.from_json(json_object: coordinates) end from = parsed_json["from"] to = parsed_json["to"] if parsed_json["metadata"].nil? = nil else = parsed_json["metadata"].to_json = Pinnacle::InboundMessageMetadata.from_json(json_object: ) end new( message_type: , coordinates: coordinates, from: from, to: to, metadata: , additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
98 99 100 101 102 103 104 |
# File 'lib/rcs/types/inbound_location_message.rb', line 98 def self.validate_raw(obj:) obj.&.is_a?(String) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.") Pinnacle::InboundLocationMessageCoordinates.validate_raw(obj: obj.coordinates) obj.from.is_a?(String) != false || raise("Passed value for field obj.from is not the expected type, validation failed.") obj.to.is_a?(String) != false || raise("Passed value for field obj.to is not the expected type, validation failed.") obj..nil? || Pinnacle::InboundMessageMetadata.validate_raw(obj: obj.) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of InboundLocationMessage to a JSON object
88 89 90 |
# File 'lib/rcs/types/inbound_location_message.rb', line 88 def to_json(*_args) @_field_set&.to_json end |