Class: AliexpressAPI::DsProduct

Inherits:
Base
  • Object
show all
Defined in:
lib/aliexpress_api/resources/ds_product.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes

Class Method Summary collapse

Methods inherited from Base

#[], #[]=, activate_session, app_key, app_secret, #as_json, connection, #initialize, #respond_to_missing?, service_endpoint, session, session=, #to_hash, #to_json

Methods included from ThreadsafeAttributes

included

Constructor Details

This class inherits a constructor from AliexpressAPI::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AliexpressAPI::Base

Class Method Details

.find(id, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/aliexpress_api/resources/ds_product.rb', line 6

def find(id, options = {})
  params = options.symbolize_keys
  params[:product_id] = id
  params[:method] = 'aliexpress.postproduct.redefining.findaeproductbyidfordropshipper'

  response = post(service_endpoint, params)
  result = response['aliexpress_postproduct_redefining_findaeproductbyidfordropshipper_response']['result']

  if result['error_code'].present?
    raise ResultError.new(result, message: result['error_message'])
  end

  new(result)
end

.simple_find(id, options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/aliexpress_api/resources/ds_product.rb', line 21

def simple_find(id, options = {})
  params = options.symbolize_keys
  params[:product_id] = id
  params[:method] = 'aliexpress.offer.ds.product.simplequery'

  response = post(service_endpoint, params)
  result = response['aliexpress_offer_ds_product_simplequery_response']
  new(result)
end