yandex_market_content 0.3.0 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6bc27c8fd609faed37b75e29b7a69c775a847477
4
- data.tar.gz: 2b1fadeea14fadc6584cbd29e08cb8e2cdb53673
3
+ metadata.gz: ddf7964c42c35ed765862a3183b11ce8f9694145
4
+ data.tar.gz: 84bad493589350431847a64162d658dea46c667b
5
5
  SHA512:
6
- metadata.gz: 916b7fa7c1a70c88aec22aac19456e11de3d2c20c55fcb5351ea87f623d7944de64bdd2d53b38400b0453809cac1eed63f0c703751371c41fc5c62838daf927c
7
- data.tar.gz: 324db9bb7deb6166a10e796c43c24e4eac4a2823382e651fc9733272f187368772223e73e6c791faceb58967eb94515cef524e56d46bf2dac8deef69dc238146
6
+ metadata.gz: 2d38d02f4238754aa5fcece6858a74d13c8d7f32238f52383aef62ed424410b9a0f50893f1181dcfcf26aa70b9a5e2d156085493e2143bf88bfff98f373a165c
7
+ data.tar.gz: 90ff687a0e33bda301490a646c6bbe2fc0758dd8c6fe43f311e179c235acb799c804a463261bfa3982d116916362dfbd1193abcc5da2157afbffdb15b9827b16
data/README.md CHANGED
@@ -51,6 +51,8 @@ Make request
51
51
  # => "OK"
52
52
  result.regions.first.country.name
53
53
  # => "Россия"
54
+ client.regions_children(3, {page: 2})
55
+ # => {"status"=>"OK","context"=>{"region"=>{"id"=>225, "name"=>"Россия", "type"=>"COUNTRY", "childCount"=>11, "country"=>{"id"=>225, "name"=>"Россия","type"=>"COUNTRY", "childCount"=>11}},.....,"regions"=> [{"id"=>10705, "name"=>"Курская область", "type"=>"SUBJECT_FEDERATION", "childCount"=>35, "country"=>{"id"=>225, "name"=>"Россия", "type"=>"COUNTRY", "childCount"=>11}},....]}
54
56
  ```
55
57
 
56
58
 
Binary file
@@ -0,0 +1,11 @@
1
+ module Yandex
2
+ module Market
3
+ class Client
4
+ module Models
5
+ def offers(id = nil, options = {})
6
+ get "models/#{id}/offers", Offer.params(options)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Yandex
2
+ module Market
3
+ class Client
4
+ module Offers
5
+ def offer(id, options = {})
6
+ get "offers/#{id}", Offer.params(options)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Yandex
2
+ module Market
3
+ class Client
4
+ module Search
5
+ def search(options = {})
6
+ get "search", Yandex::Market::Search.params(options)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -4,6 +4,8 @@ require 'hashie'
4
4
  require 'yandex/market/content/version'
5
5
  require 'yandex/market/content/configuration'
6
6
  require 'yandex/market/content/client'
7
+ require 'yandex/market/content/errors/offer_argument_error'
8
+ require 'yandex/market/content/errors/search_argument_error'
7
9
 
8
10
  module Yandex
9
11
  module Market
Binary file
@@ -1,12 +1,20 @@
1
1
  require 'yandex/market/content/connection'
2
2
  require 'yandex/market/client/regions'
3
- require 'yandex/market/content/regions'
3
+ require 'yandex/market/content/region'
4
+ require 'yandex/market/client/offers'
5
+ require 'yandex/market/client/models'
6
+ require 'yandex/market/client/search'
7
+ require 'yandex/market/content/offer'
8
+ require 'yandex/market/content/search'
4
9
 
5
10
  module Yandex
6
11
  module Market
7
12
  class Client
8
13
  include Yandex::Market::Connection
9
14
  include Yandex::Market::Client::Regions
15
+ include Yandex::Market::Client::Offers
16
+ include Yandex::Market::Client::Models
17
+ include Yandex::Market::Client::Search
10
18
 
11
19
  def initialize(options = {})
12
20
  # TODO refactoring
@@ -0,0 +1,9 @@
1
+ module Yandex
2
+ module Market
3
+ class OfferArgumentError < ArgumentError
4
+ def initialize(msg = "Required geo params - 'geo_id' or 'remote_ip'")
5
+ super
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Yandex
2
+ module Market
3
+ class SearchArgumentError < ArgumentError
4
+ def initialize(msg = "Required params - 'text' and 'geo_id'")
5
+ super
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ module Yandex
2
+ module Market
3
+ class Offer
4
+ def self.params(options = {})
5
+ raise OfferArgumentError unless (options[:geo_id] && options[:remote_ip]).nil?
6
+ options
7
+ end
8
+ end
9
+ end
10
+ end
File without changes
@@ -0,0 +1,10 @@
1
+ module Yandex
2
+ module Market
3
+ class Search
4
+ def self.params(options = {})
5
+ raise SearchArgumentError unless options[:text] && options[:geo_id]
6
+ options
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,7 +1,7 @@
1
1
  module Yandex
2
2
  module Market
3
3
  class Content
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yandex_market_content
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Chechaev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-05 00:00:00.000000000 Z
11
+ date: 2017-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -107,13 +107,22 @@ files:
107
107
  - bin/console
108
108
  - bin/setup
109
109
  - lib/yandex-market-content.rb
110
+ - lib/yandex/market/.DS_Store
111
+ - lib/yandex/market/client/models.rb
112
+ - lib/yandex/market/client/offers.rb
110
113
  - lib/yandex/market/client/regions.rb
114
+ - lib/yandex/market/client/search.rb
111
115
  - lib/yandex/market/content.rb
116
+ - lib/yandex/market/content/.DS_Store
112
117
  - lib/yandex/market/content/api.rb
113
118
  - lib/yandex/market/content/client.rb
114
119
  - lib/yandex/market/content/configuration.rb
115
120
  - lib/yandex/market/content/connection.rb
116
- - lib/yandex/market/content/regions.rb
121
+ - lib/yandex/market/content/errors/offer_argument_error.rb
122
+ - lib/yandex/market/content/errors/search_argument_error.rb
123
+ - lib/yandex/market/content/offer.rb
124
+ - lib/yandex/market/content/region.rb
125
+ - lib/yandex/market/content/search.rb
117
126
  - lib/yandex/market/content/version.rb
118
127
  - yandex_market_content.gemspec
119
128
  homepage: https://github.com/sergey-chechaev/yandex_market_content