Class: Playapi::Campaign

Inherits:
Identity show all
Extended by:
Utils
Defined in:
lib/playapi/campaign.rb

Class Method Summary collapse

Methods included from Utils

hi

Methods inherited from Identity

#==, fetch, #id, #initialize, store

Methods inherited from Base

#[], attr_reader, #attrs, fetch, fetch_or_new, from_response, identity_map, #initialize, store, #update

Constructor Details

This class inherits a constructor from Playapi::Identity

Class Method Details

.create(opts) ⇒ Object


51
52
53
54
55
# File 'lib/playapi/campaign.rb', line 51

def create(opts)
	#raise "WE DON'T MAKE CAMPAIGNS YET"
	#url = "api/v2/campaigns"
	#get_object(:get, "interaction", url, {:entity => opts})
end

.featuresObject


47
48
49
# File 'lib/playapi/campaign.rb', line 47

def features
	Playapi::Feature.list
end

.getObject

Get the primary campaign for which you are currently authorized, one will be able to pass the name of the campaign, if your credentials are good for multiple campaigns… but not yet.


16
17
18
19
20
# File 'lib/playapi/campaign.rb', line 16

def get
	url = "api/v2/campaigns"
	#url += "/#{campaign_name}" unless campaign_name == nil
	get_object(:get, "campaign", url)
end

.get_interactions(opts = {}) ⇒ Object

Get interactions for a campaign, optional paramaters include Optional params hash (opts) :sort=STRING (Valid options are: leaders, newest, oldest) :approved=BOOL (Show only approved interactions) :pending=BOOL (Show only pending (unapproved) interactions) :limit=INTEGER (Limit to a number of entries, defaults to 10) :page=INTEGER (Determines the offset for limit, defaults to 1) :type=STRING (Valid options are Instapic, Tweet, Checkin)


30
31
32
33
34
# File 'lib/playapi/campaign.rb', line 30

def get_interactions(opts = {})
	#* This could just called Playapi::Interaction.list....
	url = "api/v2/interactions"
	get_objects(:get, "interactions", url, opts).interactions
end

.leaders(opts = {}) ⇒ Object

Get interactions with the most points (highest score) for a campaign Optional params hash (opts) :limit=INTEGER (Limit to a number of entries, defaults to 10) :page=INTEGER (Determines the offset for limit, defaults to 1) :type=STRING (Valid options are Instapic, Tweet, Checkin)


41
42
43
44
45
# File 'lib/playapi/campaign.rb', line 41

def leaders(opts = {})
	#* This could just call Playapi::Interactions.list with most points params...
	url = "api/v2/interactions/leaders"
	get_objects(:get, "interactions", url, opts)
end

.update(name, opts) ⇒ Object


57
58
59
60
61
# File 'lib/playapi/campaign.rb', line 57

def update(name, opts)
	#raise "WE DON'T UPDATE CAMPAIGNS YET"
	#url = "api/v2/campaigns/#{id}"
	#get_object(:put, "campaign", url, {:entity => opts})
end