Class: Appboy::REST::TriggerCampaign

Inherits:
Base
  • Object
show all
Defined in:
lib/appboy/rest/trigger_campaign.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, options = {}) ⇒ TriggerCampaign

Returns a new instance of TriggerCampaign.



7
8
9
10
11
12
13
14
15
# File 'lib/appboy/rest/trigger_campaign.rb', line 7

def initialize(api_key, options = {})
  @api_key            = api_key
  @audience           = options[:audience]
  @broadcast          = options[:broadcast] || false
  @campaign_id        = options[:campaign_id]
  @recipients         = options[:recipients]
  @send_id            = options[:send_id]
  @trigger_properties = options[:trigger_properties]
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



4
5
6
# File 'lib/appboy/rest/trigger_campaign.rb', line 4

def api_key
  @api_key
end

#audienceObject (readonly)

Returns the value of attribute audience.



4
5
6
# File 'lib/appboy/rest/trigger_campaign.rb', line 4

def audience
  @audience
end

#broadcastObject (readonly)

Returns the value of attribute broadcast.



4
5
6
# File 'lib/appboy/rest/trigger_campaign.rb', line 4

def broadcast
  @broadcast
end

#campaign_idObject (readonly)

Returns the value of attribute campaign_id.



4
5
6
# File 'lib/appboy/rest/trigger_campaign.rb', line 4

def campaign_id
  @campaign_id
end

#recipientsObject (readonly)

Returns the value of attribute recipients.



4
5
6
# File 'lib/appboy/rest/trigger_campaign.rb', line 4

def recipients
  @recipients
end

#send_idObject (readonly)

Returns the value of attribute send_id.



4
5
6
# File 'lib/appboy/rest/trigger_campaign.rb', line 4

def send_id
  @send_id
end

#trigger_propertiesObject (readonly)

Returns the value of attribute trigger_properties.



4
5
6
# File 'lib/appboy/rest/trigger_campaign.rb', line 4

def trigger_properties
  @trigger_properties
end

Instance Method Details

#performObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/appboy/rest/trigger_campaign.rb', line 17

def perform
  http.post '/campaigns/trigger/send', {
    api_key:            api_key,
    audience:           audience,
    broadcast:          broadcast,
    campaign_id:        campaign_id,
    recipients:         recipients,
    send_id:            send_id,
    trigger_properties: trigger_properties
  }.compact
end