rakuten_web_service 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.en.md +10 -3
- data/README.md +10 -3
- data/lib/rakuten_web_service/genre.rb +2 -2
- data/lib/rakuten_web_service/version.rb +1 -1
- data/rakuten_web_service.gemspec +1 -1
- data/spec/rakuten_web_service/books/genre_spec.rb +2 -2
- data/spec/rakuten_web_service/kobo/genre_spec.rb +2 -2
- metadata +7 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47b5569e0735b1e86b81ece9379494ba24dcbed1
|
4
|
+
data.tar.gz: 959707be796c57c8790ce6b37b251eb9955e8593
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fce2a1c0dea879426d99faa85bbe421f1b258ce4dbf150df22b859719d17aed5a17e52e9d7d6355c11a1665501517b4d6a0a1af2a795251783b3c487d150010
|
7
|
+
data.tar.gz: f89784d970a60b00caa9411970d43fa5598318dc87a577d75ac71bae077b0063e82b97029e994f033046c61f03c487d39392b44081bbbe0e3398fe2c317b3fd1
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
# v0.6.3
|
2
|
+
|
3
|
+
* Update a gem dependency by @45deg
|
4
|
+
* Fix typo by @45deg
|
5
|
+
* Add new section for `Prerequisites` to explaing how to get new Application ID for Rakuten Web Service.
|
6
|
+
* `RakutenWebService::BaseGenre.[]` fetches the genre information of specified a given genrecode.
|
data/README.en.md
CHANGED
@@ -49,21 +49,28 @@ Now rakuten\_web\_service is supporting the following APIs:
|
|
49
49
|
|
50
50
|
## Usage
|
51
51
|
|
52
|
+
### Prerequisite: Getting Application ID
|
53
|
+
|
54
|
+
You need to get Application ID for your application to access to Rakuten Web Service APIs.
|
55
|
+
If you have not got it, register your appplication [here](https://webservice.rakuten.co.jp/app/create).
|
56
|
+
|
52
57
|
### Configuration
|
53
58
|
|
54
59
|
`RakutenWebService.configuration` allows you to specify your application's key called application\_id and your affiliate id(optional).
|
55
60
|
|
56
61
|
```ruby
|
57
62
|
RakutenWebService.configuration do |c|
|
58
|
-
c.application_id = YOUR_APPLICATION_ID
|
59
|
-
c.affiliate_id = YOUR_AFFILIATE_ID
|
63
|
+
c.application_id = 'YOUR_APPLICATION_ID'
|
64
|
+
c.affiliate_id = 'YOUR_AFFILIATE_ID'
|
60
65
|
end
|
61
66
|
```
|
62
67
|
|
68
|
+
Please note that you neet to replace `'YOUR_APPLICATION_ID'` and `'YOUR_AFFILIATE_ID'` with actual ones you have.
|
69
|
+
|
63
70
|
### Search Ichiba Items
|
64
71
|
|
65
72
|
```ruby
|
66
|
-
items = RakutenWebService::Ichiba::Item.search(:keyword => 'Ruby') # This returns
|
73
|
+
items = RakutenWebService::Ichiba::Item.search(:keyword => 'Ruby') # This returns Enumerable object
|
67
74
|
items.first(10).each do |item|
|
68
75
|
puts "#{item['itemName']}, #{item.price} yen" # You can refer to values as well as Hash.
|
69
76
|
end
|
data/README.md
CHANGED
@@ -53,21 +53,28 @@ bundlerを利用したアプリケーションの場合、Gemfileに以下の1
|
|
53
53
|
|
54
54
|
## 使用方法
|
55
55
|
|
56
|
+
### 事前準備: アプリケーションIDの取得
|
57
|
+
|
58
|
+
楽天ウェブサービスAPIを利用の際に、アプリケーションIDが必要です。
|
59
|
+
まだ取得していない場合は、楽天ウェブサービスAPIの[アプリケーション登録](https://webservice.rakuten.co.jp/app/create)を行い、アプリケーションIDを取得してください。
|
60
|
+
|
56
61
|
### 設定
|
57
62
|
|
58
63
|
`RakutenWebService.configuration` メソッドを使い、Application IDとAffiliate ID(オプション)を指定することができます。
|
59
64
|
|
60
65
|
```ruby
|
61
66
|
RakutenWebService.configuration do |c|
|
62
|
-
c.application_id = YOUR_APPLICATION_ID
|
63
|
-
c.affiliate_id = YOUR_AFFILIATE_ID
|
67
|
+
c.application_id = 'YOUR_APPLICATION_ID'
|
68
|
+
c.affiliate_id = 'YOUR_AFFILIATE_ID'
|
64
69
|
end
|
65
70
|
```
|
66
71
|
|
72
|
+
`'YOUR_APPLICATION_ID'` と `'YOUR_AFFILIATE_ID'` は、実際のアプリケーションIDとアフィリエイトIDに置き換えてください。
|
73
|
+
|
67
74
|
### 市場商品の検索
|
68
75
|
|
69
76
|
```ruby
|
70
|
-
items = RakutenWebService::Ichiba::Item.search(:keyword => 'Ruby') # This returns
|
77
|
+
items = RakutenWebService::Ichiba::Item.search(:keyword => 'Ruby') # This returns Enumerable object
|
71
78
|
items.first(10).each do |item|
|
72
79
|
puts "#{item['itemName']}, #{item.price} yen" # You can refer to values as well as Hash.
|
73
80
|
end
|
@@ -22,7 +22,7 @@ module RakutenWebService
|
|
22
22
|
def self.new(params)
|
23
23
|
case params
|
24
24
|
when Integer, String
|
25
|
-
|
25
|
+
repository[params.to_s] || search(genre_id_key => params.to_s).first
|
26
26
|
when Hash
|
27
27
|
super
|
28
28
|
end
|
@@ -41,7 +41,7 @@ module RakutenWebService
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.[](id)
|
44
|
-
repository[id.to_s]
|
44
|
+
repository[id.to_s] || new(id)
|
45
45
|
end
|
46
46
|
|
47
47
|
def self.[]=(id, genre)
|
data/rakuten_web_service.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
spec.required_ruby_version = '> 1.9.2'
|
21
21
|
|
22
|
-
spec.add_dependency 'faraday', '
|
22
|
+
spec.add_dependency 'faraday', '~> 0.9.0'
|
23
23
|
spec.add_dependency 'faraday_middleware'
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
@@ -24,7 +24,7 @@ describe RWS::Books::Genre do
|
|
24
24
|
before do
|
25
25
|
@expected_request = stub_request(:get, endpoint).
|
26
26
|
with(:query => expected_query).
|
27
|
-
to_return(:body => expected_json)
|
27
|
+
to_return(:body => expected_json.to_json)
|
28
28
|
|
29
29
|
RakutenWebService.configuration do |c|
|
30
30
|
c.affiliate_id = affiliate_id
|
@@ -63,7 +63,7 @@ describe RWS::Books::Genre do
|
|
63
63
|
:booksGenreName => 'DummyGenre',
|
64
64
|
:genreLevel => '2'
|
65
65
|
}
|
66
|
-
}
|
66
|
+
}
|
67
67
|
end
|
68
68
|
|
69
69
|
before do
|
@@ -20,7 +20,7 @@ describe RWS::Kobo::Genre do
|
|
20
20
|
before do
|
21
21
|
@expected_request = stub_request(:get, endpoint).
|
22
22
|
with(:query => expected_query).
|
23
|
-
to_return(:body => expected_json)
|
23
|
+
to_return(:body => expected_json.to_json)
|
24
24
|
|
25
25
|
RakutenWebService.configuration do |c|
|
26
26
|
c.affiliate_id = affiliate_id
|
@@ -41,7 +41,7 @@ describe RWS::Kobo::Genre do
|
|
41
41
|
describe '#search' do
|
42
42
|
before do
|
43
43
|
stub_request(:get, endpoint).with(:query => expected_query).
|
44
|
-
to_return(:body => expected_json)
|
44
|
+
to_return(:body => expected_json.to_json)
|
45
45
|
end
|
46
46
|
|
47
47
|
context 'Without arguments' do
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rakuten_web_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tatsuya Sato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.8.8
|
20
|
-
- - <
|
17
|
+
- - ~>
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
19
|
+
version: 0.9.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 0.8.8
|
30
|
-
- - <
|
24
|
+
- - ~>
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
26
|
+
version: 0.9.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: faraday_middleware
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +117,7 @@ extra_rdoc_files: []
|
|
123
117
|
files:
|
124
118
|
- .gitignore
|
125
119
|
- .travis.yml
|
120
|
+
- CHANGELOG.md
|
126
121
|
- Gemfile
|
127
122
|
- LICENSE.txt
|
128
123
|
- README.en.md
|