yandex_market_api_client 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74bbecf947d8484fd8a0198384e03f3d05a19ca9
4
- data.tar.gz: 76324a36cb18a6fefdf2fa0ea9d6ea2448b341f9
3
+ metadata.gz: 4bbf31766fb60cfc4b6e44a10fb527cf10d65332
4
+ data.tar.gz: f917e3211e63dd448595c1d45b619fbbd1255b6c
5
5
  SHA512:
6
- metadata.gz: b263ac76bcf03d399168f54a3fb04039ee208f9122be190338a726c836a546ed786806dc038d4bdedc7ec137390a44495f19186607314066e5526a8fd987ebe4
7
- data.tar.gz: 05257d31277a43cb3569103c2aee26e111661c6ef5784db963c933ecf5f7d0ddc571172dee54eefcb2c540f7d764e31e67c65771e410fbd13bf84e4a897e2ad4
6
+ metadata.gz: 73f86e7f9a70476243a8915720c069f9b20511b776e15d492cbe79c2b72fc73395f618b95a88dbad4cb6bd358e9fc27d10894185870c076a9f7eb53ba9c3bc1d
7
+ data.tar.gz: 1ce062404d597d7bb8ba78c542eedf421b6ee83a84c149db5a733a83cf7abac76cc50e904f666148bf83a7a1ea5f5ab1c3ef59d7572ecee3acced532f3e24ff3
data/README.md CHANGED
@@ -54,6 +54,8 @@ Default Yandex *api_version* is **1**
54
54
 
55
55
  Default *deafult_format* is **json**
56
56
 
57
+ I'll use *geo_id = 225* (Russia) by default in all queries, you have to choose what geo_id do you need.
58
+
57
59
  ### Client instance
58
60
 
59
61
  To get a client instance you have to call `get_client` method:
@@ -70,29 +72,52 @@ List of optinal and required params provided in the docs on the link upper.
70
72
  + To get all categories:
71
73
 
72
74
  ```ruby
73
- client.categories(geo_id: 255).perform.parse
74
- client.categories(geo_id: 255, page: 1, count: 10, sort: "name").perform.parse
75
+ client.categories(geo_id: 225).perform.parse
76
+ client.categories(geo_id: 225, page: 1, count: 10, sort: "name").perform.parse
75
77
  ```
76
78
 
77
79
  + To get one category info:
78
80
 
79
81
  ```ruby
80
- client.category(geo_id: 255, category_id: 1).perform.parse
81
- client.category(geo_id: 255, category_id: 1).perform.parse
82
+ client.category(geo_id: 225, category_id: 1).perform.parse
83
+ client.category(geo_id: 225, category_id: 1).perform.parse
82
84
  ```
83
85
 
84
86
  + To get all category children:
85
87
 
86
88
  ```ruby
87
- client.category_children(geo_id: 255, category_id: 1).perform.parse
88
- client.category_children(geo_id: 255, category_id: 1, page: 1, count: 10, sort: "name", type: "guru").perform.parse
89
+ client.category_children(geo_id: 225, category_id: 1).perform.parse
90
+ client.category_children(geo_id: 225, category_id: 1, page: 1, count: 10, sort: "name", type: "guru").perform.parse
89
91
  ```
90
92
 
91
93
  + To get all category models:
92
94
 
