rakuten_web_service 1.6.1 → 1.7.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: 5aeee894eae4b8fd7ae21d2962ed0fe90eee73cf
4
- data.tar.gz: bebc76e67f7bbc00a0f89d2f1e68efbdc5fc6767
3
+ metadata.gz: a44bc4bde1ee8c5cf109a3152c876ccc4d276ee8
4
+ data.tar.gz: a8abf775e41e32344864581554cce436f607572e
5
5
  SHA512:
6
- metadata.gz: c3df84fcdd99a3fa8ee8a1b9703bb96516e3055ca9ba653ef6c822834218b53e7e150526af7e1c3f750ce391e0f26575b648c4b8388ca2631ef9c2964f31bc63
7
- data.tar.gz: 3f1a9b2d21d91452c422cf7e8b8e6dee43b8bf7a84fab897da16ef87a3706cb0831ee02ce991cec93f5628043f0c680329b14bb6729f71bc0155d75747be20a6
6
+ metadata.gz: edd42033899a2cb395efb22eee879988da13125d9128bd28ce0e78687a26e906850adbb970d53a50d6018165ff5cbd6439d6102203017cd76a2c846fb4255074
7
+ data.tar.gz: 49eed99b36cb80112f345d62db8e7b4972af621cc38a831374761f4352c4f9dd1793230561b0064265cdd216aded8910c0601367c2f36770aa29705870581d8b
data/.travis.yml CHANGED
@@ -11,6 +11,8 @@ cache: bundler
11
11
  before_install:
12
12
  - gem install bundler
13
13
 
14
+ bundler_args: --without vscode
15
+
14
16
  script:
15
17
  - bundle exec rake
