Class: Pinnacle::MediaRcsMessage
- Inherits:
-
Object
- Object
- Pinnacle::MediaRcsMessage
- Defined in:
- lib/rcs/types/media_rcs_message.rb
Overview
The content of the message
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #media_type ⇒ Pinnacle::MediaType readonly
-
#media_url ⇒ String
readonly
The URL of the media being sent.
-
#quick_replies ⇒ Array<Pinnacle::Action>
readonly
Array of quick replies attached to the media.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Pinnacle::MediaRcsMessage
Deserialize a JSON object to an instance of MediaRcsMessage.
-
.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(media_type:, media_url:, quick_replies: OMIT, additional_properties: nil) ⇒ Pinnacle::MediaRcsMessage constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of MediaRcsMessage to a JSON object.
Constructor Details
#initialize(media_type:, media_url:, quick_replies: OMIT, additional_properties: nil) ⇒ Pinnacle::MediaRcsMessage
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rcs/types/media_rcs_message.rb', line 30 def initialize(media_type:, media_url:, quick_replies: OMIT, additional_properties: nil) @media_type = media_type @media_url = media_url @quick_replies = quick_replies if quick_replies != OMIT @additional_properties = additional_properties @_field_set = { "mediaType": media_type, "mediaUrl": media_url, "quick_replies": quick_replies }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
18 19 20 |
# File 'lib/rcs/types/media_rcs_message.rb', line 18 def additional_properties @additional_properties end |
#media_type ⇒ Pinnacle::MediaType (readonly)
12 13 14 |
# File 'lib/rcs/types/media_rcs_message.rb', line 12 def media_type @media_type end |
#media_url ⇒ String (readonly)
Returns The URL of the media being sent.
14 15 16 |
# File 'lib/rcs/types/media_rcs_message.rb', line 14 def media_url @media_url end |
#quick_replies ⇒ Array<Pinnacle::Action> (readonly)
Returns Array of quick replies attached to the media. Maximum of 11 quick replies.
16 17 18 |
# File 'lib/rcs/types/media_rcs_message.rb', line 16 def quick_replies @quick_replies end |
Class Method Details
.from_json(json_object:) ⇒ Pinnacle::MediaRcsMessage
Deserialize a JSON object to an instance of MediaRcsMessage
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rcs/types/media_rcs_message.rb', line 48 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) media_type = parsed_json["mediaType"] media_url = parsed_json["mediaUrl"] quick_replies = parsed_json["quick_replies"]&.map do |item| item = item.to_json Pinnacle::Action.from_json(json_object: item) end new( media_type: media_type, media_url: media_url, quick_replies: quick_replies, 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_message.rb', line 78 def self.validate_raw(obj:) obj.media_type.is_a?(Pinnacle::MediaType) != false || raise("Passed value for field obj.media_type is not the expected type, validation failed.") obj.media_url.is_a?(String) != false || raise("Passed value for field obj.media_url is not the expected type, validation failed.") obj.quick_replies&.is_a?(Array) != false || raise("Passed value for field obj.quick_replies is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of MediaRcsMessage to a JSON object
68 69 70 |
# File 'lib/rcs/types/media_rcs_message.rb', line 68 def to_json(*_args) @_field_set&.to_json end |