93
95
  ```ruby
94
- client.category_models(geo_id: 255, category_id: 1).perform.parse
95
- client.category_models(geo_id: 255, category_id: 1, page: 1, count: 10, sort: "name", vendor_id: 1, how: "asc").perform.parse
96
+ client.category_models(geo_id: 225, category_id: 1).perform.parse
97
+ client.category_models(geo_id: 225, category_id: 1, page: 1, count: 10, sort: "name", vendor_id: 1, how: "asc").perform.parse
98
+ ```
99
+
100
+ ### Georegion Resource
101
+
102
+ The api description is provided [here](http://api.yandex.ru/market/content/doc/dg/reference/georegions.xml).
103
+ List of optinal and required params provided in the docs on the link upper.
104
+
105
+ + To get all georegions:
106
+
107
+ ```ruby
108
+ client.regions.perform.parse
109
+ ```
110
+
111
+ + To get info for concrete geo_id:
112
+
113
+ ```ruby
114
+ client.region(geo_id: 225).perform.parse
115
+ ```
116
+
117
+ + To get children for geo_id:
118
+
119
+ ```ruby
120
+ client.region_children(geo_id: 225).perform.parse
96
121
  ```
97
122
 
98
123
  ## Contributing
@@ -76,5 +76,9 @@ module YandexMarketApiClient
76
76
  :sort #price, rating, distance
77
77
  end
78
78
 
79
+ get :shop_info, "/v#{config.api_version}/shop/{shop_id}.#{format}" do |resource|
80
+ resource.required :shop_id
81
+ end
82
+
79
83
  end
80
84
  end
@@ -1,3 +1,3 @@
1
1
  module YandexMarketApiClient
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -0,0 +1,14 @@
1
+ {
2
+ "shop": {
3
+ "id": 24049,
4
+ "name": "КВАРТА",
5
+ "shopName": "ТЕХНОСТУДИЯ",
6
+ "url": "http://www.tehnostudio.ru/ob_internet_magazine/",
7
+ "ogrn": "1147746063772",
8
+ "juridicalAddress": "115583, г.Москва, Каширское шоссе, д.65",
9
+ "factAddress": "115583, г.Москва, Каширское шоссе, д.65",
10
+ "type": "OOO",
11
+ "rating": 4,
12
+ "gradeTotal": 6130
13
+ }
14
+ }
@@ -0,0 +1,24 @@
1
+ require 'test_helper'
2
+
3
+ class ShopResourceTest < TestCase
4
+
5
+ def setup
6
+ standard_configuration
7
+ @client = YandexMarketApiClient.get_client
8
+
9
+ @return = { headers: {
10
+ 'Authorization' => YandexMarketApiClient.config.auth_key,
11
+ "content-type" => "application/json; charset=utf-8"
12
+ } }
13
+ @shop_url = YandexMarketApiClient.config.host + "/v1/shop/%s"
14
+ end
15
+
16
+ def test_getting_shop_info
17
+ stub = stub_request(:get, @shop_url % "24049.json").
18
+ to_return(@return.merge(body: load_fixture('shop.json')))
19
+
20
+ @client.shop_info(shop_id: 24049).perform.parse
21
+
22
+ assert_requested stub
23
+ end
24
+ end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yandex_market_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kuznetsov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-31 00:00:00.000000000 Z
11
+ date: 2014-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: weary
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: YandexMarket API client written in Ruby
@@ -45,9 +45,9 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .coveralls.yml
49
- - .gitignore
50
- - .travis.yml
48
+ - ".coveralls.yml"
49
+ - ".gitignore"
50
+ - ".travis.yml"
51
51
  - Gemfile
52
52
  - LICENSE.txt
53
53
  - README.md
@@ -68,12 +68,14 @@ files:
68
68
  - test/fixtures/model_details.json
69
69
  - test/fixtures/model_offers.json
70
70
  - test/fixtures/model_opinions.json
71
+ - test/fixtures/shop.json
71
72
  - test/helpers/configuration_helper.rb
72
73
  - test/helpers/fixtures_helper.rb
73
74
  - test/lib/yandex_market_api_client/category_resource_test.rb
74
75
  - test/lib/yandex_market_api_client/client_test.rb
75
76
  - test/lib/yandex_market_api_client/georegion_resource_test.rb
76
77
  - test/lib/yandex_market_api_client/model_resource_test.rb
78
+ - test/lib/yandex_market_api_client/shop_resource_test.rb
77
79
  - test/test_helper.rb
78
80
  - yandex_market_api_client.gemspec
79
81
  homepage: ''
@@ -85,17 +87,17 @@ require_paths:
85
87
  - lib
86
88
  required_ruby_version: !ruby/object:Gem::Requirement
87
89
  requirements:
88
- - - '>='
90
+ - - ">="
89
91
  - !ruby/object:Gem::Version
90
92
  version: '0'
91
93
  required_rubygems_version: !ruby/object:Gem::Requirement
92
94
  requirements:
93
- - - '>='
95
+ - - ">="
94
96
  - !ruby/object:Gem::Version
95
97
  version: '0'
96
98
  requirements: []
97
99
  rubyforge_project:
98
- rubygems_version: 2.0.0
100
+ rubygems_version: 2.2.2
99
101
  signing_key:
100
102
  specification_version: 4
101
103
  summary: It's a wrapper for YandexMarket Api calls written in Ruby. Useful for clients
@@ -113,10 +115,12 @@ test_files:
113
115
  - test/fixtures/model_details.json
114
116
  - test/fixtures/model_offers.json
115
117
  - test/fixtures/model_opinions.json
118
+ - test/fixtures/shop.json
116
119
  - test/helpers/configuration_helper.rb
117
120
  - test/helpers/fixtures_helper.rb
118
121
  - test/lib/yandex_market_api_client/category_resource_test.rb
119
122
  - test/lib/yandex_market_api_client/client_test.rb
120
123
  - test/lib/yandex_market_api_client/georegion_resource_test.rb
121
124
  - test/lib/yandex_market_api_client/model_resource_test.rb
125
+ - test/lib/yandex_market_api_client/shop_resource_test.rb
122
126
  - test/test_helper.rb