Class: Pinnacle::InboundActionMessage
- Inherits:
-
Object
- Object
- Pinnacle::InboundActionMessage
- Defined in:
- lib/rcs/types/inbound_action_message.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
- #action_metadata ⇒ String readonly
- #action_title ⇒ String readonly
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #from ⇒ String readonly
- #message_type ⇒ String readonly
- #metadata ⇒ Pinnacle::InboundMessageMetadata readonly
- #payload ⇒ String readonly
- #to ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Pinnacle::InboundActionMessage
Deserialize a JSON object to an instance of InboundActionMessage.
-
.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(action_title:, from:, to:, message_type: OMIT, payload: OMIT, action_metadata: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Pinnacle::InboundActionMessage constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of InboundActionMessage to a JSON object.
Constructor Details
#initialize(action_title:, from:, to:, message_type: OMIT, payload: OMIT, action_metadata: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Pinnacle::InboundActionMessage
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/rcs/types/inbound_action_message.rb', line 40 def initialize(action_title:, from:, to:, message_type: OMIT, payload: OMIT, action_metadata: OMIT, metadata: OMIT, additional_properties: nil) @message_type = if != OMIT @action_title = action_title @payload = payload if payload != OMIT @action_metadata = if != OMIT @from = from @to = to @metadata = if != OMIT @additional_properties = additional_properties @_field_set = { "messageType": , "actionTitle": action_title, "payload": payload, "actionMetadata": , "from": from, "to": to, "metadata": }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#action_metadata ⇒ String (readonly)
16 17 18 |
# File 'lib/rcs/types/inbound_action_message.rb', line 16 def @action_metadata end |
#action_title ⇒ String (readonly)
12 13 14 |
# File 'lib/rcs/types/inbound_action_message.rb', line 12 def action_title @action_title end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
24 25 26 |
# File 'lib/rcs/types/inbound_action_message.rb', line 24 def additional_properties @additional_properties end |
#from ⇒ String (readonly)
18 19 20 |
# File 'lib/rcs/types/inbound_action_message.rb', line 18 def from @from end |
#message_type ⇒ String (readonly)
10 11 12 |
# File 'lib/rcs/types/inbound_action_message.rb', line 10 def @message_type end |
#metadata ⇒ Pinnacle::InboundMessageMetadata (readonly)
22 23 24 |
# File 'lib/rcs/types/inbound_action_message.rb', line 22 def @metadata end |
#payload ⇒ String (readonly)
14 15 16 |
# File 'lib/rcs/types/inbound_action_message.rb', line 14 def payload @payload end |
#to ⇒ String (readonly)
20 21 22 |
# File 'lib/rcs/types/inbound_action_message.rb', line 20 def to @to end |
Class Method Details
.from_json(json_object:) ⇒ Pinnacle::InboundActionMessage
Deserialize a JSON object to an instance of InboundActionMessage
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/rcs/types/inbound_action_message.rb', line 67 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) = parsed_json["messageType"] action_title = parsed_json["actionTitle"] payload = parsed_json["payload"] = parsed_json["actionMetadata"] 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: , action_title: action_title, payload: payload, action_metadata: , 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.
107 108 109 110 111 112 113 114 115 |
# File 'lib/rcs/types/inbound_action_message.rb', line 107 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.") obj.action_title.is_a?(String) != false || raise("Passed value for field obj.action_title is not the expected type, validation failed.") obj.payload&.is_a?(String) != false || raise("Passed value for field obj.payload is not the expected type, validation failed.") obj.&.is_a?(String) != false || raise("Passed value for field obj.action_metadata is not the expected type, validation failed.") 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 InboundActionMessage to a JSON object
97 98 99 |
# File 'lib/rcs/types/inbound_action_message.rb', line 97 def to_json(*_args) @_field_set&.to_json end |