class Passworks::CampaignResource

Represents a Campaign of a given type: Coupon, Boarding Pass, Event Ticket, Generic, Store Card

Public Instance Methods

delete() click to toggle source

Deletes the current Campaign @return [Boolean]

# File lib/passworks/campaign_resource.rb, line 16
def delete
  client.delete("#{collection_name}/#{id}").ok?
end
merge() click to toggle source

Merges all campaign data changes into the passes using the PassUpdater /lib/ in the main backend-saas project. @return [Boolean]

# File lib/passworks/campaign_resource.rb, line 29
def merge
  client.post("#{collection_name}/#{id}/merge").ok?
end
passes(options={}) click to toggle source

@return [RequestProxy]

# File lib/passworks/campaign_resource.rb, line 10
def passes(options={})
  Passworks::RequestProxy.new(client, collection_name, id, options)
end
push() click to toggle source

Send push notifications to all customers that have installed passes from this campaign @return [Boolean]

# File lib/passworks/campaign_resource.rb, line 22
def push
  client.post("#{collection_name}/#{id}/push").ok?
end
update(data, params={}) click to toggle source

Updates the {CampaignResource} and returns the updated instance @return [CampaignResource] Updated instance

# File lib/passworks/campaign_resource.rb, line 35
def update(data, params={})
  content = {
    body: {
      single_name.to_sym => data
    }.merge(params)
  }
  response  = client.patch("#{collection_name}/#{id}", content)
  self.class.new(client, collection_name, response.data)
end