Class: Foursquare::Merchant::Specials

Inherits:
Base
  • Object
show all
Defined in:
lib/foursquare/specials.rb

Constant Summary

Constants included from Requests

Requests::API, Requests::OAUTH

Instance Attribute Summary

Attributes inherited from Base

#consumer

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Requests

#get, #post

Constructor Details

This class inherits a constructor from Foursquare::Merchant::Base

Instance Method Details

#add(params) ⇒ Object



12
13
14
15
# File 'lib/foursquare/specials.rb', line 12

def add(params)
  response = self.post("/add", params)
  Foursquare::Merchant::Special.new(response['special'], @consumer)
end

#find(special_id, params = {}) ⇒ Object



7
8
9
10
# File 'lib/foursquare/specials.rb', line 7

def find(special_id, params={})
  response = self.get("/#{special_id}", params)
  Foursquare::Merchant::Special.new(response['special'], @consumer)
end

#list(params = {}) ⇒ Object



17
18
19
20
21
# File 'lib/foursquare/specials.rb', line 17

def list(params={})
  response = self.get("/list", params)
  specials = response['specials']['items']
  specials.map { |item| Foursquare::Merchant::Special.new(item, @consumer) }
end

#search(params) ⇒ Object



23
24
25
26
27
28
# File 'lib/foursquare/specials.rb', line 23

def search(params)
  raise "Must include lat/lng string" unless params.has_key? :ll
  response = self.get("/search", params)
  specials = response['specials']['items']
  specials.map { |item| Foursquare::Merchant::Special.new(item, @consumer) }
end