yandex_market_api_client 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +4 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +57 -0
- data/Rakefile +13 -0
- data/lib/yandex_market_api_client/client.rb +27 -0
- data/lib/yandex_market_api_client/config.rb +17 -0
- data/lib/yandex_market_api_client/version.rb +3 -0
- data/lib/yandex_market_api_client.rb +21 -0
- data/test/lib/yandex_market_api_client/client_test.rb +16 -0
- data/test/test_helper.rb +9 -0
- data/yandex_market_api_client.gemspec +22 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 381044a696017e6d44780ebc83547d5d547a78f3
|
4
|
+
data.tar.gz: a2228a6c55f7ba6bb0beb3842734c69b466e13de
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5d83aad127fb3280215262c16404c42833622ad93d1fc87e172031c1f193dacfdef4b7f3b1962aa509b4c82a1c2fb5626274ede6ad7307e52b405b5137e5b6dd
|
7
|
+
data.tar.gz: 960e112051c2be9c214d66a1215346692dcc64ac0e66013b0151f8c8a2ec5185e2699b3da4dca8c1bb1e8edc09262bdd6e01ee25f94c91133643af6a2afa6d4c
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Igor Kuznetsov
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
[](https://travis-ci.org/igkuz/yandex_wrapper_api_wrapper)
|
2
|
+
|
3
|
+
# YandexMarketApiWrapper
|
4
|
+
|
5
|
+
It's a YandexMarket API wrapper written in Ruby. Will be useful for
|
6
|
+
people having authorization key from Yandex. Provides a simple interface
|
7
|
+
to make API calls to YandexMarket. Not all methods will be supported in
|
8
|
+
the beginnig.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
gem 'yandex_market_api_wrapper'
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install yandex_market_api_wrapper
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
### Configuration
|
27
|
+
|
28
|
+
There are several parameters that can be configured:
|
29
|
+
|
30
|
+
* auth_key
|
31
|
+
* api_version
|
32
|
+
* default_format
|
33
|
+
|
34
|
+
Code example:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
YandexMarketApiClient.configure do |config|
|
38
|
+
config.auth_key = "Your Auth Key Here"
|
39
|
+
config.api_version = "1"
|
40
|
+
config.default_format = "json"
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
If no version or format options are provided, the default values will be
|
45
|
+
seted.
|
46
|
+
|
47
|
+
Default Yandex _api_version_ is **1**
|
48
|
+
|
49
|
+
Default _deafult_format_ is **json**
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
1. Fork it
|
54
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
55
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
56
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
57
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
require 'rake/testtask'
|
4
|
+
#Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
Rake::TestTask.new do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.test_files = FileList['test/lib/**/*_test.rb']
|
9
|
+
t.verbose = true
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "Runinng tests"
|
13
|
+
task :default => :test
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module YandexMarketApiClient
|
2
|
+
class Client < ::Weary::Client
|
3
|
+
domain YandexMarketApiClient.config.host
|
4
|
+
|
5
|
+
def initialize(format = nil)
|
6
|
+
headers("Authorization" => YandexMarketApiClient.config.auth_key)
|
7
|
+
end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def config
|
11
|
+
YandexMarketApiClient.config
|
12
|
+
end
|
13
|
+
|
14
|
+
def format
|
15
|
+
config.default_format
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
get :categories, "/v#{config.api_version}/category.#{format}" do |resource|
|
20
|
+
resource.optional :page, :count, :sort
|
21
|
+
end
|
22
|
+
|
23
|
+
get :category, "/v#{config.api_version}/category/{category_id}.#{format}" do |resource|
|
24
|
+
resource.optional :page, :count, :sort
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module YandexMarketApiClient
|
2
|
+
class Config
|
3
|
+
attr_accessor :auth_key, :api_version, :default_format
|
4
|
+
|
5
|
+
def api_version
|
6
|
+
@api_version ||= "1"
|
7
|
+
end
|
8
|
+
|
9
|
+
def default_format
|
10
|
+
@default_format ||= 'json'
|
11
|
+
end
|
12
|
+
|
13
|
+
def host
|
14
|
+
"http://api.content.market.yandex.ru"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "yandex_market_api_client/version"
|
2
|
+
|
3
|
+
require 'weary'
|
4
|
+
|
5
|
+
module YandexMarketApiClient
|
6
|
+
|
7
|
+
autoload :Config, 'yandex_market_api_client/config'
|
8
|
+
autoload :Client, 'yandex_market_api_client/client'
|
9
|
+
|
10
|
+
def self.get_client
|
11
|
+
Client.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.configure
|
15
|
+
yield(config)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.config
|
19
|
+
@config ||= Config.new
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ClientTest < TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
YandexMarketApiClient.configure do |config|
|
7
|
+
config.auth_key = "123"
|
8
|
+
config.api_version = "1"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_should_get_instance
|
13
|
+
@client = YandexMarketApiClient.get_client
|
14
|
+
assert_kind_of(YandexMarketApiClient::Client, @client)
|
15
|
+
end
|
16
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'yandex_market_api_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "yandex_market_api_client"
|
8
|
+
gem.version = YandexMarketApiClient::VERSION
|
9
|
+
gem.authors = ["Igor Kuznetsov"]
|
10
|
+
gem.email = ["igkuznetsov@gmail.com"]
|
11
|
+
gem.description = %q{YandexMarket API client written in Ruby}
|
12
|
+
gem.summary = %q{It's a wrapper for YandexMarket Api calls written in Ruby. Useful for clients having authoriztion key from Yandex.}
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency "weary"
|
21
|
+
gem.add_development_dependency "rake"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yandex_market_api_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Igor Kuznetsov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: weary
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: YandexMarket API client written in Ruby
|
42
|
+
email:
|
43
|
+
- igkuznetsov@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- .travis.yml
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/yandex_market_api_client.rb
|
55
|
+
- lib/yandex_market_api_client/client.rb
|
56
|
+
- lib/yandex_market_api_client/config.rb
|
57
|
+
- lib/yandex_market_api_client/version.rb
|
58
|
+
- test/lib/yandex_market_api_client/client_test.rb
|
59
|
+
- test/test_helper.rb
|
60
|
+
- yandex_market_api_client.gemspec
|
61
|
+
homepage: ''
|
62
|
+
licenses: []
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.0.2
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: It's a wrapper for YandexMarket Api calls written in Ruby. Useful for clients
|
84
|
+
having authoriztion key from Yandex.
|
85
|
+
test_files:
|
86
|
+
- test/lib/yandex_market_api_client/client_test.rb
|
87
|
+
- test/test_helper.rb
|
88
|
+
has_rdoc:
|