Class: Courier::Bulk::BulkMessageUserResponse
- Inherits:
-
Object
- Object
- Courier::Bulk::BulkMessageUserResponse
- Defined in:
- lib/trycourier/bulk/types/bulk_message_user_response.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
-
#preferences ⇒ Object
readonly
Returns the value of attribute preferences.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#recipient ⇒ Object
readonly
Returns the value of attribute recipient.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Bulk::BulkMessageUserResponse
Deserialize a JSON object to an instance of BulkMessageUserResponse.
-
.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(status:, message_id: nil, preferences: nil, profile: nil, recipient: nil, data: nil, to: nil, additional_properties: nil) ⇒ Bulk::BulkMessageUserResponse constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of BulkMessageUserResponse to a JSON object.
Constructor Details
#initialize(status:, message_id: nil, preferences: nil, profile: nil, recipient: nil, data: nil, to: nil, additional_properties: nil) ⇒ Bulk::BulkMessageUserResponse
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/trycourier/bulk/types/bulk_message_user_response.rb', line 22 def initialize(status:, message_id: nil, preferences: nil, profile: nil, recipient: nil, data: nil, to: nil, additional_properties: nil) # @type [Bulk::BulkJobUserStatus] @status = status # @type [String] @message_id = # @type [Commons::RecipientPreferences] @preferences = preferences # @type [Object] @profile = profile # @type [String] @recipient = recipient # @type [Object] @data = data # @type [Send::UserRecipient] @to = to # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
11 12 13 |
# File 'lib/trycourier/bulk/types/bulk_message_user_response.rb', line 11 def additional_properties @additional_properties end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/trycourier/bulk/types/bulk_message_user_response.rb', line 11 def data @data end |
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
11 12 13 |
# File 'lib/trycourier/bulk/types/bulk_message_user_response.rb', line 11 def @message_id end |
#preferences ⇒ Object (readonly)
Returns the value of attribute preferences.
11 12 13 |
# File 'lib/trycourier/bulk/types/bulk_message_user_response.rb', line 11 def preferences @preferences end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
11 12 13 |
# File 'lib/trycourier/bulk/types/bulk_message_user_response.rb', line 11 def profile @profile end |
#recipient ⇒ Object (readonly)
Returns the value of attribute recipient.
11 12 13 |
# File 'lib/trycourier/bulk/types/bulk_message_user_response.rb', line 11 def recipient @recipient end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
11 12 13 |
# File 'lib/trycourier/bulk/types/bulk_message_user_response.rb', line 11 def status @status end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
11 12 13 |
# File 'lib/trycourier/bulk/types/bulk_message_user_response.rb', line 11 def to @to end |
Class Method Details
.from_json(json_object:) ⇒ Bulk::BulkMessageUserResponse
Deserialize a JSON object to an instance of BulkMessageUserResponse
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/trycourier/bulk/types/bulk_message_user_response.rb', line 46 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) status = struct.status = struct. if parsed_json["preferences"].nil? preferences = nil else preferences = parsed_json["preferences"].to_json preferences = Commons::RecipientPreferences.from_json(json_object: preferences) end profile = struct.profile recipient = struct.recipient data = struct.data if parsed_json["to"].nil? to = nil else to = parsed_json["to"].to_json to = Send::UserRecipient.from_json(json_object: to) end new(status: status, message_id: , preferences: preferences, profile: profile, recipient: recipient, data: data, to: to, 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.
89 90 91 92 93 94 95 96 97 |
# File 'lib/trycourier/bulk/types/bulk_message_user_response.rb', line 89 def self.validate_raw(obj:) obj.status.is_a?(Bulk::BulkJobUserStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.&.is_a?(String) != false || raise("Passed value for field obj.message_id is not the expected type, validation failed.") obj.preferences.nil? || Commons::RecipientPreferences.validate_raw(obj: obj.preferences) obj.profile&.is_a?(Object) != false || raise("Passed value for field obj.profile is not the expected type, validation failed.") obj.recipient&.is_a?(String) != false || raise("Passed value for field obj.recipient is not the expected type, validation failed.") obj.data&.is_a?(Object) != false || raise("Passed value for field obj.data is not the expected type, validation failed.") obj.to.nil? || Send::UserRecipient.validate_raw(obj: obj.to) end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of BulkMessageUserResponse to a JSON object
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/trycourier/bulk/types/bulk_message_user_response.rb', line 73 def to_json(*_args) { "status": @status, "messageId": @message_id, "preferences": @preferences, "profile": @profile, "recipient": @recipient, "data": @data, "to": @to }.to_json end |