Class: Pinnacle::Send::RcsFallback
- Inherits:
-
Object
- Object
- Pinnacle::Send::RcsFallback
- Defined in:
- lib/rcs/send/types/rcs_fallback.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#from ⇒ String
readonly
The sender’s phone number in E.164 format.
-
#media_urls ⇒ Array<String>
readonly
The URLs of media to include.
-
#text ⇒ String
readonly
The fallback message content (max 1600 characters).
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Pinnacle::Send::RcsFallback
Deserialize a JSON object to an instance of RcsFallback.
-
.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(from: OMIT, text: OMIT, media_urls: OMIT, additional_properties: nil) ⇒ Pinnacle::Send::RcsFallback constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of RcsFallback to a JSON object.
Constructor Details
#initialize(from: OMIT, text: OMIT, media_urls: OMIT, additional_properties: nil) ⇒ Pinnacle::Send::RcsFallback
36 37 38 39 40 41 42 43 44 |
# File 'lib/rcs/send/types/rcs_fallback.rb', line 36 def initialize(from: OMIT, text: OMIT, media_urls: OMIT, additional_properties: nil) @from = from if from != OMIT @text = text if text != OMIT @media_urls = media_urls if media_urls != OMIT @additional_properties = additional_properties @_field_set = { "from": from, "text": text, "mediaUrls": media_urls }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
20 21 22 |
# File 'lib/rcs/send/types/rcs_fallback.rb', line 20 def additional_properties @additional_properties end |
#from ⇒ String (readonly)
Returns The sender’s phone number in E.164 format. Must be owned by the user.
10 11 12 |
# File 'lib/rcs/send/types/rcs_fallback.rb', line 10 def from @from end |
#media_urls ⇒ Array<String> (readonly)
Returns The URLs of media to include. One of ‘text’ or ‘mediaUrls’ must be provided. ‘jpeg`, `jpg`, `gif`, and `png` file types are fully supported and have a size limit of 5 MB. 500 KB limit for other types. Up to 10 media URLs can be included.
18 19 20 |
# File 'lib/rcs/send/types/rcs_fallback.rb', line 18 def media_urls @media_urls end |
#text ⇒ String (readonly)
Returns The fallback message content (max 1600 characters). One of ‘text’ or ‘mediaUrls’ must be provided.
13 14 15 |
# File 'lib/rcs/send/types/rcs_fallback.rb', line 13 def text @text end |
Class Method Details
.from_json(json_object:) ⇒ Pinnacle::Send::RcsFallback
Deserialize a JSON object to an instance of RcsFallback
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rcs/send/types/rcs_fallback.rb', line 50 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) from = parsed_json["from"] text = parsed_json["text"] media_urls = parsed_json["mediaUrls"] new( from: from, text: text, media_urls: media_urls, 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.
77 78 79 80 81 |
# File 'lib/rcs/send/types/rcs_fallback.rb', line 77 def self.validate_raw(obj:) obj.from&.is_a?(String) != false || raise("Passed value for field obj.from is not the expected type, validation failed.") obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.") obj.media_urls&.is_a?(Array) != false || raise("Passed value for field obj.media_urls is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of RcsFallback to a JSON object
67 68 69 |
# File 'lib/rcs/send/types/rcs_fallback.rb', line 67 def to_json(*_args) @_field_set&.to_json end |