rakuten_web_service 1.11.0 → 1.12.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
  SHA256:
3
- metadata.gz: ed9f7ae4ab29a8e7fbfc3ffd5fe037dbe1d4f136766ec20b6ded70546ae70025
4
- data.tar.gz: 0e43fe72a9805aff0b60ce70c3eca8a072fafbcc537ac8cf2dca56250dfdd579
3
+ metadata.gz: 01f66fb3ced048c2710640e4e32c241dd4ce7a2db17acd084a2f0228feed0b76
4
+ data.tar.gz: b8c080ef1f1bdbd68117c8d82bc5723458c0b954fcf859c1c04862b025e3beac
5
5
  SHA512:
6
- metadata.gz: 5c613c66feb43d62f5ad0515c72a93bbcf0b7df98f1da0a6a3eb3a3e53c75fd4917f19d07ace63f440c4c9e93558c2409330569f0dcf6a0f6ef6e1fe241b80b3
7
- data.tar.gz: da198c232b7be05b180eef34e9a5c278618e7e2eba9405d437b70aed65f938f3af79a1c00c808c3be9d2cc3c2821017f7a25c4421e204fb95c82cd997d9433f5
6
+ metadata.gz: 71c17732c800e111dd727bbabbf04ebde576d95ae269724d3aaef79446b1ffb7b8608b44efa3cf35fae6830b8b1a3daee7e9203b9f1dcfcd13efae878b3ae915
7
+ data.tar.gz: 9b737c01bd7de2d7f47a958a0c191a608cecf854ad353034e76a45905a1ecccad0c244af999ed78ead0431e563be2450a88fd640e2222a07e093d53e8f7ad29d
@@ -1,5 +1,15 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v1.12.0 (2019/09/09)
4
+
5
+ ### Enhancements
6
+
7
+ - Starts Support Ichiba Tag API. [#110](https://github.com/rakuten-ws/rws-ruby-sdk/pull/110)
8
+
9
+ ### Thanks
10
+
11
+ We are pleased to say thanks to @keisukeponpoko. This release is made by their seminal work.
12
+
3
13
  ## v1.11.0 (2019/07/11)
4
14
 
5
15
  ### Improvements
data/README.md CHANGED
@@ -162,6 +162,7 @@ Now rakuten\_web\_service is supporting the following APIs:
162
162
  * [Rakuten Ichiba Genre Search API](http://webservice.rakuten.co.jp/api/ichibagenresearch/)
163
163
  * [Rakuten Ichiba Ranking API](http://webservice.rakuten.co.jp/api/ichibaitemranking/)
164
164
  * [Rakuten Product API](http://webservice.rakuten.co.jp/api/productsearch/)
165
+ * [Rakuten Ichiba Tag Search API](https://webservice.rakuten.co.jp/api/ichibatagsearch/)
165
166
 
166
167
  ### Rakuten Books APIs
167
168
 
@@ -8,3 +8,5 @@ require 'rakuten_web_service/ichiba/item'
8
8
  require 'rakuten_web_service/ichiba/genre'
9
9
  require 'rakuten_web_service/ichiba/ranking'
10
10
  require 'rakuten_web_service/ichiba/product'
11
+ require 'rakuten_web_service/ichiba/tag_group'
12
+ require 'rakuten_web_service/ichiba/tag'
@@ -34,7 +34,7 @@ module RakutenWebService
34
34
  :reviewCount, :reviewAverage,
35
35
  :pointRate, :pointRateStartTime, :pointRateEndTime,
36
36
  :shopName, :shopCode, :shopUrl, :shopAffiliateUrl,
37
- :genreId
37
+ :genreId, :tagIds
38
38
 
39
39
  def genre
40
40
  Genre.new(genre_id)
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rakuten_web_service/resource'
4
+
5
+ module RakutenWebService
6
+ module Ichiba
7
+ class Tag < Resource
8
+ attribute :tagId, :tagName, :parentTagId
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rakuten_web_service/resource'
4
+
5
+ module RakutenWebService
6
+ module Ichiba
7
+ class TagGroup < Resource
8
+ endpoint 'https://app.rakuten.co.jp/services/api/IchibaTag/Search/20140222'
9
+
10
+ set_parser do |response|
11
+ response['tagGroups'].map { |tag_group| TagGroup.new(tag_group) }
12
+ end
13
+
14
+ attribute :tagGroupName, :tagGroupId
15
+
16
+ def tags
17
+ get_attribute('tags').map do |tag|
18
+ Tag.new(
19
+ 'tagId' => tag['tagId'],
20
+ 'tagName' => tag['tagName'],
21
+ 'parentTagId' => tag['parentTagId']
22
+ )
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RakutenWebService
4
- VERSION = '1.11.0'.freeze
4
+ VERSION = '1.12.0'.freeze
5
5
  end
@@ -0,0 +1,15 @@
1
+ {
2
+ "tagGroups": [
3
+ {
4
+ "tags": [
5
+ {
6
+ "parentTagId": 0,
7
+ "tagName": "SS",
8
+ "tagId": 1000317
9
+ }
10
+ ],
11
+ "tagGroupId": 1000041,
12
+ "tagGroupName": "サイズ(S/M/L)"
13
+ }
14
+ ]
15
+ }
@@ -14,6 +14,9 @@ describe 'Call all APIs', type: 'integration' do
14
14
  it do
15
15
  expect { RWS::Ichiba::RankingItem.search(age: 30, sex: 0).first }.not_to raise_error
16
16
  end
17
+ it do
18
+ expect { RWS::Ichiba::TagGroup.search(tagId: 1000317).first.tags }.not_to raise_error
19
+ end
17
20
  end
18
21
 
19
22
  describe RakutenWebService::Books do
@@ -75,4 +78,4 @@ describe 'Call all APIs', type: 'integration' do
75
78
  expect { RWS::Gora::Plan.search(playDate: '2017-01-11', areaCode: 0).first }.not_to raise_error
76
79
  end
77
80
  end
78
- end
81
+ end
@@ -0,0 +1,68 @@
1
+ require 'spec_helper'
2
+ require 'rakuten_web_service/ichiba/tag_group'
3
+
4
+ describe RakutenWebService::Ichiba::TagGroup do
5
+ let(:endpoint) { 'https://app.rakuten.co.jp/services/api/IchibaTag/Search/20140222' }
6
+ let(:affiliate_id) { 'affiliate_id' }
7
+ let(:application_id) { 'application_id' }
8
+ let(:expected_query) do
9
+ {
10
+ affiliateId: affiliate_id,
11
+ applicationId: application_id,
12
+ formatVersion: '2',
13
+ tagId: '1000317'
14
+ }
15
+ end
16
+
17
+ before do
18
+ response = JSON.parse(fixture('ichiba/tag_search.json'))
19
+ @expected_request = stub_request(:get, endpoint).
20
+ with(query: expected_query).to_return(body: response.to_json)
21
+
22
+ RakutenWebService.configure do |c|
23
+ c.affiliate_id = affiliate_id
24
+ c.application_id = application_id
25
+ end
26
+ end
27
+
28
+ describe '.search' do
29
+ let(:expected_json) do
30
+ response = JSON.parse(fixture('ichiba/tag_search.json'))
31
+ response['tagGroups'][0]
32
+ end
33
+
34
+ before do
35
+ @tag_group = RakutenWebService::Ichiba::TagGroup.search({tagId: '1000317'}).first
36
+ end
37
+
38
+ subject { @tag_group }
39
+
40
+ specify 'should call the endpoint once' do
41
+ expect(@expected_request).to have_been_made.once
42
+ end
43
+
44
+ specify 'should be access by key' do
45
+ expect(subject['tagGroupId']).to eq(expected_json['tagGroupId'])
46
+ expect(subject['tag_group_id']).to eq(expected_json['tagGroupId'])
47
+ end
48
+ end
49
+
50
+ describe '#tags' do
51
+ let(:response) { JSON.parse(fixture('ichiba/tag_search.json')) }
52
+ let(:expected_tag) { response['tagGroups'][0]['tags'][0] }
53
+
54
+ before do
55
+ @tag_group = RakutenWebService::Ichiba::TagGroup.search(tagId: '1000317').first
56
+ end
57
+
58
+ subject { @tag_group.tags }
59
+
60
+ specify 'responds Tags object' do
61
+ subject.map do |tag|
62
+ expect(tag.id).to eq(expected_tag['tagId'])
63
+ expect(tag.name).to eq(expected_tag['tagName'])
64
+ expect(tag['parentTagId']).to eq(expected_tag['parentTagId'])
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe RakutenWebService::Ichiba::Tag do
4
+ let(:params) do
5
+ { 'tagId' => 100,
6
+ 'tagName' => 'SS',
7
+ 'parentTagId' => 1 }
8
+ end
9
+ let(:tag) { RakutenWebService::Ichiba::Tag.new(params) }
10
+
11
+ describe '.new' do
12
+ specify 'returned object should have methods to fetch values' do
13
+ expect(tag.id).to eq(100)
14
+ expect(tag.name).to eq('SS')
15
+ expect(tag['parentTagId']).to eq(1)
16
+ end
17
+ end
18
+ 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.11.0
4
+ version: 1.12.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: 2019-07-11 00:00:00.000000000 Z
11
+ date: 2019-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -148,6 +148,8 @@ files:
148
148
  - lib/rakuten_web_service/ichiba/product.rb
149
149
  - lib/rakuten_web_service/ichiba/ranking.rb
150
150
  - lib/rakuten_web_service/ichiba/shop.rb
151
+ - lib/rakuten_web_service/ichiba/tag.rb
152
+ - lib/rakuten_web_service/ichiba/tag_group.rb
151
153
  - lib/rakuten_web_service/kobo.rb
152
154
  - lib/rakuten_web_service/kobo/ebook.rb
153
155
  - lib/rakuten_web_service/kobo/genre.rb
@@ -182,6 +184,7 @@ files:
182
184
  - spec/fixtures/ichiba/parents_genre_search.json
183
185
  - spec/fixtures/ichiba/product_search.json
184
186
  - spec/fixtures/ichiba/ranking_search.json
187
+ - spec/fixtures/ichiba/tag_search.json
185
188
  - spec/fixtures/kobo/ebook_search_with_Ruby.json
186
189
  - spec/fixtures/kobo/genre_search.json
187
190
  - spec/fixtures/recipe/category.json
@@ -210,6 +213,8 @@ files:
210
213
  - spec/rakuten_web_service/ichiba/product_search_spec.rb
211
214
  - spec/rakuten_web_service/ichiba/ranking_spec.rb
212
215
  - spec/rakuten_web_service/ichiba/shop_spec.rb
216
+ - spec/rakuten_web_service/ichiba/tag_group_spec.rb
217
+ - spec/rakuten_web_service/ichiba/tag_spec.rb
213
218
  - spec/rakuten_web_service/kobo/ebook_spec.rb
214
219
  - spec/rakuten_web_service/kobo/genre_spec.rb
215
220
  - spec/rakuten_web_service/recipe/category_spec.rb
@@ -242,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
247
  - !ruby/object:Gem::Version
243
248
  version: '0'
244
249
  requirements: []
245
- rubygems_version: 3.0.3
250
+ rubygems_version: 3.0.4
246
251
  signing_key:
247
252
  specification_version: 4
248
253
  summary: Ruby Client for Rakuten Web Service
@@ -264,6 +269,7 @@ test_files:
264
269
  - spec/fixtures/ichiba/parents_genre_search.json
265
270
  - spec/fixtures/ichiba/product_search.json
266
271
  - spec/fixtures/ichiba/ranking_search.json
272
+ - spec/fixtures/ichiba/tag_search.json
267
273
  - spec/fixtures/kobo/ebook_search_with_Ruby.json
268
274
  - spec/fixtures/kobo/genre_search.json
269
275
  - spec/fixtures/recipe/category.json
@@ -292,6 +298,8 @@ test_files:
292
298
  - spec/rakuten_web_service/ichiba/product_search_spec.rb
293
299
  - spec/rakuten_web_service/ichiba/ranking_spec.rb
294
300
  - spec/rakuten_web_service/ichiba/shop_spec.rb
301
+ - spec/rakuten_web_service/ichiba/tag_group_spec.rb
302
+ - spec/rakuten_web_service/ichiba/tag_spec.rb
295
303
  - spec/rakuten_web_service/kobo/ebook_spec.rb
296
304
  - spec/rakuten_web_service/kobo/genre_spec.rb
297
305
  - spec/rakuten_web_service/recipe/category_spec.rb