Module: Taobao

Defined in:
lib/taobao/base.rb,
lib/taobao/search.rb,
lib/taobao/version.rb,
lib/rails/taobao-railtie.rb,
lib/generators/taobao/config/config_generator.rb

Defined Under Namespace

Modules: Generators, Util Classes: AbstractList, ApiError, Category, IncorrectCategoryId, IncorrectProperty, Product, ProductList, Property, PropertyList, Railtie, User

Constant Summary collapse

API_VERSION =
'2.0'
PRODUCTION_URL =
'http://gw.api.taobao.com/router/rest'
VERSION =
'0.9.3'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.private_key=(value) ⇒ Object (writeonly)

Sets the attribute private_key

Parameters:

  • value

    the value to set the attribute private_key to.



13
14
15
# File 'lib/taobao/base.rb', line 13

def private_key=(value)
  @private_key = value
end

.public_keyObject

Returns the value of attribute public_key.



12
13
14
# File 'lib/taobao/base.rb', line 12

def public_key
  @public_key
end

Class Method Details

.api_request(options) ⇒ Hash

Performs API calls to Taobao

Parameters:

  • options (Hash)

Returns:

  • (Hash)

    API request result



20
21
22
23
24
# File 'lib/taobao/base.rb', line 20

def self.api_request(options)
  uri = URI(PRODUCTION_URL)
  response = Net::HTTP.post_form uri, self.append_required_options(options)
  parse_to_hash response
end

.search(query) ⇒ Taobao::ProductList

Search products by name

Parameters:

  • query (String)

Returns:



5
6
7
# File 'lib/taobao/search.rb', line 5

def self.search(query)
  ProductList.new(q: query)
end