rakuten_web_service 1.4.1 → 1.4.2

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -5
  3. data/CHANGELOG.md +15 -1
  4. data/Gemfile +1 -1
  5. data/README.md +2 -1
  6. data/examples/books_item_search.rb +6 -6
  7. data/examples/gora_search.rb +2 -2
  8. data/examples/ichiba_item_search.rb +1 -1
  9. data/lib/rakuten_web_service/books/genre.rb +1 -1
  10. data/lib/rakuten_web_service/client.rb +4 -0
  11. data/lib/rakuten_web_service/ichiba/genre.rb +1 -1
  12. data/lib/rakuten_web_service/ichiba/shop.rb +1 -1
  13. data/lib/rakuten_web_service/search_result.rb +5 -5
  14. data/lib/rakuten_web_service/version.rb +1 -1
  15. data/spec/rakuten_web_service/books/book_spec.rb +15 -15
  16. data/spec/rakuten_web_service/books/cd_spec.rb +10 -10
  17. data/spec/rakuten_web_service/books/dvd_spec.rb +10 -10
  18. data/spec/rakuten_web_service/books/foreign_book_spec.rb +10 -10
  19. data/spec/rakuten_web_service/books/game_spec.rb +8 -8
  20. data/spec/rakuten_web_service/books/genre_spec.rb +22 -22
  21. data/spec/rakuten_web_service/books/magazine_spec.rb +8 -8
  22. data/spec/rakuten_web_service/books/software_spec.rb +8 -8
  23. data/spec/rakuten_web_service/books/total_spec.rb +5 -5
  24. data/spec/rakuten_web_service/client_spec.rb +19 -19
  25. data/spec/rakuten_web_service/gora/course_detail_spec.rb +4 -4
  26. data/spec/rakuten_web_service/gora/course_spec.rb +7 -7
  27. data/spec/rakuten_web_service/gora/plan_spec.rb +6 -6
  28. data/spec/rakuten_web_service/ichiba/genre_spec.rb +30 -31
  29. data/spec/rakuten_web_service/ichiba/item_spec.rb +24 -24
  30. data/spec/rakuten_web_service/ichiba/product_search_spec.rb +8 -8
  31. data/spec/rakuten_web_service/ichiba/ranking_spec.rb +4 -4
  32. data/spec/rakuten_web_service/ichiba/shop_spec.rb +1 -1
  33. data/spec/rakuten_web_service/kobo/ebook_spec.rb +9 -9
  34. data/spec/rakuten_web_service/kobo/genre_spec.rb +9 -9
  35. data/spec/rakuten_web_service/recipe/category_spec.rb +3 -3
  36. data/spec/rakuten_web_service/recipe_spec.rb +3 -3
  37. data/spec/spec_helper.rb +6 -3
  38. metadata +2 -3
  39. data/.coveralls.yml +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1eb72352ce1d5a3438ff53f83c36beed80fe1c2e
4
- data.tar.gz: 6b367c56add033e81ddebafa35ed0c3d6212c2b8
3
+ metadata.gz: b14f637d234a8bb4962e0ca46a76b171a7a8918d
4
+ data.tar.gz: 315b2c8f96b6b630b626cfd6299650a59ce3801e
5
5
  SHA512:
6
- metadata.gz: 59a3290303696eccf35353c7e957e1391bdae96686cfd2b6dde48dae0fd67663587c3b41368fc42b32bf1cc02ea240a442e0bf4cc5565783472938a9f8857303
7
- data.tar.gz: caccbdebffb9fcad8ba7fc6f8585a60287ab85af7729cd763e72bae8ccccd5d6d69bcc0e688e42e765cd803c6090f78560dd0f604f6471d95c96419d2204a0d3
6
+ metadata.gz: 2e85f855a001112c676e8b17e41c445a67a46060c3bf2a7e9780ed29b11ab0286fe78162128cd198df987bafd079d088ce1cc8d0d57c4f8b8a7f6b519674ae24
7
+ data.tar.gz: 1f5f80be05c450def2e4e1592e40d0e1f4cd5e17979ff2af8081e67903ef9b05050c8b8ef25bd47ddc734539aae6cf3be0b26c4c2166a95c3d2561733af16c6e
data/.travis.yml CHANGED
@@ -1,8 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.1.10
4
- - 2.2.5
5
- - 2.3.1
4
+ - 2.2.6
5
+ - 2.3.3
6
+ - 2.4.0
6
7
  - ruby-head
7
8
 
8
9
  cache: bundler
