Class: Customerio::TriggerBroadcastRequest
- Inherits:
-
Object
- Object
- Customerio::TriggerBroadcastRequest
- Defined in:
- lib/customerio/requests/trigger_broadcast_request.rb
Constant Summary collapse
- AUDIENCE_FIELDS =
%i[recipients emails ids per_user_data data_file_url].freeze
- OPTIONAL_FIELDS =
%i[data email_add_duplicates email_ignore_missing id_ignore_missing].freeze
Instance Attribute Summary collapse
-
#broadcast_id ⇒ Object
readonly
Returns the value of attribute broadcast_id.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(opts) ⇒ TriggerBroadcastRequest
constructor
A new instance of TriggerBroadcastRequest.
Constructor Details
#initialize(opts) ⇒ TriggerBroadcastRequest
Returns a new instance of TriggerBroadcastRequest.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/customerio/requests/trigger_broadcast_request.rb', line 11 def initialize(opts) raise ArgumentError, "broadcast_id is required" unless opts.key?(:broadcast_id) raise ArgumentError, "broadcast_id must be an integer" unless opts[:broadcast_id].is_a?(Integer) @broadcast_id = opts[:broadcast_id] @message = opts.select { |field, _value| valid_field?(field) } audience = AUDIENCE_FIELDS.select { |field| @message.key?(field) } raise ArgumentError, "only one of #{AUDIENCE_FIELDS.join(', ')} can be present" if audience.length > 1 end |
Instance Attribute Details
#broadcast_id ⇒ Object (readonly)
Returns the value of attribute broadcast_id.
9 10 11 |
# File 'lib/customerio/requests/trigger_broadcast_request.rb', line 9 def broadcast_id @broadcast_id end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
9 10 11 |
# File 'lib/customerio/requests/trigger_broadcast_request.rb', line 9 def @message end |