Module: Taobao

Defined in:
lib/taobao/base.rb,
lib/taobao/search.rb

Defined Under Namespace

Classes: ApiError, Category, IncorrectCategoryId, Product, ProductList

Constant Summary collapse

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

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) ⇒ Object



16
17
18
19
20
# File 'lib/taobao/base.rb', line 16

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) ⇒ Object



2
3
4
# File 'lib/taobao/search.rb', line 2

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