Class: IndixApiClient
- Inherits:
-
ParamsBase
- Object
- ParamsBase
- IndixApiClient
- Defined in:
- lib/indix_api_client.rb
Instance Attribute Summary collapse
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#app_id ⇒ Object
Returns the value of attribute app_id.
-
#app_key ⇒ Object
Returns the value of attribute app_key.
-
#host ⇒ Object
Returns the value of attribute host.
-
#http_client ⇒ Object
Returns the value of attribute http_client.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
Instance Method Summary collapse
- #get_advanced_search_bulk_job_output(job_id) ⇒ Object
- #get_advanced_search_bulk_job_status(job_id) ⇒ Object
- #get_api_params ⇒ Object
- #get_brands(query) ⇒ Object
- #get_bulk_job_output(job_id) ⇒ Object
- #get_bulk_job_status(job_id) ⇒ Object
- #get_catalog_premium_product_detail(product_id, countryCode) ⇒ Object
- #get_catalog_premium_products(query) ⇒ Object
- #get_catalog_standard_product_detail(product_id, countryCode) ⇒ Object
- #get_catalog_standard_products(query) ⇒ Object
- #get_categories ⇒ Object
- #get_offers_premium_product_detail(product_id, countryCode) ⇒ Object
- #get_offers_premium_products(query) ⇒ Object
- #get_offers_standard_product_detail(product_id, countryCode) ⇒ Object
- #get_offers_standard_products(query) ⇒ Object
- #get_product_price_history(pid, query) ⇒ Object
- #get_stores(query) ⇒ Object
- #get_suggestions(country_code, q) ⇒ Object
- #get_summary_product_detail(product_id, countryCode) ⇒ Object
- #get_summary_products(query) ⇒ Object
- #get_universal_product_detail(product_id, countryCode) ⇒ Object
- #get_universal_products(query) ⇒ Object
-
#initialize(app_id, app_key, host = "api.indix.com", protocol = "https") ⇒ IndixApiClient
constructor
A new instance of IndixApiClient.
- #post_advanced_search_bulk_job(query) ⇒ Object
- #post_bulk_catalog_premium_product_lookup(query) ⇒ Object
- #post_bulk_catalog_premium_products(query) ⇒ Object
- #post_bulk_catalog_standard_product_lookup(query) ⇒ Object
- #post_bulk_catalog_standard_products(query) ⇒ Object
- #post_bulk_offers_premium_product_lookup(query) ⇒ Object
- #post_bulk_offers_premium_products(query) ⇒ Object
- #post_bulk_offers_standard_product_lookup(query) ⇒ Object
- #post_bulk_offers_standard_products(query) ⇒ Object
- #post_bulk_summary_product_lookup(query) ⇒ Object
- #post_bulk_summary_products(query) ⇒ Object
- #post_bulk_universal_product_lookup(query) ⇒ Object
- #post_bulk_universal_products(query) ⇒ Object
Methods inherited from ParamsBase
Constructor Details
#initialize(app_id, app_key, host = "api.indix.com", protocol = "https") ⇒ IndixApiClient
Returns a new instance of IndixApiClient.
7 8 9 10 11 12 13 14 |
# File 'lib/indix_api_client.rb', line 7 def initialize(app_id, app_key, host = "api.indix.com", protocol = "https") @app_id = app_id @app_key = app_key @host = host @protocol = protocol @http_client = get_http_client @api_version = "v2" end |
Instance Attribute Details
#api_version ⇒ Object
Returns the value of attribute api_version.
5 6 7 |
# File 'lib/indix_api_client.rb', line 5 def api_version @api_version end |
#app_id ⇒ Object
Returns the value of attribute app_id.
5 6 7 |
# File 'lib/indix_api_client.rb', line 5 def app_id @app_id end |
#app_key ⇒ Object
Returns the value of attribute app_key.
5 6 7 |
# File 'lib/indix_api_client.rb', line 5 def app_key @app_key end |
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/indix_api_client.rb', line 5 def host @host end |
#http_client ⇒ Object
Returns the value of attribute http_client.
5 6 7 |
# File 'lib/indix_api_client.rb', line 5 def http_client @http_client end |
#protocol ⇒ Object
Returns the value of attribute protocol.
5 6 7 |
# File 'lib/indix_api_client.rb', line 5 def protocol @protocol end |
Instance Method Details
#get_advanced_search_bulk_job_output(job_id) ⇒ Object
152 153 154 155 156 |
# File 'lib/indix_api_client.rb', line 152 def get_advanced_search_bulk_job_output(job_id) params = get_api_params = {:stream => true} self.http_client.request("get", "/#{self.api_version}/bulk/ase/#{job_id}", params, {}, ) end |
#get_advanced_search_bulk_job_status(job_id) ⇒ Object
147 148 149 150 |
# File 'lib/indix_api_client.rb', line 147 def get_advanced_search_bulk_job_status(job_id) params = get_api_params self.http_client.request("get", "/#{self.api_version}/bulk/ase/#{job_id}", params) end |
#get_api_params ⇒ Object
158 159 160 |
# File 'lib/indix_api_client.rb', line 158 def get_api_params {"app_id" => self.app_id, "app_key" => self.app_key} end |
#get_brands(query) ⇒ Object
22 23 24 25 26 |
# File 'lib/indix_api_client.rb', line 22 def get_brands(query) params = query.to_hash params.merge!(get_api_params) self.http_client.request("get", "/#{self.api_version}/brands", params) end |
#get_bulk_job_output(job_id) ⇒ Object
134 135 136 137 138 |
# File 'lib/indix_api_client.rb', line 134 def get_bulk_job_output(job_id) params = get_api_params = {:stream => true} self.http_client.request("get", "/#{self.api_version}/bulk/jobs/#{job_id}/download", params, {}, ) end |
#get_bulk_job_status(job_id) ⇒ Object
129 130 131 132 |
# File 'lib/indix_api_client.rb', line 129 def get_bulk_job_status(job_id) params = get_api_params self.http_client.request("get", "/#{self.api_version}/bulk/jobs/#{job_id}", params) end |
#get_catalog_premium_product_detail(product_id, countryCode) ⇒ Object
73 74 75 |
# File 'lib/indix_api_client.rb', line 73 def get_catalog_premium_product_detail(product_id, countryCode) get_product_detail(product_id, countryCode, 'catalogPremium') end |
#get_catalog_premium_products(query) ⇒ Object
49 50 51 |
# File 'lib/indix_api_client.rb', line 49 def get_catalog_premium_products(query) get_products(query, 'catalogPremium') end |
#get_catalog_standard_product_detail(product_id, countryCode) ⇒ Object
69 70 71 |
# File 'lib/indix_api_client.rb', line 69 def get_catalog_standard_product_detail(product_id, countryCode) get_product_detail(product_id, countryCode, 'catalogStandard') end |
#get_catalog_standard_products(query) ⇒ Object
45 46 47 |
# File 'lib/indix_api_client.rb', line 45 def get_catalog_standard_products(query) get_products(query, 'catalogStandard') end |
#get_categories ⇒ Object
28 29 30 31 |
# File 'lib/indix_api_client.rb', line 28 def get_categories params = self.to_hash self.http_client.request("get", "/#{self.api_version}/categories", params) end |
#get_offers_premium_product_detail(product_id, countryCode) ⇒ Object
65 66 67 |
# File 'lib/indix_api_client.rb', line 65 def get_offers_premium_product_detail(product_id, countryCode) get_product_detail(product_id, countryCode, 'offersPremium') end |
#get_offers_premium_products(query) ⇒ Object
41 42 43 |
# File 'lib/indix_api_client.rb', line 41 def get_offers_premium_products(query) get_products(query, 'offersPremium') end |
#get_offers_standard_product_detail(product_id, countryCode) ⇒ Object
61 62 63 |
# File 'lib/indix_api_client.rb', line 61 def get_offers_standard_product_detail(product_id, countryCode) get_product_detail(product_id, countryCode, 'offersStandard') end |
#get_offers_standard_products(query) ⇒ Object
37 38 39 |
# File 'lib/indix_api_client.rb', line 37 def get_offers_standard_products(query) get_products(query, 'offersStandard') end |
#get_product_price_history(pid, query) ⇒ Object
168 169 170 171 172 |
# File 'lib/indix_api_client.rb', line 168 def get_product_price_history(pid, query) params = query.to_hash params.merge!(get_api_params) self.http_client.request("get", "/#{self.api_version}/history/products/#{pid}", params) end |
#get_stores(query) ⇒ Object
16 17 18 19 20 |
# File 'lib/indix_api_client.rb', line 16 def get_stores(query) params = query.to_hash params.merge!(get_api_params) self.http_client.request("get", "/#{self.api_version}/stores", params) end |
#get_suggestions(country_code, q) ⇒ Object
162 163 164 165 166 |
# File 'lib/indix_api_client.rb', line 162 def get_suggestions(country_code, q) params = get_api_params params.merge!({"countryCode" => country_code, "q" => q}) self.http_client.request("get", "/#{self.api_version}/bulk/ase/#{job_id}", params) end |
#get_summary_product_detail(product_id, countryCode) ⇒ Object
57 58 59 |
# File 'lib/indix_api_client.rb', line 57 def get_summary_product_detail(product_id, countryCode) get_product_detail(product_id, countryCode, 'summary') end |
#get_summary_products(query) ⇒ Object
33 34 35 |
# File 'lib/indix_api_client.rb', line 33 def get_summary_products(query) get_products(query, 'summary') end |
#get_universal_product_detail(product_id, countryCode) ⇒ Object
77 78 79 |
# File 'lib/indix_api_client.rb', line 77 def get_universal_product_detail(product_id, countryCode) get_product_detail(product_id, countryCode, 'universal') end |
#get_universal_products(query) ⇒ Object
53 54 55 |
# File 'lib/indix_api_client.rb', line 53 def get_universal_products(query) get_products(query, 'universal') end |
#post_advanced_search_bulk_job(query) ⇒ Object
140 141 142 143 144 145 |
# File 'lib/indix_api_client.rb', line 140 def post_advanced_search_bulk_job(query) payload = query.to_hash payload.merge!(get_api_params) = {:multipart => true} self.http_client.request("post", "/#{self.api_version}/universal/bulk/ase", {}, payload, ) end |
#post_bulk_catalog_premium_product_lookup(query) ⇒ Object
121 122 123 |
# File 'lib/indix_api_client.rb', line 121 def post_bulk_catalog_premium_product_lookup(query) post_bulk_lookup_job(query, 'catalogPremium') end |
#post_bulk_catalog_premium_products(query) ⇒ Object
97 98 99 |
# File 'lib/indix_api_client.rb', line 97 def post_bulk_catalog_premium_products(query) post_bulk_search_job(query, 'catalogPremium') end |
#post_bulk_catalog_standard_product_lookup(query) ⇒ Object
117 118 119 |
# File 'lib/indix_api_client.rb', line 117 def post_bulk_catalog_standard_product_lookup(query) post_bulk_lookup_job(query, 'catalogStandard') end |
#post_bulk_catalog_standard_products(query) ⇒ Object
93 94 95 |
# File 'lib/indix_api_client.rb', line 93 def post_bulk_catalog_standard_products(query) post_bulk_search_job(query, 'catalogStandard') end |
#post_bulk_offers_premium_product_lookup(query) ⇒ Object
113 114 115 |
# File 'lib/indix_api_client.rb', line 113 def post_bulk_offers_premium_product_lookup(query) post_bulk_lookup_job(query, 'offersPremium') end |
#post_bulk_offers_premium_products(query) ⇒ Object
89 90 91 |
# File 'lib/indix_api_client.rb', line 89 def post_bulk_offers_premium_products(query) post_bulk_search_job(query, 'offersPremium') end |
#post_bulk_offers_standard_product_lookup(query) ⇒ Object
109 110 111 |
# File 'lib/indix_api_client.rb', line 109 def post_bulk_offers_standard_product_lookup(query) post_bulk_lookup_job(query, 'offersStandard') end |
#post_bulk_offers_standard_products(query) ⇒ Object
85 86 87 |
# File 'lib/indix_api_client.rb', line 85 def post_bulk_offers_standard_products(query) post_bulk_search_job(query, 'offersStandard') end |
#post_bulk_summary_product_lookup(query) ⇒ Object
105 106 107 |
# File 'lib/indix_api_client.rb', line 105 def post_bulk_summary_product_lookup(query) post_bulk_lookup_job(query, 'summary') end |
#post_bulk_summary_products(query) ⇒ Object
81 82 83 |
# File 'lib/indix_api_client.rb', line 81 def post_bulk_summary_products(query) post_bulk_search_job(query, 'summary') end |
#post_bulk_universal_product_lookup(query) ⇒ Object
125 126 127 |
# File 'lib/indix_api_client.rb', line 125 def post_bulk_universal_product_lookup(query) post_bulk_lookup_job(query, 'universal') end |
#post_bulk_universal_products(query) ⇒ Object
101 102 103 |
# File 'lib/indix_api_client.rb', line 101 def post_bulk_universal_products(query) post_bulk_search_job(query, 'universal') end |