Class: Urbanairship::AbTests::Experiment
- Inherits:
-
Object
- Object
- Urbanairship::AbTests::Experiment
- Defined in:
- lib/urbanairship/ab_tests/experiment.rb
Constant Summary
Constants included from Common
Instance Attribute Summary collapse
-
#audience ⇒ Object
Returns the value of attribute audience.
-
#campaigns ⇒ Object
Returns the value of attribute campaigns.
-
#control ⇒ Object
Returns the value of attribute control.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#description ⇒ Object
Returns the value of attribute description.
-
#device_types ⇒ Object
Returns the value of attribute device_types.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#push_id ⇒ Object
Returns the value of attribute push_id.
-
#variants ⇒ Object
Returns the value of attribute variants.
Instance Method Summary collapse
-
#initialize(client: required('client')) ⇒ Experiment
constructor
A new instance of Experiment.
- #payload ⇒ Object
Methods included from Loggable
create_logger, logger, #logger
Methods included from Common
#apid_path, #channel_path, #compact_helper, #create_and_send_path, #custom_events_path, #device_token_path, #experiments_path, #lists_path, #named_users_path, #open_channel_path, #pipelines_path, #push_path, #reports_path, #required, #schedules_path, #segments_path, #tag_lists_path, #try_helper
Constructor Details
#initialize(client: required('client')) ⇒ Experiment
Returns a new instance of Experiment.
19 20 21 22 |
# File 'lib/urbanairship/ab_tests/experiment.rb', line 19 def initialize(client: required('client')) @client = client @variants = [] end |
Instance Attribute Details
#audience ⇒ Object
Returns the value of attribute audience.
8 9 10 |
# File 'lib/urbanairship/ab_tests/experiment.rb', line 8 def audience @audience end |
#campaigns ⇒ Object
Returns the value of attribute campaigns.
8 9 10 |
# File 'lib/urbanairship/ab_tests/experiment.rb', line 8 def campaigns @campaigns end |
#control ⇒ Object
Returns the value of attribute control.
8 9 10 |
# File 'lib/urbanairship/ab_tests/experiment.rb', line 8 def control @control end |
#created_at ⇒ Object
Returns the value of attribute created_at.
8 9 10 |
# File 'lib/urbanairship/ab_tests/experiment.rb', line 8 def created_at @created_at end |
#description ⇒ Object
Returns the value of attribute description.
8 9 10 |
# File 'lib/urbanairship/ab_tests/experiment.rb', line 8 def description @description end |
#device_types ⇒ Object
Returns the value of attribute device_types.
8 9 10 |
# File 'lib/urbanairship/ab_tests/experiment.rb', line 8 def device_types @device_types end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/urbanairship/ab_tests/experiment.rb', line 8 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/urbanairship/ab_tests/experiment.rb', line 8 def name @name end |
#push_id ⇒ Object
Returns the value of attribute push_id.
8 9 10 |
# File 'lib/urbanairship/ab_tests/experiment.rb', line 8 def push_id @push_id end |
#variants ⇒ Object
Returns the value of attribute variants.
8 9 10 |
# File 'lib/urbanairship/ab_tests/experiment.rb', line 8 def variants @variants end |
Instance Method Details
#payload ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/urbanairship/ab_tests/experiment.rb', line 24 def payload fail ArgumentError, 'audience is required for experiment' if @audience.nil? fail ArgumentError, 'device_types is required for experiment' if @device_types.nil? fail ArgumentError, 'variant cannot be empty for experiment' if @variants.empty? { 'name': name, 'description': description, 'control': control, 'audience': audience, 'device_types': device_types, 'campaigns': campaigns, 'variants': variants, 'id': id, 'created_at': created_at, 'push_id': push_id }.delete_if {|key, value| value.nil?} #this removes the nil key value pairs end |