Class: Urbanairship::Automations::Pipeline

Inherits:
Object
  • Object
show all
Includes:
Common, Loggable
Defined in:
lib/urbanairship/automations/pipeline.rb

Constant Summary

Constants included from Common

Common::CONTENT_TYPE

Instance Attribute Summary collapse

Instance Method Summary collapse

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')) ⇒ Pipeline

Returns a new instance of Pipeline.



24
25
26
# File 'lib/urbanairship/automations/pipeline.rb', line 24

def initialize(client: required('client'))
  @client = client
end

Instance Attribute Details

#activation_timeObject

Returns the value of attribute activation_time.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def activation_time
  @activation_time
end

#cancellation_triggerObject

Returns the value of attribute cancellation_trigger.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def cancellation_trigger
  @cancellation_trigger
end

#conditionObject

Returns the value of attribute condition.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def condition
  @condition
end

#constraintObject

Returns the value of attribute constraint.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def constraint
  @constraint
end

#creation_timeObject

Returns the value of attribute creation_time.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def creation_time
  @creation_time
end

#deactivation_timeObject

Returns the value of attribute deactivation_time.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def deactivation_time
  @deactivation_time
end

#enabledObject

Returns the value of attribute enabled.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def enabled
  @enabled
end

#historical_triggerObject

Returns the value of attribute historical_trigger.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def historical_trigger
  @historical_trigger
end

#immediate_triggerObject

Returns the value of attribute immediate_trigger.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def immediate_trigger
  @immediate_trigger
end

#last_modified_timeObject

Returns the value of attribute last_modified_time.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def last_modified_time
  @last_modified_time
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def name
  @name
end

#outcomeObject

Returns the value of attribute outcome.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def outcome
  @outcome
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def status
  @status
end

#timingObject

Returns the value of attribute timing.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def timing
  @timing
end

#urlObject

Returns the value of attribute url.



8
9
10
# File 'lib/urbanairship/automations/pipeline.rb', line 8

def url
  @url
end

Instance Method Details

#payloadObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/urbanairship/automations/pipeline.rb', line 28

def payload
   fail ArgumentError, 'enabled must be set to create pipeline payload' if @enabled.nil?
   fail ArgumentError, 'outcome must be set to create pipeline payload' if @outcome.nil?
  {
    activation_time: activation_time,
    cancellation_trigger: cancellation_trigger,
    condition: condition,
    constraint: constraint,
    creation_time: creation_time,
    deactivation_time: deactivation_time,
    enabled: enabled,
    historical_trigger: historical_trigger,
    immediate_trigger: immediate_trigger,
    last_modified_time: last_modified_time,
    name: name,
    outcome: outcome,
    status: status,
    timing: timing,
    url: url
  }.delete_if {|key, value| value.nil?} #this removes the nil key value pairs
end