rakuten_web_service 1.0.0.rc1 → 1.0.0

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: b44c66119bf5c9b8fa5dc6b6de6ffac8ca51530d
4
- data.tar.gz: 32c3815fb9e4e4d2304df63142cbb7dfa0bef592
3
+ metadata.gz: cdc0f4711fe39be535cfe9b4bd83cf03fc7244eb
4
+ data.tar.gz: adaab1f25a06aa9d7910605361c8d740ebf5b08d
5
5
  SHA512:
6
- metadata.gz: 7ecd020582c74f06fdadb1ce977248998f5aaba06f2db8fe94c93412bdbf8de0a7c7a8867bf8470d602923684c36943d6f351a0fced044baced6f02df342ada6
7
- data.tar.gz: 81cc1e9e67ad04c7116f817b882d7718046ad7c4a49dbb096c89855804f4f43570d13b9924f3cc3be83f65cd1f4e120508b46216060c297ddb892d18b91ab10d
6
+ metadata.gz: 0ee1fcaa7e933d364b77fe00a60166448b1c207d7d55c5714acaef28bff6ea27f8536848c1a20514d720d0e70a2b8f4ab150479094adefef177f905a800aba5b
7
+ data.tar.gz: cca0e966fb91d68e25d650024eb6bfc71b37a5be0fc71ed79341818435572eee47099412d64b8e7a112c130eb04856291b0a95be3c1a948736cc56cb61fac8fb
data/CHANGELOG.md CHANGED
@@ -1,18 +1,31 @@
1
+ # v1.0.0
2
+
3
+ ## Enhancements
4
+
5
+ * Upgrade the version of RSpec and refactoring the configuration. [#36](https://github.com/rakuten-ws/rws-ruby-sdk/pull/36) and [#37](https://github.com/rakuten-ws/rws-ruby-sdk/pull/36)
6
+
1
7
  # v1.0.0.rc1
2
8
 
3
9
  ## Enhancements
4
10
 
5
- * Start supporting Gora APIs. Thank you for your contribution @kamatama41 .[#29](https://github.com/rakuten-ws/rws-ruby-sdk/pull/29)
6
- * Start supporting Recipe APIs.
7
- * Update versions of supported Rakuten Web Service APIs.
11
+ * Started supporting Gora APIs by @kamatama41 .[#29](https://github.com/rakuten-ws/rws-ruby-sdk/pull/29)
12
+ * Started supporting Recipe APIs. [#31](https://github.com/rakuten-ws/rws-ruby-sdk/pull/31)
13
+ * Updated versions of supported Rakuten Web Service APIs.
8
14
 
9
15
  ## Compatibility Changes
10
16
 
11
- * Supported Ruby versions are 2.1.0 or later
17
+ * Updated supported Ruby versions to 2.1.0 or later
12
18
  * Any resource's `search` such as `RakutenWebService::Ichiba::Item` returns Enumerator which provides resources fetched at one page.
13
19
  It used to provide all resources by auto-pagerize. From this version provides methods for pagerizing. Please refer to [the sample in README](https://github.com/rakuten-ws/rws-ruby-sdk/blob/master/README.md#pagerizing).
20
+ * Deprecated calling `RakutenWebService.configuration` with a block, recommending to use `RakutenWebService.configure`.
21
+
22
+ ## Thanks
23
+
24
+ At first, I should appreciate all users of the gems.
25
+ One of the enhancements, supporting Gora APIs, is realized by @kamatama41 's seminal work.
26
+ Thank you for your contribution!
14
27
 
15
- # v0.6.3
28
+ # v0.6.3
16
29
 
17
30
  * Update a gem dependency by @45deg
18
31
  * Fix typo by @45deg
data/README.md CHANGED
@@ -83,7 +83,7 @@ Please note that you need to replace `'YOUR_APPLICATION_ID'` and `'YOUR_AFFILIAT
83
83
  ### Search Ichiba Items
84
84
 
85
85
  ```ruby
86
- items = RakutenWebService::Ichiba::Item.search(:keyword => 'Ruby') # This returns Enumerable object
86
+ items = RakutenWebService::Ichiba::Item.search(keyword: 'Ruby') # This returns Enumerable object
87
87
  items.first(10).each do |item|
88
88
  puts "#{item['itemName']}, #{item.price} yen" # You can refer to values as well as Hash.
89
89
  end
@@ -109,7 +109,8 @@ Responses of resources' `search` such as `RakutenWebService::Ichiba::Item.search
109
109
  puts item.name
110
110
  end
111
111
 
112
- items.all do |item|
112
+ # Easier way to fetch all resources page 3 and latter
113
+ items.page(3).all do |item|
113
114
  puts item.name
114
115
  end
115
116
  ```
@@ -1,3 +1,3 @@
1
1
  module RakutenWebService
2
- VERSION = "1.0.0.rc1".freeze
2
+ VERSION = "1.0.0".freeze
3
3
  end
@@ -25,6 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
26
26
  spec.add_development_dependency "rake"
27
27
  spec.add_development_dependency "webmock", "~> 1.20.4"
28
- spec.add_development_dependency "rspec", '~> 2.14.1'
28
+ spec.add_development_dependency "rspec", '~> 3.5.0'
29
29
  spec.add_development_dependency "tapp"
30
30
  end
@@ -58,7 +58,7 @@ describe RakutenWebService::Books::Book do
58
58
  specify 'genretes RWS::Books::Genre object' do
59
59
  book = RWS::Books::Book.search(:title => 'Ruby').first
60
60
 
61
- RWS::Books::Genre.should_receive(:new).with(response['Items'][0]['Item']['booksGenreId'])
61
+ expect(RWS::Books::Genre).to receive(:new).with(response['Items'][0]['Item']['booksGenreId'])
62
62
  expect(book.genre).to be_a(Array)
63
63
  end
64
64
 
@@ -66,7 +66,7 @@ describe RakutenWebService::Books::Book do
66
66
  genre_id = '001004008007/001021001010'
67
67
  book = RWS::Books::Book.new(:booksGenreId => genre_id)
68
68
  genre_id.split('/').each do |id|
69
- RWS::Books::Genre.should_receive(:new).with(id)
69
+ expect(RWS::Books::Genre).to receive(:new).with(id)
70
70
  end
71
71
 
72
72
  expect(book.genres).to be_a(Array)
@@ -82,7 +82,7 @@ describe RWS::Books::Genre do
82
82
 
83
83
  describe '.root' do
84
84
  specify 'alias of constructor with the root genre id "000"' do
85
- RWS::Books::Genre.should_receive(:new).with('000')
85
+ expect(RWS::Books::Genre).to receive(:new).with('000')
86
86
 
87
87
  RWS::Books::Genre.root
88
88
  end
@@ -97,7 +97,7 @@ describe RWS::Books::Genre do
97
97
  specify 'are Books::Genre objects' do
98
98
  expect(@genre.children).to be_all { |child| child.is_a? RWS::Books::Genre }
99
99
  expect(@genre.children).to be_all do |child|
100
- expected_json['children'].is_any? { |c| c['booksGenreId'] == child['booksGenreId'] }
100
+ expected_json['children'].any? { |c| c['child']['booksGenreId'] == child['booksGenreId'] }
101
101
  end
102
102
  end
103
103
  end
@@ -121,7 +121,7 @@ describe RWS::Books::Genre do
121
121
  let(:genre_id) { '001001' }
122
122
 
123
123
  specify 'delegate Books::Book.search' do
124
- RWS::Books::Book.should_receive(:search).with(:booksGenreId => genre_id)
124
+ expect(RWS::Books::Book).to receive(:search).with(:booksGenreId => genre_id)
125
125
 
126
126
  @genre.search
127
127
  end
@@ -131,7 +131,7 @@ describe RWS::Books::Genre do
131
131
  let(:genre_id) { '002101' }
132
132
 
133
133
  specify 'delegate Books::CD.search' do
134
- RWS::Books::CD.should_receive(:search).with(:booksGenreId => genre_id)
134
+ expect(RWS::Books::CD).to receive(:search).with(:booksGenreId => genre_id)
135
135
 
136
136
  @genre.search
137
137
  end
@@ -141,7 +141,7 @@ describe RWS::Books::Genre do
141
141
  let(:genre_id) { '003201' }
142
142
 
143
143
  specify 'delegate Books::DVD.search' do
144
- RWS::Books::DVD.should_receive(:search).with(:booksGenreId => genre_id)
144
+ expect(RWS::Books::DVD).to receive(:search).with(:booksGenreId => genre_id)
145
145
 
146
146
  @genre.search
147
147
  end
@@ -151,7 +151,7 @@ describe RWS::Books::Genre do
151
151
  let(:genre_id) { '004301' }
152
152
 
153
153
  specify 'delegate Books::Software.search' do
154
- RWS::Books::Software.should_receive(:search).with(:booksGenreId => genre_id)
154
+ expect(RWS::Books::Software).to receive(:search).with(:booksGenreId => genre_id)
155
155
 
156
156
  @genre.search
157
157
  end
@@ -161,7 +161,7 @@ describe RWS::Books::Genre do
161
161
  let(:genre_id) { '005401' }
162
162
 
163
163
  specify 'delegate Books::ForeignBook.search' do
164
- RWS::Books::ForeignBook.should_receive(:search).with(:booksGenreId => genre_id)
164
+ expect(RWS::Books::ForeignBook).to receive(:search).with(:booksGenreId => genre_id)
165
165
 
166
166
  @genre.search
167
167
  end
@@ -171,7 +171,7 @@ describe RWS::Books::Genre do
171
171
  let(:genre_id) { '006501' }
172
172
 
173
173
  specify 'delegate Books::Game.search' do
174
- RWS::Books::Game.should_receive(:search).with(:booksGenreId => genre_id)
174
+ expect(RWS::Books::Game).to receive(:search).with(:booksGenreId => genre_id)
175
175
 
176
176
  @genre.search
177
177
  end
@@ -181,7 +181,7 @@ describe RWS::Books::Genre do
181
181
  let(:genre_id) { '007601' }
182
182
 
183
183
  specify 'delegate Books::Magazine.search' do
184
- RWS::Books::Magazine.should_receive(:search).with(:booksGenreId => genre_id)
184
+ expect(RWS::Books::Magazine).to receive(:search).with(:booksGenreId => genre_id)
185
185
 
186
186
  @genre.search
187
187
  end
@@ -13,8 +13,15 @@ describe RakutenWebService::Configuration do
13
13
 
14
14
  subject { RakutenWebService.configuration }
15
15
 
16
- its(:affiliate_id) { should eq('dummy_affiliate_id') }
17
- its(:application_id) { should eq('dummy_application_id') }
16
+ describe '#affiliate_id' do
17
+ subject { super().affiliate_id }
18
+ it { is_expected.to eq('dummy_affiliate_id') }
19
+ end
20
+
21
+ describe '#application_id' do
22
+ subject { super().application_id }
23
+ it { is_expected.to eq('dummy_application_id') }
24
+ end
18
25
  end
19
26
 
20
27
  context 'given block has more or less one arity' do
@@ -70,7 +77,7 @@ describe RakutenWebService::Configuration do
70
77
 
71
78
  it 'should return true' do
72
79
  expect(configuration).to be_debug_mode
73
- expect(configuration.debug).to be_false
80
+ expect(configuration.debug).to be_falsey
74
81
  end
75
82
  end
76
83
  end
@@ -37,13 +37,17 @@ describe RakutenWebService::Gora::CourseDetail do
37
37
 
38
38
  subject { RakutenWebService::Gora::CourseDetail.find(expected_query[:golfCourseId]) }
39
39
 
40
- it { should be_a RakutenWebService::Gora::CourseDetail }
40
+ it { is_expected.to be_a RakutenWebService::Gora::CourseDetail }
41
41
 
42
42
  specify 'should be accessed by key' do
43
43
  expect(subject['golfCourseName']).to eq(expected_json['golfCourseName'])
44
44
  expect(subject['golf_course_name']).to eq(expected_json['golfCourseName'])
45
45
  end
46
- its(:golf_course_name) { should eq(expected_json['golfCourseName']) }
46
+
47
+ describe '#golf_course_name' do
48
+ subject { super().golf_course_name }
49
+ it { is_expected.to eq(expected_json['golfCourseName']) }
50
+ end
47
51
 
48
52
  specify 'should be accessed to ratings' do
49
53
  expect(subject.ratings.size).to eq(expected_json['ratings'].size)
@@ -52,12 +52,16 @@ describe RakutenWebService::Gora::Course do
52
52
 
53
53
  subject { @courses.first }
54
54
 
55
- it { should be_a RakutenWebService::Gora::Course }
55
+ it { is_expected.to be_a RakutenWebService::Gora::Course }
56
56
  specify 'should be accessed by key' do
57
57
  expect(subject['golfCourseName']).to eq(expected_json['golfCourseName'])
58
58
  expect(subject['golf_course_name']).to eq(expected_json['golfCourseName'])
59
59
  end
60
- its(:golf_course_name) { should eq(expected_json['golfCourseName']) }
60
+
61
+ describe '#golf_course_name' do
62
+ subject { super().golf_course_name }
63
+ it { is_expected.to eq(expected_json['golfCourseName']) }
64
+ end
61
65
  end
62
66
 
63
67
  context 'after that, call each' do
@@ -50,12 +50,16 @@ describe RakutenWebService::Gora::Plan do
50
50
 
51
51
  subject { @plans.first }
52
52
 
53
- it { should be_a RakutenWebService::Gora::Plan }
53
+ it { is_expected.to be_a RakutenWebService::Gora::Plan }
54
54
  specify 'should be accessed by key' do
55
55
  expect(subject['golfCourseId']).to eq(expected_json['golfCourseId'])
56
56
  expect(subject['golf_course_id']).to eq(expected_json['golfCourseId'])
57
57
  end
58
- its(:golf_course_id) { should eq(expected_json['golfCourseId']) }
58
+
59
+ describe '#golf_course_id' do
60
+ subject { super().golf_course_id }
61
+ it { is_expected.to eq(expected_json['golfCourseId']) }
62
+ end
59
63
  end
60
64
  end
61
65
  end
@@ -44,7 +44,11 @@ describe RakutenWebService::Ichiba::Genre do
44
44
  expect(subject['genreName']).to eq(expected_json['current']['genreName'])
45
45
  expect(subject['genre_name']).to eq(expected_json['current']['genreName'])
46
46
  end
47
- its(:name) { should eq(expected_json['current']['genreName']) }
47
+
48
+ describe '#name' do
49
+ subject { super().name }
50
+ it { is_expected.to eq(expected_json['current']['genreName']) }
51
+ end
48
52
  end
49
53
 
50
54
  describe '.new' do
@@ -148,7 +152,7 @@ describe RakutenWebService::Ichiba::Genre do
148
152
  end
149
153
 
150
154
  specify "should call RankingItem's search with genre_id option" do
151
- RakutenWebService::Ichiba::RankingItem.should_receive(:search).with(:genre_id => genre_id)
155
+ expect(RakutenWebService::Ichiba::RankingItem).to receive(:search).with(:genre_id => genre_id)
152
156
  expect { genre.ranking }.to_not raise_error
153
157
  end
154
158
  end
@@ -162,7 +166,7 @@ describe RakutenWebService::Ichiba::Genre do
162
166
  end
163
167
 
164
168
  specify "should call Product search with genre_id option" do
165
- RakutenWebService::Ichiba::Product.should_receive(:search).with(:genre_id => genre_id)
169
+ expect(RakutenWebService::Ichiba::Product).to receive(:search).with(:genre_id => genre_id)
166
170
  expect { genre.products }.to_not raise_error
167
171
  end
168
172
  end
@@ -52,12 +52,16 @@ describe RakutenWebService::Ichiba::Item do
52
52
 
53
53
  subject { @items.first }
54
54
 
55
- it { should be_a RakutenWebService::Ichiba::Item }
55
+ it { is_expected.to be_a RakutenWebService::Ichiba::Item }
56
56
  specify 'shoud be access by key' do
57
57
  expect(subject['itemName']).to eq(expected_json['itemName'])
58
58
  expect(subject['item_name']).to eq(expected_json['itemName'])
59
59
  end
60
- its(:name) { should eq(expected_json['itemName']) }
60
+
61
+ describe '#name' do
62
+ subject { super().name }
63
+ it { is_expected.to eq(expected_json['itemName']) }
64
+ end
61
65
  specify 'should have xxx? method if the object has xxx_flag' do
62
66
  expect(subject.tax?).to eq(expected_json['taxFlag'] == 1)
63
67
  end
@@ -110,7 +114,7 @@ describe RakutenWebService::Ichiba::Item do
110
114
  context 'When TooManyRequest error raised' do
111
115
  let(:client) do
112
116
  c = double('client')
113
- c.stub(:get).and_raise(RWS::TooManyRequests)
117
+ allow(c).to receive(:get).and_raise(RWS::TooManyRequests)
114
118
  c
115
119
  end
116
120
 
@@ -151,7 +155,7 @@ describe RakutenWebService::Ichiba::Item do
151
155
 
152
156
  describe '.ranking' do
153
157
  before do
154
- RakutenWebService::Ichiba::RankingItem.should_receive(:search).with({})
158
+ expect(RakutenWebService::Ichiba::RankingItem).to receive(:search).with({})
155
159
  end
156
160
 
157
161
  specify "call RakutenWebService::Ichiba::RankingItem's search" do
@@ -167,7 +171,7 @@ describe RakutenWebService::Ichiba::Item do
167
171
  to_return(:body => response.to_json)
168
172
 
169
173
  expected_item = response['Items'][0]['Item']
170
- RakutenWebService::Ichiba::Genre.should_receive('new').with(expected_item['genreId'])
174
+ expect(RakutenWebService::Ichiba::Genre).to receive('new').with(expected_item['genreId'])
171
175
  end
172
176
 
173
177
  subject { RakutenWebService::Ichiba::Item.search(:keyword => 'Ruby').first.genre }
@@ -38,7 +38,7 @@ describe RakutenWebService::Ichiba::Product do
38
38
  subject { RakutenWebService::Ichiba::Product.search(:keyword => 'Ruby') }
39
39
 
40
40
  specify '' do
41
- expect(subject).to have(30).things
41
+ expect(subject.count).to eq(30)
42
42
  end
43
43
 
44
44
  describe 'For an response' do
@@ -41,8 +41,16 @@ describe RakutenWebService::Ichiba::RankingItem do
41
41
  expect(subject['itemName']).to eq(expected_json['itemName'])
42
42
  expect(subject['item_name']).to eq(expected_json['itemName'])
43
43
  end
44
- its(:rank) { should eq(1) }
45
- its(:name) { should eq(expected_json['itemName']) }
44
+
45
+ describe '#rank' do
46
+ subject { super().rank }
47
+ it { is_expected.to eq(1) }
48
+ end
49
+
50
+ describe '#name' do
51
+ subject { super().name }
52
+ it { is_expected.to eq(expected_json['itemName']) }
53
+ end
46
54
  end
47
55
 
48
56
  end
@@ -46,7 +46,7 @@ describe RakutenWebService::Kobo::Ebook do
46
46
  to_return(:body => response.to_json)
47
47
 
48
48
  expected_item = response['Items'][0]['Item']
49
- RakutenWebService::Kobo::Genre.should_receive('new').with(expected_item['koboGenreId'])
49
+ expect(RakutenWebService::Kobo::Genre).to receive('new').with(expected_item['koboGenreId'])
50
50
 
51
51
  RakutenWebService::Kobo::Ebook.search(:title => 'Ruby').first.genre
52
52
  end
@@ -21,7 +21,7 @@ describe RakutenWebService::Recipe do
21
21
 
22
22
  describe '.search' do
23
23
  it 'should not be called' do
24
- expect { RWS::Recipe.search(category_id: '10') }.to raise_error
24
+ expect { RWS::Recipe.search(category_id: '10') }.to raise_error(NoMethodError)
25
25
  end
26
26
  end
27
27
 
data/spec/spec_helper.rb CHANGED
@@ -10,7 +10,7 @@ require File.expand_path(File.join(__dir__, '..', 'lib', 'rakuten_web_service'))
10
10
 
11
11
  require 'webmock/rspec'
12
12
 
13
- Dir[File.expand_path(File.join(File.dirname(__FILE__), "support/**/*.rb"))].each { |f| require f }
13
+ Dir[File.expand_path(File.join(__dir__, "support/**/*.rb"))].each { |f| require f }
14
14
 
15
15
  RSpec.configure do |c|
16
16
  c.mock_with :rspec
@@ -19,10 +19,6 @@ RSpec.configure do |c|
19
19
  WebMock.disable_net_connect!(:allow => "codeclimate.com")
20
20
  end
21
21
 
22
- c.before :suite, integration: true do
23
- WebMock.allow_net_connect!
24
- end
25
-
26
22
  c.after :each do
27
23
  WebMock.reset!
28
24
  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.0.0.rc1
4
+ version: 1.0.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: 2016-06-29 00:00:00.000000000 Z
11
+ date: 2016-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ~>
88
88
  - !ruby/object:Gem::Version
89
- version: 2.14.1
89
+ version: 3.5.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
- version: 2.14.1
96
+ version: 3.5.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: tapp
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -224,9 +224,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
224
  version: 2.1.0
225
225
  required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  requirements:
227
- - - '>'
227
+ - - '>='
228
228
  - !ruby/object:Gem::Version
229
- version: 1.3.1
229
+ version: '0'
230
230
  requirements: []
231
231
  rubyforge_project:
232
232
  rubygems_version: 2.0.3