lib/foursquare2/campaigns.rb in foursquare2-1.9.3 vs lib/foursquare2/campaigns.rb in foursquare2-1.9.4

- old
+ new

@@ -17,8 +17,39 @@ response = connection.post do |req| req.url "campaigns/add", options end return_error_or_body(response, response.body.response.campaign) end + + # Get a list of campaigns + # Details on param options can be found at https://developer.foursquare.com/docs/campaigns/list + # + # @param [Hash] options + # @option options String :specialId - if specified, limits response to campaigns involving the given special + # @option options String :groupId - if specified, limits response to campaigns involving the given group + # @option options String :status - which campaigns to return: pending,scheduled,active,expired,depleted,stopped,notStarted,ended,all (default=all) + # + # + + def list_campaigns(options={}) + response = connection.get do |req| + req.url "campaigns/list", options + end + return_error_or_body(response, response.body.response.campaigns.items) + end + + # End a campaign + # Details on param can be found at https://developer.foursquare.com/docs/campaigns/end + # + # @campaign_id String :campaignId - The ID of the campaign to end. Must be specified. Pass in as a string and not as a hash. + # + # + + def end_campaign(campaign_id) + response = connection.post do |req| + req.url "campaigns/#{campaign_id}/end" + end + return_error_or_body(response, response.body.code) + end end end