Class: Rebay2::Finding
- Inherits:
-
Api
- Object
- Api
- Rebay2::Finding
show all
- Defined in:
- lib/rebay2/finding.rb
Constant Summary
collapse
- VERSION =
'1.0.0'
Constants inherited
from Api
Api::EBAY_US
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Api
base_url, base_url_prefix, configure
Class Method Details
.base_url_suffix ⇒ Object
3
4
5
|
# File 'lib/rebay2/finding.rb', line 3
def self.base_url_suffix
"ebay.com/services/search/FindingService/v1"
end
|
Instance Method Details
#find_completed_items(params) ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/rebay2/finding.rb', line 9
def find_completed_items(params)
raise ArgumentError unless params[:keywords] or params[:categoryId]
response = get_json_response(build_request_url('findCompletedItems', params))
response.trim(:findCompletedItemsResponse)
if response.response.has_key?('searchResult') && response.response['searchResult'].has_key?('item')
response.results = response.response['searchResult']['item']
end
return response
end
|
#find_items_advanced(params) ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/rebay2/finding.rb', line 21
def find_items_advanced(params)
raise ArgumentError unless params[:keywords] or params[:categoryId]
response = get_json_response(build_request_url('findItemsAdvanced', params))
response.trim(:findItemsAdvancedResponse)
if response.response.has_key?('searchResult') && response.response['searchResult'].has_key?('item')
response.results = response.response['searchResult']['item']
end
return response
end
|
#find_items_by_category(params) ⇒ Object
33
34
35
36
37
38
39
40
41
|
# File 'lib/rebay2/finding.rb', line 33
def find_items_by_category(params)
raise ArgumentError unless params[:categoryId]
response = get_json_response(build_request_url('findItemsByCategory', params))
response.trim(:findItemsByCategoryResponse)
if response.response.has_key?('searchResult') && response.response['searchResult'].has_key?('item')
response.results = response.response['searchResult']['item']
end
return response
end
|
#find_items_by_keywords(params) ⇒ Object
44
45
46
47
48
49
50
51
52
|
# File 'lib/rebay2/finding.rb', line 44
def find_items_by_keywords(params)
raise ArgumentError unless params[:keywords]
response = get_json_response(build_request_url('findItemsByKeywords', params))
response.trim(:findItemsByKeywordsResponse)
if response.response.has_key?('searchResult') && response.response['searchResult'].has_key?('item')
response.results = response.response['searchResult']['item']
end
return response
end
|
#find_items_by_product(params) ⇒ Object
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/rebay2/finding.rb', line 55
def find_items_by_product(params)
raise ArgumentError unless params[:productId]
params['productId.@type'] = 'ReferenceID'
response = get_json_response(build_request_url('findItemsByProduct', params))
response.trim(:findItemsByProductResponse)
if response.response.has_key?('searchResult') && response.response['searchResult'].has_key?('item')
response.results = response.response['searchResult']['item']
end
return response
end
|
#find_items_in_ebay_stores(params) ⇒ Object
67
68
69
70
71
72
73
74
75
|
# File 'lib/rebay2/finding.rb', line 67
def find_items_in_ebay_stores(params)
raise ArgumentError unless params[:keywords] or params[:storeName]
response = get_json_response(build_request_url('findItemsIneBayStores', params))
response.trim(:findItemsIneBayStoresResponse)
if response.response.has_key?('searchResult') && response.response['searchResult'].has_key?('item')
response.results = response.response['searchResult']['item']
end
return response
end
|
#get_histograms(params) ⇒ Object
78
79
80
81
82
83
|
# File 'lib/rebay2/finding.rb', line 78
def get_histograms(params)
raise ArgumentError unless params[:categoryId]
response = get_json_response(build_request_url('getHistograms', params))
response.trim(:getHistorgramsResponse)
return response
end
|
#get_search_keywords_recommendation(params) ⇒ Object
86
87
88
89
90
91
92
93
94
|
# File 'lib/rebay2/finding.rb', line 86
def get_search_keywords_recommendation(params)
raise ArgumentError unless params[:keywords]
response = get_json_response(build_request_url('getSearchKeywordsRecommendation', params))
response.trim(:getSearchKeywordsRecommendationResponse)
if response.response.has_key?('keywords')
response.results = response.response['keywords']
end
return response
end
|
#get_version ⇒ Object
97
98
99
100
101
102
103
104
|
# File 'lib/rebay2/finding.rb', line 97
def get_version
response = get_json_response(build_request_url('getVersion'))
response.trim(:getVersionResponse)
if response.response.has_key?('version')
response.results = response.response['version']
end
return response
end
|