@@ -25,6 +26,6 @@ addons:
25
26
 
26
27
  notifications:
27
28
  email: false
28
- hipchat:
29
- rooms:
30
- secure: RYuIFjh/T6Hlj9nJ0RjmlTlES+9ZWcDNe1o2KRqMdH8cK1epIEgcEzMsFP6wKPRMQqOVw6Tu5gBMltDgu26sAW8HkTnMlzYtF6AVeOgsC6VVO9XzdaoVWWQX5J/Xn21vNV1vcncuOuMByz6dmzWngZv3T0u1mcvPje00EDNo27M=
29
+ webhooks:
30
+ urls:
31
+ - https://webhooks.gitter.im/e/059b85fcc75550b7bc39
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # v1.4.2 (2017/01/22)
2
+
3
+ ## Bug Fixes
4
+
5
+ * `Net::HTTP` is NOT `reuquire`d anywhere in the codebase. [#67](https://github.com/rakuten-ws/rws-ruby-sdk/pull/67)
6
+
7
+ The version 1.4.1 or earlier of this gem doesn't `require 'net/http'` by itself.
8
+ @gouf found the bug report in [teratail](https://teratail.com/questions/62804) and made a pull-request to fix it. Thanks!
9
+
10
+ ## Improvements
11
+
12
+ * `debug_mode` has come again! if you want to see responses from Rakuten Web Service APIs, you can see the ones by set `debug_mode` `true`. [#56](https://github.com/rakuten-ws/rws-ruby-sdk/pull/56)
13
+ * Refactoring: use new Hash syntax as supporting ruby 1.9 series has been stopped already. [#60](https://github.com/rakuten-ws/rws-ruby-sdk/pull/60)
14
+
1
15
  # v1.4.1 (2016/11/22)
2
16
 
3
17
  ## Bug Fix
@@ -6,7 +20,7 @@
6
20
 
7
21
  ## Thanks
8
22
 
9
- I'm pleased to say thanks to @sho-yamane since he reporeted the bug #53. If he didn't do it, I would find the bug much later.
23
+ I'm pleased to say thanks to @sho-yamane since he reported the bug #53. If he didn't do it, I would find the bug much later.
10
24
  Thanks, @sho-yamane.
11
25
 
12
26
 
data/Gemfile CHANGED
@@ -4,6 +4,6 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :test do
7
+ gem "simplecov", require: false
7
8
  gem "codeclimate-test-reporter", '~> 1.0.0'
8
- gem "coveralls", require: nil
9
9
  end
data/README.md CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/rakuten-ws/rws-ruby-sdk.svg?branch=master)](https://travis-ci.org/rakuten-ws/rws-ruby-sdk)
4
4
  [![Gem Version](https://badge.fury.io/rb/rakuten_web_service.svg)](https://badge.fury.io/rb/rakuten_web_service)
5
- [![Coverage Status](https://coveralls.io/repos/github/rakuten-ws/rws-ruby-sdk/badge.svg?branch=master)](https://coveralls.io/github/rakuten-ws/rws-ruby-sdk?branch=master)
5
+ [![Test Coverage](https://codeclimate.com/github/rakuten-ws/rws-ruby-sdk/badges/coverage.svg)](https://codeclimate.com/github/rakuten-ws/rws-ruby-sdk/coverage)
6
6
  [![Code Climate](https://codeclimate.com/github/rakuten-ws/rws-ruby-sdk/badges/gpa.svg)](https://codeclimate.com/github/rakuten-ws/rws-ruby-sdk)
7
+ [![Gitter](https://badges.gitter.im/rakuten-ws/rws-ruby-sdk.svg)](https://gitter.im/rakuten-ws/rws-ruby-sdk?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
7
8
 
8
9
  This gem provides a client for easily accessing [Rakuten Web Service APIs](https://webservice.rakuten.co.jp/).
9
10
 
@@ -1,8 +1,8 @@
1
- # This is a sample script of Rakuten Books APIs.
2
- # RWS Ruby SDK supports Books API. The inteface is similar to ones Ichiba API.
3
- # If you want to search CDs dealt in Rakuten Books, you can do it with `RakutenWebService::Books::CD`.
4
- # As for other resources, there are `RakutenWebService::Books::Book`, `RakutenWebService::Books::DVD` and so on.
5
- # Please refer to the following documents if you want more detail of input/output parameters:
1
+ # This is a sample script of Rakuten Books APIs.
2
+ # RWS Ruby SDK supports Books API. The inteface is similar to ones Ichiba API.
3
+ # If you want to search CDs dealt in Rakuten Books, you can do it with `RakutenWebService::Books::CD`.
4
+ # As for other resources, there are `RakutenWebService::Books::Book`, `RakutenWebService::Books::DVD` and so on.
5
+ # Please refer to the following documents if you want more detail of input/output parameters:
6
6
  # http://webservice.rakuten.co.jp/document/
7
7
  #
8
8
 
@@ -15,7 +15,7 @@ RakutenWebService.configure do |c|
15
15
  c.application_id = application_id
16
16
  end
17
17
 
18
- cds = RakutenWebService::Books::CD.search(:title => keyword)
18
+ cds = RakutenWebService::Books::CD.search(title: keyword)
19
19
 
20
20
  cds.first(10).each do |cd|
21
21
  puts "#{cd.title} (#{cd.title_kana}):\n\t #{cd.play_list}"
@@ -16,7 +16,7 @@ RakutenWebService.configure do |c|
16
16
  c.application_id = application_id
17
17
  end
18
18
 
19
- c = RakutenWebService::Gora::Course.search(:keyword => keyword).first
19
+ c = RakutenWebService::Gora::Course.search(keyword: keyword).first
20
20
  id = c.golf_course_id
21
21
  puts id
22
22
  puts c.golf_course_name
@@ -35,7 +35,7 @@ end
35
35
 
36
36
  next_week = Date.today + 7
37
37
  chiba_and_kanagawa = '12,14'
38
- plans = RWS::Gora::Plan.search(:areaCode => chiba_and_kanagawa, :playDate => next_week.strftime('%Y-%m-%d'))
38
+ plans = RWS::Gora::Plan.search(areaCode: chiba_and_kanagawa, playDate: next_week.strftime('%Y-%m-%d'))
39
39
  plans.first(5).each { |p|
40
40
  puts "#{p.golf_course_id}, #{p.golf_course_name}"
41
41
  p.plan_info.each { |pi|
@@ -7,7 +7,7 @@ RakutenWebService.configure do |c|
7
7
  c.application_id = application_id
8
8
  end
9
9
 
10
- items = RakutenWebService::Ichiba::Item.search(:keyword => keyword)
10
+ items = RakutenWebService::Ichiba::Item.search(keyword: keyword)
11
11
 
12
12
  items.first(10).each do |item|
13
13
  puts "#{item['itemName']}, #{item['itemPrice']} yen"
@@ -12,7 +12,7 @@ module RakutenWebService
12
12
  root_id '000'
13
13
 
14
14
  def search(params={})
15
- params = params.merge(:booksGenreId => self.id)
15
+ params = params.merge(booksGenreId: self.id)
16
16
  resource = Books::Resource.find_resource_by_genre_id(self.id)
17
17
  resource.search(params)
18
18
  end
@@ -1,4 +1,5 @@
1
1
  require 'uri'
2
+ require 'net/http'
2
3
  require 'cgi'
3
4
  require 'json'
4
5
  require 'rakuten_web_service/response'
@@ -29,6 +30,9 @@ module RakutenWebService
29
30
  def request(path, params)
30
31
  http = Net::HTTP.new(@url.host, @url.port)
31
32
  http.use_ssl = true
33
+ if RakutenWebService.configuration.debug_mode?
34
+ http.set_debug_output($stderr)
35
+ end
32
36
  path = "#{path}?#{params.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')}"
33
37
  header = {
34
38
  'User-Agent' => "RakutenWebService SDK for Ruby v#{RWS::VERSION}(ruby-#{RUBY_VERSION} [#{RUBY_PLATFORM}])"
@@ -17,7 +17,7 @@ module RakutenWebService
17
17
  end
18
18
 
19
19
  def products(options={})
20
- options = options.merge(:genre_id => self.id)
20
+ options = options.merge(genre_id: self.id)
21
21
  RakutenWebService::Ichiba::Product.search(options)
22
22
  end
23
23
  end
@@ -7,7 +7,7 @@ module RakutenWebService
7
7
  attribute :shopName, :shopCode, :shopUrl, :shopAffiliateUrl
8
8
 
9
9
  def items(options={})
10
- options = options.merge(:shop_code => self.code)
10
+ options = options.merge(shop_code: self.code)
11
11
  RakutenWebService::Ichiba::Item.search(options)
12
12
  end
13
13
  end
@@ -47,8 +47,8 @@ module RakutenWebService
47
47
  "+#{key}"
48
48
  end
49
49
  elsif options.to_s == 'standard'
50
- new_params[:sort] = 'standard'
51
- else
50
+ new_params[:sort] = 'standard'
51
+ else
52
52
  raise ArgumentError, "Invalid Sort Option: #{options.inspect}"
53
53
  end
54
54
  self.class.new(new_params, @resource_class)
@@ -68,11 +68,11 @@ module RakutenWebService
68
68
  end
69
69
 
70
70
  def next_page
71
- search(:page => response.page + 1)
71
+ search(page: response.page + 1)
72
72
  end
73
73
 
74
74
  def page(num)
75
- search(:page => num)
75
+ search(page: num)
76
76
  end
77
77
 
78
78
  def genre_information
@@ -81,7 +81,7 @@ module RakutenWebService
81
81
 
82
82
  private
83
83
  def ensure_retries(max_retries=RakutenWebService.configuration.max_retries)
84
- begin
84
+ begin
85
85
  yield
86
86
  rescue RWS::TooManyRequests => e
87
87
  if max_retries > 0
@@ -1,3 +1,3 @@
1
1
  module RakutenWebService
2
- VERSION = "1.4.1".freeze
2
+ VERSION = "1.4.2".freeze
3
3
  end
@@ -6,9 +6,9 @@ describe RakutenWebService::Books::Book do
6
6
  let(:application_id) { 'dummy_application_id' }
7
7
  let(:expected_query) do
8
8
  {
9
- :affiliateId => affiliate_id,
10
- :applicationId => application_id,
11
- :title => 'Ruby'
9
+ affiliateId: affiliate_id,
10
+ applicationId: application_id,
11
+ title: 'Ruby'
12
12
  }
13
13
  end
14
14
 
@@ -23,18 +23,18 @@ describe RakutenWebService::Books::Book do
23
23
  before do
24
24
  response = JSON.parse(fixture('books/book_search_with_keyword_Ruby.json'))
25
25
  @expected_request = stub_request(:get, endpoint).
26
- with(:query => expected_query).to_return(:body => response.to_json)
26
+ with(query: expected_query).to_return(body: response.to_json)
27
27
 
28
28
  response['page'] = 2
29
29
  response['first'] = 31
30
30
  response['last'] = 60
31
31
  @second_request = stub_request(:get, endpoint).
32
- with(:query => expected_query.merge(:page => 2)).
33
- to_return(:body => response.to_json)
32
+ with(query: expected_query.merge(page: 2)).
33
+ to_return(body: response.to_json)
34
34
  end
35
35
 
36
36
  specify 'call endpoint when accessing results' do
37
- books = RakutenWebService::Books::Book.search(:title => 'Ruby')
37
+ books = RakutenWebService::Books::Book.search(title: 'Ruby')
38
38
  expect(@expected_request).to_not have_been_made
39
39
 
40
40
  books.first
@@ -46,7 +46,7 @@ describe RakutenWebService::Books::Book do
46
46
  before do
47
47
  response = JSON.parse(fixture('books/book_search_with_keyword_Ruby.json'))
48
48
  @expected_request = stub_request(:get, endpoint).
49
- with(:query => expected_query).to_return(:body => response.to_json)
49
+ with(query: expected_query).to_return(body: response.to_json)
50
50
  end
51
51
 
52
52
  subject { RakutenWebService::Books::Book.search(title: 'Ruby') }
@@ -76,11 +76,11 @@ describe RakutenWebService::Books::Book do
76
76
  res['last'] = 30
77
77
 
78
78
  stub_request(:get, endpoint).
79
- with(:query => expected_query).to_return(:body => res.to_json)
79
+ with(query: expected_query).to_return(body: res.to_json)
80
80
  end
81
81
 
82
82
  specify 'genretes RWS::Books::Genre object' do
83
- book = RWS::Books::Book.search(:title => 'Ruby').first
83
+ book = RWS::Books::Book.search(title: 'Ruby').first
84
84
 
85
85
  expect(RWS::Books::Genre).to receive(:new).with(response['Items'][0]['Item']['booksGenreId'])
86
86
  expect(book.genre).to be_a(Array)
@@ -88,24 +88,24 @@ describe RakutenWebService::Books::Book do
88
88
 
89
89
  specify 'generate an array of Books::Genre object if books_genre_id includes 2 ids' do
90
90
  genre_id = '001004008007/001021001010'
91
- book = RWS::Books::Book.new(:booksGenreId => genre_id)
91
+ book = RWS::Books::Book.new(booksGenreId: genre_id)
92
92
  genre_id.split('/').each do |id|
93
93
  expect(RWS::Books::Genre).to receive(:new).with(id)
94
94
  end
95
-
95
+
96
96
  expect(book.genres).to be_a(Array)
97
97
  end
98
98
  end
99
99
 
100
100
  context 'When using Books::Total.search' do
101
101
  let(:book) do
102
- RWS::Books::Book.new(:isbn => '12345')
102
+ RWS::Books::Book.new(isbn: '12345')
103
103
  end
104
104
 
105
105
  before do
106
106
  @expected_request = stub_request(:get, endpoint).
107
- with(:query => { :affiliateId => affiliate_id, :applicationId => application_id, :isbn => '12345' }).
108
- to_return(:body => { :Items => [ { :Item => { :title => 'foo' } } ] }.to_json)
107
+ with(query: { affiliateId: affiliate_id, applicationId: application_id, isbn: '12345' }).
108
+ to_return(body: { Items: [ { Item: { title: 'foo' } } ] }.to_json)
109
109
  end
110
110
 
111
111
  specify 'retrieves automatically if accessing the value of lack attribute' do
@@ -6,9 +6,9 @@ describe RakutenWebService::Books::CD do
6
6
  let(:application_id) { 'dummy_application_id' }
7
7
  let(:expected_query) do
8
8
  {
9
- :affiliateId => affiliate_id,
10
- :applicationId => application_id,
11
- :keyword => 'Ruby'
9
+ affiliateId: affiliate_id,
10
+ applicationId: application_id,
11
+ keyword: 'Ruby'
12
12
  }
13
13
  end
14
14
 
@@ -23,18 +23,18 @@ describe RakutenWebService::Books::CD do
23
23
  before do
24
24
  response = JSON.parse(fixture('books/cd_search_with_keyword_Ruby.json'))
25
25
  @expected_request = stub_request(:get, endpoint).
26
- with(:query => expected_query).to_return(:body => response.to_json)
26
+ with(query: expected_query).to_return(body: response.to_json)
27
27
 
28
28
  response['page'] = 2
29
29
  response['first'] = 31
30
30
  response['last'] = 60
31
31
  @second_request = stub_request(:get, endpoint).
32
- with(:query => expected_query.merge(:page => 2)).
33
- to_return(:body => response.to_json)
32
+ with(query: expected_query.merge(page: 2)).
33
+ to_return(body: response.to_json)
34
34
  end
35
35
 
36
36
  specify 'call endpoint when accessing results' do
37
- cds = RakutenWebService::Books::CD.search(:keyword => 'Ruby')
37
+ cds = RakutenWebService::Books::CD.search(keyword: 'Ruby')
38
38
  expect(@expected_request).to_not have_been_made
39
39
 
40
40
  cd = cds.first
@@ -45,13 +45,13 @@ describe RakutenWebService::Books::CD do
45
45
 
46
46
  context 'When using Books::Total.search' do
47
47
  let(:cd) do
48
- RWS::Books::CD.new(:jan => '12345')
48
+ RWS::Books::CD.new(jan: '12345')
49
49
  end
50
50
 
51
51
  before do
52
52
  @expected_request = stub_request(:get, endpoint).
53
- with(:query => { :affiliateId => affiliate_id, :applicationId => application_id, :jan => '12345' }).
54
- to_return(:body => { :Items => [ { :Item => { :title => 'foo' } } ] }.to_json)
53
+ with(query: { affiliateId: affiliate_id, applicationId: application_id, jan: '12345' }).
54
+ to_return(body: { Items: [ { Item: { title: 'foo' } } ] }.to_json)
55
55
  end
56
56
 
57
57
  specify 'retrieves automatically if accessing the value of lack attribute' do
@@ -6,9 +6,9 @@ describe RakutenWebService::Books::DVD do
6
6
  let(:application_id) { 'dummy_application_id' }
7
7
  let(:expected_query) do
8
8
  {
9
- :affiliateId => affiliate_id,
10
- :applicationId => application_id,
11
- :keyword => 'Ruby'
9
+ affiliateId: affiliate_id,
10
+ applicationId: application_id,
11
+ keyword: 'Ruby'
12
12
  }
13
13
  end
14
14
 
@@ -23,18 +23,18 @@ describe RakutenWebService::Books::DVD do
23
23
  before do
24
24
  response = JSON.parse(fixture('books/dvd_search_with_keyword_Ruby.json'))
25
25
  @expected_request = stub_request(:get, endpoint).
26
- with(:query => expected_query).to_return(:body => response.to_json)
26
+ with(query: expected_query).to_return(body: response.to_json)
27
27
 
28
28
  response['page'] = 2
29
29
  response['first'] = 31
30
30
  response['last'] = 60
31
31
  @second_request = stub_request(:get, endpoint).
32
- with(:query => expected_query.merge(:page => 2)).
33
- to_return(:body => response.to_json)
32
+ with(query: expected_query.merge(page: 2)).
33
+ to_return(body: response.to_json)
34
34
  end
35
35
 
36
36
  specify 'call endpoint when accessing results' do
37
- dvds = RakutenWebService::Books::DVD.search(:keyword => 'Ruby')
37
+ dvds = RakutenWebService::Books::DVD.search(keyword: 'Ruby')
38
38
  expect(@expected_request).to_not have_been_made
39
39
 
40
40
  dvd = dvds.first
@@ -45,13 +45,13 @@ describe RakutenWebService::Books::DVD do
45
45
 
46
46
  context 'When using Books::Total.search' do
47
47
  let(:dvd) do
48
- RWS::Books::DVD.new(:jan => '12345')
48
+ RWS::Books::DVD.new(jan: '12345')
49
49
  end
50
50
 
51
51
  before do
52
52
  @expected_request = stub_request(:get, endpoint).
53
- with(:query => { :affiliateId => affiliate_id, :applicationId => application_id, :jan => '12345' }).
54
- to_return(:body => { :Items => [ { :Item => { :title => 'foo' } } ] }.to_json)
53
+ with(query: { affiliateId: affiliate_id, applicationId: application_id, jan: '12345' }).
54
+ to_return(body: { Items: [ { Item: { title: 'foo' } } ] }.to_json)
55
55
  end
56
56
 
57
57
  specify 'retrieves automatically if accessing the value of lack attribute' do
@@ -6,9 +6,9 @@ describe RakutenWebService::Books::ForeignBook do
6
6
  let(:application_id) { 'dummy_application_id' }
7
7
  let(:expected_query) do
8
8
  {
9
- :affiliateId => affiliate_id,
10
- :applicationId => application_id,
11
- :keyword => 'Ruby'
9
+ affiliateId: affiliate_id,
10
+ applicationId: application_id,
11
+ keyword: 'Ruby'
12
12
  }
13
13
  end
14
14
 
@@ -23,18 +23,18 @@ describe RakutenWebService::Books::ForeignBook do
23
23
  before do
24
24
  response = JSON.parse(fixture('books/foreign_book_search_with_keyword_Ruby.json'))
25
25
  @expected_request = stub_request(:get, endpoint).
26
- with(:query => expected_query).to_return(:body => response.to_json)
26
+ with(query: expected_query).to_return(body: response.to_json)
27
27
 
28
28
  response['page'] = 2
29
29
  response['first'] = 31
30
30
  response['last'] = 60
31
31
  @second_request = stub_request(:get, endpoint).
32
- with(:query => expected_query.merge(:page => 2)).
33
- to_return(:body => response.to_json)
32
+ with(query: expected_query.merge(page: 2)).
33
+ to_return(body: response.to_json)
34
34
  end
35
35
 
36
36
  specify 'call endpoint when accessing results' do
37
- books = RakutenWebService::Books::ForeignBook.search(:keyword => 'Ruby')
37
+ books = RakutenWebService::Books::ForeignBook.search(keyword: 'Ruby')
38
38
  expect(@expected_request).to_not have_been_made
39
39
 
40
40
  books.first
@@ -44,13 +44,13 @@ describe RakutenWebService::Books::ForeignBook do
44
44
 
45
45
  context 'When using Books::Total.search' do
46
46
  let(:book) do
47
- RWS::Books::ForeignBook.new(:isbn => '12345')
47
+ RWS::Books::ForeignBook.new(isbn: '12345')
48
48
  end
49
49
 
50
50
  before do
51
51
  @expected_request = stub_request(:get, endpoint).
52
- with(:query => { :affiliateId => affiliate_id, :applicationId => application_id, :isbn => '12345' }).
53
- to_return(:body => { :Items => [ { :Item => { :title => 'foo' } } ] }.to_json)
52
+ with(query: { affiliateId: affiliate_id, applicationId: application_id, isbn: '12345' }).
53
+ to_return(body: { Items: [ { Item: { title: 'foo' } } ] }.to_json)
54
54
  end
55
55
 
56
56
  specify 'retrieves automatically if accessing the value of lack attribute' do