rakuten_web_service 1.4.2 → 1.5.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: b14f637d234a8bb4962e0ca46a76b171a7a8918d
4
- data.tar.gz: 315b2c8f96b6b630b626cfd6299650a59ce3801e
3
+ metadata.gz: d5971dec1936ae9d551e73800107c2d1a99fed04
4
+ data.tar.gz: 9437dd7d638465c013db48a760f703d31e333ad1
5
5
  SHA512:
6
- metadata.gz: 2e85f855a001112c676e8b17e41c445a67a46060c3bf2a7e9780ed29b11ab0286fe78162128cd198df987bafd079d088ce1cc8d0d57c4f8b8a7f6b519674ae24
7
- data.tar.gz: 1f5f80be05c450def2e4e1592e40d0e1f4cd5e17979ff2af8081e67903ef9b05050c8b8ef25bd47ddc734539aae6cf3be0b26c4c2166a95c3d2561733af16c6e
6
+ metadata.gz: c66a18c2a9fed5a35caf4ef91a70a5665498a18b75e7ec9d1fb31fb1d196898b3fc48924025013b6ef27ca429f742cf882ea5d357c4c9531ac08c45bb31455f2
7
+ data.tar.gz: 1cb65253cdb7b1317a3b04a0683ca5a60d5150f02d90602205107cfbbdcddd747118fabfade92ef58840085c65d1644f88df91ab4fc59cb0e7b16b31c2d0fcd3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ # v1.5.0 (2017/03/31)
2
+
3
+ ## Improvements
4
+
5
+ * Allows to call `RakutenWebService::Recipe.ranking` without `category_id`. [#70](https://github.com/rakuten-ws/rws-ruby-sdk/pull/70)
6
+
7
+ ## Thanks
8
+
9
+ I'm pleasured to say thanks to @kakakakakku. His work has made the usage of `RWS::Recipe.raning` easy to get the ranking in all genres.
10
+ Thanks!
11
+
1
12
  # v1.4.2 (2017/01/22)
2
13
 
3
14
  ## Bug Fixes
@@ -17,8 +17,10 @@ module RakutenWebService
17
17
  response['result'].map { |r| Recipe.new(r) }
18
18
  end
19
19
 
20
- def self.ranking(category)
21
- self.search(category_id: category)
20
+ def self.ranking(category_id = nil)
21
+ params = {}
22
+ params.merge!(category_id: category_id) unless category_id.nil?
23
+ self.search(params)
22
24
  end
23
25
 
24
26
  class << self
@@ -1,3 +1,3 @@
1
1
  module RakutenWebService
2
- VERSION = "1.4.2".freeze
2
+ VERSION = "1.5.0".freeze
3
3
  end
@@ -11,6 +11,12 @@ describe RakutenWebService::Recipe do
11
11
  categoryId: category_id
12
12
  }
13
13
  end
14
+ let(:expected_query_without_category_id) do
15
+ {
16
+ affiliateId: affiliate_id,
17
+ applicationId: application_id
18
+ }
19
+ end
14
20
 
15
21
  before do
16
22
  RakutenWebService.configure do |c|
@@ -26,25 +32,48 @@ describe RakutenWebService::Recipe do
26
32
  end
27
33
 
28
34
  describe '.ranking' do
29
- let(:category_id) { '30' }
35
+ context 'get ranking without category_id' do
36
+ before do
37
+ response = JSON.parse(fixture('recipe/ranking.json'))
38
+
39
+ @expected_request = stub_request(:get, endpoint).
40
+ with(query: expected_query_without_category_id).
41
+ to_return(body: response.to_json)
42
+ end
30
43
 
31
- before do
32
- response = JSON.parse(fixture('recipe/ranking.json'))
44
+ subject { RakutenWebService::Recipe.ranking }
33
45
 
34
- @expected_request = stub_request(:get, endpoint).
35
- with(query: expected_query).
36
- to_return(body: response.to_json)
46
+ it 'should call search without category_id' do
47
+ subject.first
48
+
49
+ expect(@expected_request).to have_been_made.once
50
+ end
51
+ it 'should return an array of Recipe' do
52
+ expect(subject).to be_all { |r| r.is_a?(RWS::Recipe) }
53
+ end
37
54
  end
38
55
 
39
- subject { RakutenWebService::Recipe.ranking(category_id) }
56
+ context 'get ranking with category_id' do
57
+ let(:category_id) { '30' }
40
58
 
41
- it 'should call search with category id' do
42
- subject.first
59
+ before do
60
+ response = JSON.parse(fixture('recipe/ranking.json'))
43
61
 
44
- expect(@expected_request).to have_been_made.once
45
- end
46
- it 'shoudl return an array of Reciep' do
47
- expect(subject).to be_all { |r| r.is_a?(RWS::Recipe) }
62
+ @expected_request = stub_request(:get, endpoint).
63
+ with(query: expected_query).
64
+ to_return(body: response.to_json)
65
+ end
66
+
67
+ subject { RakutenWebService::Recipe.ranking(category_id) }
68
+
69
+ it 'should call search with category_id' do
70
+ subject.first
71
+
72
+ expect(@expected_request).to have_been_made.once
73
+ end
74
+ it 'should return an array of Recipe' do
75
+ expect(subject).to be_all { |r| r.is_a?(RWS::Recipe) }
76
+ end
48
77
  end
49
78
  end
50
79
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakuten_web_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tatsuya Sato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-22 00:00:00.000000000 Z
11
+ date: 2017-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  version: '0'
206
206
  requirements: []
207
207
  rubyforge_project:
208
- rubygems_version: 2.5.2
208
+ rubygems_version: 2.6.11
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: Ruby Client for Rakuten Web Service