Class: Pinnacle::MediaRcs
- Inherits:
-
Object
- Object
- Pinnacle::MediaRcs
- Defined in:
- lib/rcs/types/media_rcs.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::MediaRcsMessage
readonly
The content of the message.
-
#message_type ⇒ String
readonly
The type of message being sent.
-
#phone_number ⇒ String
readonly
Phone number to send the SMS message to.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Pinnacle::MediaRcs
Deserialize a JSON object to an instance of MediaRcs.
-
.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(message_type:, message:, phone_number: OMIT, additional_properties: nil) ⇒ Pinnacle::MediaRcs constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of MediaRcs to a JSON object.
Constructor Details
#initialize(message_type:, message:, phone_number: OMIT, additional_properties: nil) ⇒ Pinnacle::MediaRcs
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rcs/types/media_rcs.rb', line 28 def initialize(message_type:, message:, phone_number: OMIT, additional_properties: nil) @phone_number = phone_number if phone_number != OMIT @message_type = @message = @additional_properties = additional_properties @_field_set = { "phone_number": phone_number, "message_type": , "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.
16 17 18 |
# File 'lib/rcs/types/media_rcs.rb', line 16 def additional_properties @additional_properties end |
#message ⇒ Pinnacle::MediaRcsMessage (readonly)
Returns The content of the message.
14 15 16 |
# File 'lib/rcs/types/media_rcs.rb', line 14 def @message end |
#message_type ⇒ String (readonly)
Returns The type of message being sent.
12 13 14 |
# File 'lib/rcs/types/media_rcs.rb', line 12 def @message_type end |
#phone_number ⇒ String (readonly)
Returns Phone number to send the SMS message to.
10 11 12 |
# File 'lib/rcs/types/media_rcs.rb', line 10 def phone_number @phone_number end |
Class Method Details
.from_json(json_object:) ⇒ Pinnacle::MediaRcs
Deserialize a JSON object to an instance of MediaRcs
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rcs/types/media_rcs.rb', line 46 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) phone_number = parsed_json["phone_number"] = parsed_json["message_type"] if parsed_json["message"].nil? = nil else = parsed_json["message"].to_json = Pinnacle::MediaRcsMessage.from_json(json_object: ) end new( phone_number: phone_number, message_type: , 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.
78 79 80 81 82 |
# File 'lib/rcs/types/media_rcs.rb', line 78 def self.validate_raw(obj:) obj.phone_number&.is_a?(String) != false || raise("Passed value for field obj.phone_number is not the expected type, validation failed.") obj..is_a?(String) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.") Pinnacle::MediaRcsMessage.validate_raw(obj: obj.) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of MediaRcs to a JSON object
68 69 70 |
# File 'lib/rcs/types/media_rcs.rb', line 68 def to_json(*_args) @_field_set&.to_json end |