It's a YandexMarket API wrapper written in Ruby. Will be useful for people having authorization key from Yandex. Provides a simple interface to make API calls to YandexMarket. Not all methods will be supported in the beginnig.
Add this line to your application's Gemfile:
gem 'yandex_market_api_client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install yandex_market_api_client
The structure of the api response will not be provided here in case of large data in it. You can look for it in Yandex docs here.
There are several parameters that can be configured:
- auth_key
- api_version
- default_format
Code example:
YandexMarketApiClient.configure do |config|
config.auth_key = "Your Auth Key Here"
config.api_version = "1"
config.default_format = "json"
end
If no version or format options are provided, the default values will be seted.
Default Yandex api_version is 1
Default deafult_format is json
I'll use geo_id = 225 (Russia) by default in all queries, you have to choose what geo_id do you need.
To get a client instance you have to call get_client
method:
client = YandexMarketApiClient.get_client
The api description is provided here. List of optinal and required params provided in the docs on the link upper.
- To get all categories:
client.categories(geo_id: 225).perform.parse
client.categories(geo_id: 225, page: 1, count: 10, sort: "name").perform.parse
- To get one category info:
client.category(geo_id: 225, category_id: 1).perform.parse
client.category(geo_id: 225, category_id: 1).perform.parse
- To get all category children:
client.category_children(geo_id: 225, category_id: 1).perform.parse
client.category_children(geo_id: 225, category_id: 1, page: 1, count: 10, sort: "name", type: "guru").perform.parse
- To get all category models:
client.category_models(geo_id: 225, category_id: 1).perform.parse
client.category_models(geo_id: 225, category_id: 1, page: 1, count: 10, sort: "name", vendor_id: 1, how: "asc").perform.parse
The api description is provided here. List of optinal and required params provided in the docs on the link upper.
- To get all georegions:
client.regions.perform.parse
- To get info for concrete geo_id:
client.region(geo_id: 225).perform.parse
- To get children for geo_id:
client.region_children(geo_id: 225).perform.parse
The api description is provided here. List of options and required params is provided in the docs on the link upper.
- To get shop info:
client.shop_info(shop_id: 24049).perform.parse
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request