Class: Courier::Bulk::InboundBulkMessageV1
- Inherits:
-
Object
- Object
- Courier::Bulk::InboundBulkMessageV1
- Defined in:
- lib/trycourier/bulk/types/inbound_bulk_message_v_1.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#brand ⇒ Object
readonly
Returns the value of attribute brand.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#override ⇒ Object
readonly
Returns the value of attribute override.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Bulk::InboundBulkMessageV1
Deserialize a JSON object to an instance of InboundBulkMessageV1.
-
.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(brand: nil, data: nil, event: nil, locale: nil, override: nil, additional_properties: nil) ⇒ Bulk::InboundBulkMessageV1 constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of InboundBulkMessageV1 to a JSON object.
Constructor Details
#initialize(brand: nil, data: nil, event: nil, locale: nil, override: nil, additional_properties: nil) ⇒ Bulk::InboundBulkMessageV1
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/trycourier/bulk/types/inbound_bulk_message_v_1.rb', line 21 def initialize(brand: nil, data: nil, event: nil, locale: nil, override: nil, additional_properties: nil) # @type [String] A unique identifier that represents the brand that should be used # for rendering the notification. @brand = brand # @type [Hash{String => String}] JSON that includes any data you want to pass to a message template. # The data will populate the corresponding template variables. @data = data # @type [String] @event = event # @type [Hash{String => String}] @locale = locale # @type [Object] JSON that is merged into the request sent by Courier to the provider # to override properties or to gain access to features in the provider # API that are not natively supported by Courier. @override = override # @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.
8 9 10 |
# File 'lib/trycourier/bulk/types/inbound_bulk_message_v_1.rb', line 8 def additional_properties @additional_properties end |
#brand ⇒ Object (readonly)
Returns the value of attribute brand.
8 9 10 |
# File 'lib/trycourier/bulk/types/inbound_bulk_message_v_1.rb', line 8 def brand @brand end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
8 9 10 |
# File 'lib/trycourier/bulk/types/inbound_bulk_message_v_1.rb', line 8 def data @data end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
8 9 10 |
# File 'lib/trycourier/bulk/types/inbound_bulk_message_v_1.rb', line 8 def event @event end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
8 9 10 |
# File 'lib/trycourier/bulk/types/inbound_bulk_message_v_1.rb', line 8 def locale @locale end |
#override ⇒ Object (readonly)
Returns the value of attribute override.
8 9 10 |
# File 'lib/trycourier/bulk/types/inbound_bulk_message_v_1.rb', line 8 def override @override end |
Class Method Details
.from_json(json_object:) ⇒ Bulk::InboundBulkMessageV1
Deserialize a JSON object to an instance of InboundBulkMessageV1
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/trycourier/bulk/types/inbound_bulk_message_v_1.rb', line 44 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) JSON.parse(json_object) brand = struct.brand data = struct.data event = struct.event locale = struct.locale override = struct.override new(brand: brand, data: data, event: event, locale: locale, override: override, 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.
66 67 68 69 70 71 72 |
# File 'lib/trycourier/bulk/types/inbound_bulk_message_v_1.rb', line 66 def self.validate_raw(obj:) obj.brand&.is_a?(String) != false || raise("Passed value for field obj.brand is not the expected type, validation failed.") obj.data&.is_a?(Hash) != false || raise("Passed value for field obj.data is not the expected type, validation failed.") obj.event&.is_a?(String) != false || raise("Passed value for field obj.event is not the expected type, validation failed.") obj.locale&.is_a?(Hash) != false || raise("Passed value for field obj.locale is not the expected type, validation failed.") obj.override&.is_a?(Object) != false || raise("Passed value for field obj.override is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of InboundBulkMessageV1 to a JSON object
58 59 60 |
# File 'lib/trycourier/bulk/types/inbound_bulk_message_v_1.rb', line 58 def to_json(*_args) { "brand": @brand, "data": @data, "event": @event, "locale": @locale, "override": @override }.to_json end |