Class: DianPing::Parameter
- Inherits:
-
Hash
- Object
- Hash
- DianPing::Parameter
- Defined in:
- lib/dianping/parameter.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #add(key, value) ⇒ Object
-
#business(id) ⇒ Object
(also: #shop)
获取指定商户信息.
-
#categories(city = nil) ⇒ Object
获取支持商户搜索的最新分类列表.
-
#cities ⇒ Object
获取支持商户搜索的最新城市列表.
-
#deal(deal_id) ⇒ Object
获取指定团购信息.
-
#deals(city) ⇒ Object
获取当前在线的全部团购ID列表.
-
#find ⇒ Object
搜索商户.
- #get(route) ⇒ Object
-
#initialize(client) ⇒ Parameter
constructor
A new instance of Parameter.
-
#regions(city = nil) ⇒ Object
获取支持商户搜索的最新城市下属区域列表.
-
#reservations(city) ⇒ Object
获取支持在线预订的全部商户ID列表.
-
#reviews(id) ⇒ Object
获取指定商户最新点评片断.
Methods included from Business
#coordinate, #latitude, #longitude
Methods included from Common
#has_coupon, #has_deal, #has_not_coupon, #has_not_deal, #limit, #radius
Constructor Details
#initialize(client) ⇒ Parameter
Returns a new instance of Parameter.
12 13 14 |
# File 'lib/dianping/parameter.rb', line 12 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'lib/dianping/parameter.rb', line 10 def client @client end |
Instance Method Details
#add(key, value) ⇒ Object
16 17 18 19 |
# File 'lib/dianping/parameter.rb', line 16 def add(key, value) self[key] = value if value self end |
#business(id) ⇒ Object Also known as: shop
获取指定商户信息
38 39 40 41 |
# File 'lib/dianping/parameter.rb', line 38 def business(id) add :business_id, id get '/v1/business/get_single_business' end |
#categories(city = nil) ⇒ Object
获取支持商户搜索的最新分类列表
56 57 58 59 |
# File 'lib/dianping/parameter.rb', line 56 def categories(city = nil) add :city, city get '/v1/metadata/get_categories_with_businesses' end |
#cities ⇒ Object
获取支持商户搜索的最新城市列表
51 52 53 |
# File 'lib/dianping/parameter.rb', line 51 def cities get '/v1/metadata/get_cities_with_businesses' end |
#deal(deal_id) ⇒ Object
获取指定团购信息
80 81 82 83 |
# File 'lib/dianping/parameter.rb', line 80 def deal(deal_id) add :deal_id, deal_id get '/v1/deal/get_single_deal' end |
#deals(city) ⇒ Object
获取当前在线的全部团购ID列表
74 75 76 77 |
# File 'lib/dianping/parameter.rb', line 74 def deals(city) add :city, city get '/v1/deal/get_all_id_list' end |
#find ⇒ Object
搜索商户
30 31 32 |
# File 'lib/dianping/parameter.rb', line 30 def find get '/v1/business/find_businesses' end |
#get(route) ⇒ Object
21 22 23 |
# File 'lib/dianping/parameter.rb', line 21 def get(route) client.get(route, self) end |
#regions(city = nil) ⇒ Object
获取支持商户搜索的最新城市下属区域列表
62 63 64 65 |
# File 'lib/dianping/parameter.rb', line 62 def regions(city = nil) add :city, city get '/v1/metadata/get_regions_with_businesses' end |
#reservations(city) ⇒ Object
获取支持在线预订的全部商户ID列表
68 69 70 71 |
# File 'lib/dianping/parameter.rb', line 68 def reservations(city) add :city, city get '/v1/reservation/get_all_id_list' end |
#reviews(id) ⇒ Object
获取指定商户最新点评片断
45 46 47 48 |
# File 'lib/dianping/parameter.rb', line 45 def reviews(id) add :business_id, id get '/v1/review/get_recent_reviews' end |