16
18
  - bundle exec codeclimate-test-reporter
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # v1.7.0 (2017/09/17)
2
+
3
+ ## Enhancements
4
+
5
+ * Add Helpers for pagination. [#78](https://github.com/rakuten-ws/rws-ruby-sdk/pull/78)
6
+
7
+ ## Improvements
8
+
9
+ * Minor fix for README.ja.md [#77](https://github.com/rakuten-ws/rws-ruby-sdk/pull/77)
10
+ * Suppressing installing gems required for debugging with VSCode in CI. [#79](https://github.com/rakuten-ws/rws-ruby-sdk/pull/79)
11
+
12
+ ## Thanks
13
+
14
+ I'm pleasured to say thanks to @jinco13. He fixed wrong method names and links in README.ja.md.
15
+
1
16
  # v1.6.1 (2017/08/21)
2
17
 
3
18
  ## Bug Fix
data/Gemfile CHANGED
@@ -7,3 +7,8 @@ group :test do
7
7
  gem "simplecov", require: false
8
8
  gem "codeclimate-test-reporter", '~> 1.0.0'
9
9
  end
10
+
11
+ group :vscode do
12
+ gem "debase", "0.2.2.beta10"
13
+ gem "ruby-debug-ide", "~> 0.6.0"
14
+ end
data/README.ja.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  rakuten\_web\_serviceは、 Rubyから楽天が提供しているAPIに簡単にアクセスできるSDK(Software Development Kit)です。
8
8
 
9
- English version is [here](http://github.com/rakuten-ws/rws-ruby-sdk/blob/master/README.en.md).
9
+ English version is [here](http://github.com/rakuten-ws/rws-ruby-sdk/blob/master/README.md).
10
10
 
11
11
  ## インストール方法
12
12
 
@@ -73,10 +73,10 @@ bundlerを利用したアプリケーションの場合、Gemfileに以下の1
73
73
 
74
74
  ### 設定
75
75
 
76
- `RakutenWebService.configuration` メソッドを使い、Application IDとAffiliate ID(オプション)を指定することができます。
76
+ `RakutenWebService.configure` メソッドを使い、Application IDとAffiliate ID(オプション)を指定することができます。
77
77
 
78
78
  ```ruby
79
- RakutenWebService.configuration do |c|
79
+ RakutenWebService.configure do |c|
80
80
  c.application_id = 'YOUR_APPLICATION_ID'
81
81
  c.affiliate_id = 'YOUR_AFFILIATE_ID'
82
82
  end
@@ -38,6 +38,14 @@ module RakutenWebService
38
38
  page && (not last_page?)
39
39
  end
40
40
 
41
+ def has_previous_page?
42
+ page && (not first_page?)
43
+ end
44
+
45
+ def first_page?
46
+ page == 1
47
+ end
48
+
41
49
  def last_page?
42
50
  page >= page_count
43
51
  end
@@ -71,6 +71,14 @@ module RakutenWebService
71
71
  search(page: response.page + 1)
72
72
  end
73
73
 
74
+ def has_previous_page?
75
+ response.has_previous_page?
76
+ end
77
+
78
+ def previous_page
79
+ search(page: response.page - 1)
80
+ end
81
+
74
82
  def page(num)
75
83
  search(page: num)
76
84
  end
@@ -1,3 +1,3 @@
1
1
  module RakutenWebService
2
- VERSION = "1.6.1".freeze
2
+ VERSION = "1.7.0".freeze
3
3
  end
@@ -22,6 +22,4 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "webmock", "~> 1.20.4"
23
23
  spec.add_development_dependency "rspec", '~> 3.5.0'
24
24
  spec.add_development_dependency "tapp"
25
- spec.add_development_dependency "ruby-debug-ide", "~> 0.6.0"
26
- spec.add_development_dependency "debase", "0.2.2.beta10"
27
25
  end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ describe RakutenWebService::Response do
4
+
5
+ describe "Pagenate helpers" do
6
+ let(:resource_class) { double(:resource_class) }
7
+
8
+ subject { RakutenWebService::Response.new(resource_class, json) }
9
+
10
+ context "When page is less than pageCount" do
11
+ let(:json) do
12
+ {
13
+ 'page' => 1, 'pageCount' => 2
14
+ }
15
+ end
16
+
17
+ it { is_expected.to have_next_page }
18
+ it { is_expected.to_not be_last_page }
19
+ it { is_expected.to_not have_previous_page }
20
+ it { is_expected.to be_first_page }
21
+ end
22
+ context "When page is equal to pageCount" do
23
+ let(:json) do
24
+ {
25
+ 'page' => 2, 'pageCount' => 2
26
+ }
27
+ end
28
+
29
+ it { is_expected.to_not have_next_page }
30
+ it { is_expected.to be_last_page }
31
+ it { is_expected.to have_previous_page }
32
+ it { is_expected.to_not be_first_page }
33
+ end
34
+ context "When current page is in pages" do
35
+ let(:json) do
36
+ {
37
+ 'page' => 2, 'pageCount' => 3
38
+ }
39
+ end
40
+
41
+ it { is_expected.to have_next_page }
42
+ it { is_expected.to_not be_last_page }
43
+ it { is_expected.to have_previous_page }
44
+ it { is_expected.to_not be_last_page }
45
+ end
46
+ end
47
+ 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.6.1
4
+ version: 1.7.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-08-21 00:00:00.000000000 Z
11
+ date: 2017-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,34 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: ruby-debug-ide
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 0.6.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 0.6.0
97
- - !ruby/object:Gem::Dependency
98
- name: debase
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '='
102
- - !ruby/object:Gem::Version
103
- version: 0.2.2.beta10
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '='
109
- - !ruby/object:Gem::Version
110
- version: 0.2.2.beta10
111
83
  description: Ruby Client for Rakuten Web Service
112
84
  email:
113
85
  - tatsuya.b.sato@mail.rakuten.com
@@ -216,6 +188,7 @@ files:
216
188
  - spec/rakuten_web_service/kobo/genre_spec.rb
217
189
  - spec/rakuten_web_service/recipe/category_spec.rb
218
190
  - spec/rakuten_web_service/recipe_spec.rb
191
+ - spec/rakuten_web_service/response_spec.rb
219
192
  - spec/spec_helper.rb
220
193
  - spec/support/fixture_suppot.rb
221
194
  homepage: http://webservice.rakuten.co.jp/
@@ -289,5 +262,6 @@ test_files:
289
262
  - spec/rakuten_web_service/kobo/genre_spec.rb
290
263
  - spec/rakuten_web_service/recipe/category_spec.rb
291
264
  - spec/rakuten_web_service/recipe_spec.rb
265
+ - spec/rakuten_web_service/response_spec.rb
292
266
  - spec/spec_helper.rb
293
267
  - spec/support/fixture_suppot.rb