Class: Coneco::Client
- Inherits:
-
Object
- Object
- Coneco::Client
- Defined in:
- lib/coneco/client.rb
Constant Summary collapse
- FIND_CATEGORIES_URL =
'http://api.coneco.net/cws/v1/SearchCategories_json'
- FIND_PRODUCTS_URL =
'http://api.coneco.net/cws/v1/SearchProducts_json'
- FIND_REVIEWS_URL =
'http://api.coneco.net/cws/v1/SearchReviews_json'
Instance Method Summary collapse
-
#find_categories(parent_category = 0) ⇒ Object
カテゴリ検索APIを実行。parent_categoryを入力することで、さらに下層のカテゴリが検索できます。.
-
#find_products(categoryId, comId = nil, keyword = nil, orFlag = nil, maker = nil, brand = nil, available = nil, imageFlag = nil, coneClick = nil, highestPrice = nil, lowestPrice = nil, page = nil, count = nil, sort = nil) ⇒ Object
商品検索APIを実行。引数に検索条件を指定して絞込みを行う。.
-
#find_products_option(option) ⇒ Object
商品検索APIを実行。Hash形式で検索条件の指定して絞込みを行う。.
-
#find_reviews(category, comId = nil, keyword = nil, orFlag = nil, userId = nil, page = nil, count = nil, sort = nil) ⇒ Object
レビュー検索APIを実行。引数に検索条件を指定して絞り込みを行う。.
-
#find_reviews_option(option) ⇒ Object
レビュー検索APIを実行。Hash形式で検索条件の指定を行う。.
-
#initialize(key, timeout = 30) ⇒ Client
constructor
coneco.net Web Services用のAPIキーをセットします。.
Constructor Details
#initialize(key, timeout = 30) ⇒ Client
coneco.net Web Services用のAPIキーをセットします。
166 167 168 169 |
# File 'lib/coneco/client.rb', line 166 def initialize(key, timeout=30) @key = key @timeout = timeout end |
Instance Method Details
#find_categories(parent_category = 0) ⇒ Object
カテゴリ検索APIを実行。parent_categoryを入力することで、さらに下層のカテゴリが検索できます。
173 174 175 176 |
# File 'lib/coneco/client.rb', line 173 def find_categories(parent_category=0) s = get(FIND_CATEGORIES_URL, { :apikey => @key, :categoryId => parent_category }) Response.new(s, parse_categories(s)) end |
#find_products(categoryId, comId = nil, keyword = nil, orFlag = nil, maker = nil, brand = nil, available = nil, imageFlag = nil, coneClick = nil, highestPrice = nil, lowestPrice = nil, page = nil, count = nil, sort = nil) ⇒ Object
商品検索APIを実行。引数に検索条件を指定して絞込みを行う。
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/coneco/client.rb', line 188 def find_products(categoryId, comId=nil, keyword=nil, orFlag=nil, maker=nil, brand=nil, available=nil, imageFlag=nil, coneClick=nil, highestPrice=nil, lowestPrice=nil, page=nil, count=nil, sort=nil) h = { :apikey => @key } h[:categoryId] = categoryId if categoryId h[:comId] = comId if comId h[:keyword] = keyword if keyword h[:orFlag] = orFlag if orFlag h[:maker] = maker if maker h[:brand] = brand if brand h[:available] = available if available h[:imageFlag] = imageFlag if imageFlag h[:coneClick] = coneClick if coneClick h[:highestPrice] = highestPrice if highestPrice h[:lowestPrice] = lowestPrice if lowestPrice h[:page] = page if page h[:count] = count if count h[:sort] = sort if sort s = get(FIND_PRODUCTS_URL, h) Response.new(s, parse_products(s)) end |
#find_products_option(option) ⇒ Object
商品検索APIを実行。Hash形式で検索条件の指定して絞込みを行う。
180 181 182 183 184 |
# File 'lib/coneco/client.rb', line 180 def find_products_option(option) option[:apikey] = @key s = get(FIND_PRODUCTS_URL, option) Response.new(s, parse_products(s)) end |
#find_reviews(category, comId = nil, keyword = nil, orFlag = nil, userId = nil, page = nil, count = nil, sort = nil) ⇒ Object
レビュー検索APIを実行。引数に検索条件を指定して絞り込みを行う。
220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/coneco/client.rb', line 220 def find_reviews(category, comId=nil, keyword=nil, orFlag=nil, userId=nil, page=nil, count=nil, sort=nil) h = { :apikey => @key } h[:comId] = comId if comId h[:categoryId] = category if category h[:keyword] = keyword if keyword h[:orFlag] = orFlag if orFlag h[:userId] = userId if userId h[:page] = page if page h[:count] = count if count h[:sort] = sort if sort s = get(FIND_REVIEWS_URL, h) Response.new(s, parse_reviews(s)) end |
#find_reviews_option(option) ⇒ Object
レビュー検索APIを実行。Hash形式で検索条件の指定を行う。
212 213 214 215 216 |
# File 'lib/coneco/client.rb', line 212 def find_reviews_option(option) option[:apikey] = @key s = get(FIND_REVIEWS_URL, option) Response.new(s, parse_reviews(s)) end |