Class: Pinnacle::InboundMessageMetadata
- Inherits:
-
Object
- Object
- Pinnacle::InboundMessageMetadata
- Defined in:
- lib/rcs/types/inbound_message_metadata.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #message ⇒ Pinnacle::MessageMetadata readonly
- #sender ⇒ Pinnacle::SenderMetadata readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Pinnacle::InboundMessageMetadata
Deserialize a JSON object to an instance of InboundMessageMetadata.
-
.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(sender: OMIT, message: OMIT, additional_properties: nil) ⇒ Pinnacle::InboundMessageMetadata constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of InboundMessageMetadata to a JSON object.
Constructor Details
#initialize(sender: OMIT, message: OMIT, additional_properties: nil) ⇒ Pinnacle::InboundMessageMetadata
26 27 28 29 30 31 32 33 |
# File 'lib/rcs/types/inbound_message_metadata.rb', line 26 def initialize(sender: OMIT, message: OMIT, additional_properties: nil) @sender = sender if sender != OMIT @message = if != OMIT @additional_properties = additional_properties @_field_set = { "sender": sender, "message": }.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/rcs/types/inbound_message_metadata.rb', line 15 def additional_properties @additional_properties end |
#message ⇒ Pinnacle::MessageMetadata (readonly)
13 14 15 |
# File 'lib/rcs/types/inbound_message_metadata.rb', line 13 def @message end |
#sender ⇒ Pinnacle::SenderMetadata (readonly)
11 12 13 |
# File 'lib/rcs/types/inbound_message_metadata.rb', line 11 def sender @sender end |
Class Method Details
.from_json(json_object:) ⇒ Pinnacle::InboundMessageMetadata
Deserialize a JSON object to an instance of InboundMessageMetadata
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rcs/types/inbound_message_metadata.rb', line 39 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["sender"].nil? sender = nil else sender = parsed_json["sender"].to_json sender = Pinnacle::SenderMetadata.from_json(json_object: sender) end if parsed_json["message"].nil? = nil else = parsed_json["message"].to_json = Pinnacle::MessageMetadata.from_json(json_object: ) end new( sender: sender, message: , 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.
74 75 76 77 |
# File 'lib/rcs/types/inbound_message_metadata.rb', line 74 def self.validate_raw(obj:) obj.sender.nil? || Pinnacle::SenderMetadata.validate_raw(obj: obj.sender) obj..nil? || Pinnacle::MessageMetadata.validate_raw(obj: obj.) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of InboundMessageMetadata to a JSON object
64 65 66 |
# File 'lib/rcs/types/inbound_message_metadata.rb', line 64 def to_json(*_args) @_field_set&.to_json end |