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
-
.private_key ⇒ Object
writeonly
Sets the attribute private_key.
-
.public_key ⇒ Object
Returns the value of attribute public_key.
Class Method Summary collapse
-
.api_request(options) ⇒ Hash
Performs API calls to Taobao.
-
.search(query) ⇒ Taobao::ProductList
Search products by name.
Class Attribute Details
.private_key=(value) ⇒ Object (writeonly)
Sets the attribute private_key
13 14 15 |
# File 'lib/taobao/base.rb', line 13 def private_key=(value) @private_key = value end |
.public_key ⇒ Object
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
20 21 22 23 24 |
# File 'lib/taobao/base.rb', line 20 def self.api_request() uri = URI(PRODUCTION_URL) response = Net::HTTP.post_form uri, self.() parse_to_hash response end |
.search(query) ⇒ Taobao::ProductList
Search products by name
5 6 7 |
# File 'lib/taobao/search.rb', line 5 def self.search(query) ProductList.new(q: query) end |