rakuten_web_service 0.6.3 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.travis.yml +19 -3
- data/CHANGELOG.md +14 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +5 -0
- data/README.ja.md +133 -0
- data/README.md +129 -48
- data/examples/books_item_search.rb +24 -0
- data/examples/gora_search.rb +48 -0
- data/examples/ichiba_item_search.rb +1 -3
- data/lib/rakuten_web_service.rb +2 -0
- data/lib/rakuten_web_service/all_proxy.rb +20 -0
- data/lib/rakuten_web_service/client.rb +6 -13
- data/lib/rakuten_web_service/configuration.rb +28 -4
- data/lib/rakuten_web_service/gora.rb +3 -0
- data/lib/rakuten_web_service/gora/course.rb +17 -0
- data/lib/rakuten_web_service/gora/course_detail.rb +55 -0
- data/lib/rakuten_web_service/gora/plan.rb +47 -0
- data/lib/rakuten_web_service/ichiba/item.rb +5 -4
- data/lib/rakuten_web_service/ichiba/shop.rb +1 -1
- data/lib/rakuten_web_service/kobo/ebook.rb +2 -2
- data/lib/rakuten_web_service/recipe.rb +28 -0
- data/lib/rakuten_web_service/recipe/category.rb +60 -0
- data/lib/rakuten_web_service/resource.rb +9 -1
- data/lib/rakuten_web_service/search_result.rb +43 -19
- data/lib/rakuten_web_service/version.rb +1 -1
- data/rakuten_web_service.gemspec +2 -2
- data/spec/fixtures/gora/course_detail_search.json +1 -0
- data/spec/fixtures/gora/course_search_with_Karuizawa.json +1 -0
- data/spec/fixtures/gora/plan_search_with_area_code.json +1 -0
- data/spec/fixtures/recipe/category.json +1 -0
- data/spec/fixtures/recipe/ranking.json +1 -0
- data/spec/rakuten_web_service/books/book_spec.rb +1 -2
- data/spec/rakuten_web_service/books/cd_spec.rb +1 -2
- data/spec/rakuten_web_service/books/dvd_spec.rb +1 -2
- data/spec/rakuten_web_service/books/foreign_book_spec.rb +1 -2
- data/spec/rakuten_web_service/books/game_spec.rb +1 -2
- data/spec/rakuten_web_service/books/genre_spec.rb +1 -2
- data/spec/rakuten_web_service/books/magazine_spec.rb +1 -2
- data/spec/rakuten_web_service/books/software_spec.rb +1 -2
- data/spec/rakuten_web_service/books/total_spec.rb +1 -2
- data/spec/rakuten_web_service/client_spec.rb +3 -3
- data/spec/rakuten_web_service/configuration_spec.rb +45 -4
- data/spec/rakuten_web_service/gora/course_detail_spec.rb +60 -0
- data/spec/rakuten_web_service/gora/course_spec.rb +108 -0
- data/spec/rakuten_web_service/gora/plan_spec.rb +62 -0
- data/spec/rakuten_web_service/ichiba/genre_spec.rb +1 -2
- data/spec/rakuten_web_service/ichiba/item_spec.rb +53 -8
- data/spec/rakuten_web_service/ichiba/product_search_spec.rb +2 -3
- data/spec/rakuten_web_service/ichiba/ranking_spec.rb +1 -1
- data/spec/rakuten_web_service/ichiba/shop_spec.rb +2 -3
- data/spec/rakuten_web_service/kobo/ebook_spec.rb +2 -3
- data/spec/rakuten_web_service/kobo/genre_spec.rb +1 -2
- data/spec/rakuten_web_service/recipe/category_spec.rb +185 -0
- data/spec/rakuten_web_service/recipe_spec.rb +50 -0
- data/spec/spec_helper.rb +16 -6
- metadata +42 -11
- data/README.en.md +0 -108
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b44c66119bf5c9b8fa5dc6b6de6ffac8ca51530d
|
4
|
+
data.tar.gz: 32c3815fb9e4e4d2304df63142cbb7dfa0bef592
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ecd020582c74f06fdadb1ce977248998f5aaba06f2db8fe94c93412bdbf8de0a7c7a8867bf8470d602923684c36943d6f351a0fced044baced6f02df342ada6
|
7
|
+
data.tar.gz: 81cc1e9e67ad04c7116f817b882d7718046ad7c4a49dbb096c89855804f4f43570d13b9924f3cc3be83f65cd1f4e120508b46216060c297ddb892d18b91ab10d
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.travis.yml
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
language: ruby
|
2
|
+
|
2
3
|
rvm:
|
3
|
-
- 1.
|
4
|
-
- 2.
|
5
|
-
- 2.1
|
4
|
+
- 2.1.10
|
5
|
+
- 2.2.5
|
6
|
+
- 2.3.1
|
7
|
+
- ruby-head
|
8
|
+
|
9
|
+
cache: bundler
|
10
|
+
|
11
|
+
before_install:
|
12
|
+
- gem install bundler
|
13
|
+
|
14
|
+
matrix:
|
15
|
+
allow_failures:
|
16
|
+
- rvm: ruby-head
|
17
|
+
|
18
|
+
addons:
|
19
|
+
code_climate:
|
20
|
+
repo_token:
|
21
|
+
secure: Z23O936LoCDGJ/OyYsLzxTUI+CMWyrfeN1PtQdCNMdF4vxwaCsAHr3ulTdudGhKMrVZGENSEK6fq0Xal3o3oPaH9aGM9sUQ/ibRM+J94Lx6Owu4okTsIHoEy4vFeW+A/62aiwxPcoi7PFrvC8FOfaZg+b+vvYAQcitVe6qwBHiE=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# v1.0.0.rc1
|
2
|
+
|
3
|
+
## Enhancements
|
4
|
+
|
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.
|
8
|
+
|
9
|
+
## Compatibility Changes
|
10
|
+
|
11
|
+
* Supported Ruby versions are 2.1.0 or later
|
12
|
+
* Any resource's `search` such as `RakutenWebService::Ichiba::Item` returns Enumerator which provides resources fetched at one page.
|
13
|
+
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).
|
14
|
+
|
1
15
|
# v0.6.3
|
2
16
|
|
3
17
|
* Update a gem dependency by @45deg
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
CHANGED
data/README.ja.md
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
# RakutenWebService
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/rakuten-ws/rws-ruby-sdk.png?branch=master)](https://travis-ci.org/rakuten-ws/rws-ruby-sdk)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/rakuten_web_service.png)](http://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)
|
6
|
+
|
7
|
+
rakuten\_web\_serviceは、 Rubyから楽天が提供しているAPIに簡単にアクセスできるSDK(Software Development Kit)です。
|
8
|
+
|
9
|
+
English version is [here](http://github.com/rakuten-ws/rws-ruby-sdk/blob/master/README.en.md).
|
10
|
+
|
11
|
+
## インストール方法
|
12
|
+
|
13
|
+
bundlerを利用したアプリケーションの場合、Gemfileに以下の1行を追加します。
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'rakuten_web_service'
|
17
|
+
```
|
18
|
+
|
19
|
+
そして`bundle`コマンドでインストール。
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
もしくは、`gem`コマンドにより
|
24
|
+
|
25
|
+
$ gem install rakuten_web_service
|
26
|
+
|
27
|
+
とすることでインストールできます。
|
28
|
+
|
29
|
+
現在rakuten\_web\_serviceは下記のAPIをサポートしています。
|
30
|
+
|
31
|
+
### 楽天市場API
|
32
|
+
|
33
|
+
* [Rakuten Ichiba Item Search API](http://webservice.rakuten.co.jp/api/ichibaitemsearch/)
|
34
|
+
* [Rakuten Ichiba Genre Search API](http://webservice.rakuten.co.jp/api/ichibagenresearch/)
|
35
|
+
* [Rakuten Ichiba Ranking API](http://webservice.rakuten.co.jp/api/ichibaitemranking/)
|
36
|
+
* [Rakuten Product API](http://webservice.rakuten.co.jp/api/productsearch/)
|
37
|
+
|
38
|
+
|
39
|
+
### 楽天ブックス系API
|
40
|
+
|
41
|
+
* [Rakuten Books Total Search API](http://webservice.rakuten.co.jp/api/bookstotalsearch/)
|
42
|
+
* [Rakuten Books Book Search API](http://webservice.rakuten.co.jp/api/booksbooksearch/)
|
43
|
+
* [Rakuten Books CD Search API](http://webservice.rakuten.co.jp/api/bookscdsearch/)
|
44
|
+
* [Rakuten Books DVD/Blu-ray Search API](http://webservice.rakuten.co.jp/api/booksdvdsearch/)
|
45
|
+
* [Rakuten Books ForeignBook Search API](http://webservice.rakuten.co.jp/api/booksforeignbooksearch/)
|
46
|
+
* [Rakuten Books Magazine Search API](http://webservice.rakuten.co.jp/api/booksmagazinesearch/)
|
47
|
+
* [Rakuten Books Game Search API](http://webservice.rakuten.co.jp/api/booksgamesearch/)
|
48
|
+
* [Rakuten Books Software Search API](http://webservice.rakuten.co.jp/api/bookssoftwaresearch/)
|
49
|
+
* [Rakuten Books Genre Search API](http://webservice.rakuten.co.jp/api/booksgenresearch/)
|
50
|
+
|
51
|
+
### 楽天Kobo系API
|
52
|
+
|
53
|
+
* [楽天Kobo電子書籍検索API](http://webservice.rakuten.co.jp/api/koboebooksearch/)
|
54
|
+
* [楽天Koboジャンル検索API](http://webservice.rakuten.co.jp/api/kobogenresearch/)
|
55
|
+
|
56
|
+
### 楽天レシピ系API
|
57
|
+
|
58
|
+
* [楽天レシピカテゴリ一覧API](https://webservice.rakuten.co.jp/api/recipecategorylist/)
|
59
|
+
* [楽天レシピカテゴリ別ランキングAPI](https://webservice.rakuten.co.jp/api/recipecategoryranking/)
|
60
|
+
|
61
|
+
### 楽天GORA系API
|
62
|
+
|
63
|
+
* [楽天GORAゴルフ場検索API](https://webservice.rakuten.co.jp/api/goragolfcoursesearch/)
|
64
|
+
* [楽天GORAゴルフ場詳細API](https://webservice.rakuten.co.jp/api/goragolfcoursedetail/)
|
65
|
+
* [楽天GORAプラン検索API](https://webservice.rakuten.co.jp/api/goraplansearch/)
|
66
|
+
|
67
|
+
## 使用方法
|
68
|
+
|
69
|
+
### 事前準備: アプリケーションIDの取得
|
70
|
+
|
71
|
+
楽天ウェブサービスAPIを利用の際に、アプリケーションIDが必要です。
|
72
|
+
まだ取得していない場合は、楽天ウェブサービスAPIの[アプリケーション登録](https://webservice.rakuten.co.jp/app/create)を行い、アプリケーションIDを取得してください。
|
73
|
+
|
74
|
+
### 設定
|
75
|
+
|
76
|
+
`RakutenWebService.configuration` メソッドを使い、Application IDとAffiliate ID(オプション)を指定することができます。
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
RakutenWebService.configuration do |c|
|
80
|
+
c.application_id = 'YOUR_APPLICATION_ID'
|
81
|
+
c.affiliate_id = 'YOUR_AFFILIATE_ID'
|
82
|
+
end
|
83
|
+
```
|
84
|
+
|
85
|
+
`'YOUR_APPLICATION_ID'` と `'YOUR_AFFILIATE_ID'` は、実際のアプリケーションIDとアフィリエイトIDに置き換えてください。
|
86
|
+
|
87
|
+
### 市場商品の検索
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
items = RakutenWebService::Ichiba::Item.search(:keyword => 'Ruby') # This returns Enumerable object
|
91
|
+
items.first(10).each do |item|
|
92
|
+
puts "#{item['itemName']}, #{item.price} yen" # You can refer to values as well as Hash.
|
93
|
+
end
|
94
|
+
```
|
95
|
+
|
96
|
+
### ジャンル
|
97
|
+
|
98
|
+
Genreクラスは、`children`や`parent`といったジャンル階層を辿るインターフェースを持っています。
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
root = RakutenWebService::Ichiba::Genre.root # root genre
|
102
|
+
# children returns sub genres
|
103
|
+
root.children.each do |child|
|
104
|
+
puts "[#{child.id}] #{child.name}"
|
105
|
+
end
|
106
|
+
|
107
|
+
# Use genre id to fetch genre object
|
108
|
+
RakutenWebService::Ichiba::Genre[100316].name # => "水・ソフトドリンク"
|
109
|
+
```
|
110
|
+
|
111
|
+
|
112
|
+
### 市場商品ランキング
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
ranking_by_age = RakutenWebService::Ichiba::Item.ranking(:age => 30, :sex => 1) # 30代男性 のランキングTOP 30
|
116
|
+
ranking_by_age.each do |ranking|
|
117
|
+
# 'itemName'以外の属性については右記を参照 http://webservice.rakuten.co.jp/api/ichibaitemsearch/#outputParameter
|
118
|
+
puts ranking['itemName']
|
119
|
+
end
|
120
|
+
|
121
|
+
ranking_by_genre = RakutenWebService::Ichiba::Genre[200162].ranking # "水・ソフトドリンク" ジャンルのTOP 30
|
122
|
+
ranking_by_genre.each do |ranking|
|
123
|
+
puts ranking['itemName']
|
124
|
+
end
|
125
|
+
```
|
126
|
+
|
127
|
+
## Contributing
|
128
|
+
|
129
|
+
1. Fork it
|
130
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
131
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
132
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
133
|
+
5. Create new Pull Request
|
data/README.md
CHANGED
@@ -1,88 +1,122 @@
|
|
1
1
|
# RakutenWebService
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/rakuten-ws/rws-ruby-sdk.png?branch=master)](https://travis-ci.org/rakuten-ws/rws-ruby-sdk)
|
3
|
+
[![Build Status](https://travis-ci.org/rakuten-ws/rws-ruby-sdk.png?branch=master)](https://travis-ci.org/rakuten-ws/rws-ruby-sdk)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/rakuten_web_service.png)](http://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)
|
4
6
|
|
5
|
-
|
7
|
+
This gem provides a client for easily accessing [Rakuten Web Service APIs](https://webservice.rakuten.co.jp/).
|
6
8
|
|
7
|
-
|
9
|
+
# Table of Contents
|
8
10
|
|
9
|
-
|
11
|
+
* [Prerequisite](#prerequisite)
|
12
|
+
* [Installation](#installation)
|
13
|
+
* [Usage](#usage)
|
14
|
+
* [Prerequisite: Getting Application ID](#prerequisite-getting-application-id)
|
15
|
+
* [Configuration](#configuration)
|
16
|
+
* [Search Ichiba Items](#search-ichiba-items)
|
17
|
+
* [Pagerizing](#pagerizing)
|
18
|
+
* [Genre](#genre)
|
19
|
+
* [Ichiba Item Ranking](#ichiba-item-ranking)
|
20
|
+
* [Supported APIs](#supported-apis)
|
21
|
+
* [Rakuten Ichiba APIs](#rakuten-ichiba-apis)
|
22
|
+
* [Rakuten Books APIs](#rakuten-books-apis)
|
23
|
+
* [Rakuten Kobo APIs](#rakuten-kobo-apis)
|
24
|
+
* [Rakuten Recipe APIs](#rakuten-recipe-apis)
|
25
|
+
* [Rakuten GORA APIs](#rakuten-gora-apis)
|
26
|
+
* [Contributing](#contributing)
|
10
27
|
|
11
|
-
|
28
|
+
|
29
|
+
## Prerequisite
|
30
|
+
|
31
|
+
* Ruby 2.1.0 or later
|
32
|
+
|
33
|
+
## Installation
|
34
|
+
|
35
|
+
Add this line to your application's Gemfile:
|
12
36
|
|
13
37
|
```ruby
|
14
38
|
gem 'rakuten_web_service'
|
15
39
|
```
|
16
40
|
|
17
|
-
|
41
|
+
And then execute:
|
18
42
|
|
19
43
|
$ bundle
|
20
44
|
|
21
|
-
|
45
|
+
Or install it yourself as:
|
22
46
|
|
23
47
|
$ gem install rakuten_web_service
|
24
48
|
|
25
|
-
とすることでインストールできます。
|
26
49
|
|
27
|
-
|
50
|
+
## Usage
|
28
51
|
|
29
|
-
###
|
52
|
+
### Prerequisite: Getting Application ID
|
30
53
|
|
31
|
-
|
32
|
-
|
33
|
-
* [Rakuten Ichiba Ranking API](http://webservice.rakuten.co.jp/api/ichibaitemranking/)
|
34
|
-
* [Rakuten Product API](http://webservice.rakuten.co.jp/api/productsearch/)
|
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 application [here](https://webservice.rakuten.co.jp/app/create).
|
35
56
|
|
57
|
+
### Configuration
|
36
58
|
|
37
|
-
|
59
|
+
At first, you have to specify your application's key. And you can tell the client your afiiliate id with `RakutenWebService.configuration`.
|
38
60
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
* [Rakuten Books ForeignBook Search API](http://webservice.rakuten.co.jp/api/booksforeignbooksearch/)
|
44
|
-
* [Rakuten Books Magazine Search API](http://webservice.rakuten.co.jp/api/booksmagazinesearch/)
|
45
|
-
* [Rakuten Books Game Search API](http://webservice.rakuten.co.jp/api/booksgamesearch/)
|
46
|
-
* [Rakuten Books Software Search API](http://webservice.rakuten.co.jp/api/bookssoftwaresearch/)
|
47
|
-
* [Rakuten Books Genre Search API](http://webservice.rakuten.co.jp/api/booksgenresearch/)
|
48
|
-
|
49
|
-
### 楽天Kobo系API
|
50
|
-
|
51
|
-
* [楽天Kobo電子書籍検索API](http://webservice.rakuten.co.jp/api/koboebooksearch/)
|
52
|
-
* [楽天Koboジャンル検索API](http://webservice.rakuten.co.jp/api/kobogenresearch/)
|
61
|
+
```ruby
|
62
|
+
RakutenWebService.configuration do |c|
|
63
|
+
# (Required) Appliction ID for your application.
|
64
|
+
c.application_id = 'YOUR_APPLICATION_ID'
|
53
65
|
|
54
|
-
|
66
|
+
# (Optional) Affiliate ID for your Rakuten account.
|
67
|
+
c.affiliate_id = 'YOUR_AFFILIATE_ID' # default: nil
|
55
68
|
|
56
|
-
|
69
|
+
# (Optional) # of retries to send requests when the client receives
|
70
|
+
# When the number of requests in some period overcomes the limit, the endpoints will return
|
71
|
+
# too many requests error. Then the client tries to retry to send the same request after a
|
72
|
+
# while.
|
73
|
+
c.max_retries = 3 # default: 5
|
57
74
|
|
58
|
-
|
59
|
-
|
75
|
+
# (Optional) Enable debug mode. When set true, the client streams out all HTTP requests and
|
76
|
+
# responses to the standard error.
|
77
|
+
c.debug = true # default: false
|
78
|
+
end
|
79
|
+
```
|
60
80
|
|
61
|
-
|
81
|
+
Please note that you need to replace `'YOUR_APPLICATION_ID'` and `'YOUR_AFFILIATE_ID'` with actual ones you have.
|
62
82
|
|
63
|
-
|
83
|
+
### Search Ichiba Items
|
64
84
|
|
65
85
|
```ruby
|
66
|
-
RakutenWebService.
|
67
|
-
|
68
|
-
|
86
|
+
items = RakutenWebService::Ichiba::Item.search(:keyword => 'Ruby') # This returns Enumerable object
|
87
|
+
items.first(10).each do |item|
|
88
|
+
puts "#{item['itemName']}, #{item.price} yen" # You can refer to values as well as Hash.
|
69
89
|
end
|
70
90
|
```
|
71
91
|
|
72
|
-
|
92
|
+
### Pagerizing
|
73
93
|
|
74
|
-
|
94
|
+
Responses of resources' `search` such as `RakutenWebService::Ichiba::Item.search` have methods for paginating fetched resources.
|
75
95
|
|
76
96
|
```ruby
|
77
|
-
items = RakutenWebService::Ichiba::Item.search(:
|
78
|
-
items.
|
79
|
-
|
97
|
+
items = RakutenWebService::Ichiba::Item.search(keyword: 'Ruby')
|
98
|
+
items.count #=> 30. In default, the API returns up to 30 items matched with given keywords.
|
99
|
+
|
100
|
+
last_items = items.page(3) # Skips first 2 pages.
|
101
|
+
|
102
|
+
# Go to the last page
|
103
|
+
while last_items.has_next_page?
|
104
|
+
last_items = last_items.next_page
|
105
|
+
end
|
106
|
+
|
107
|
+
# Shows the title of the last 30 items
|
108
|
+
last_items.each do |item|
|
109
|
+
puts item.name
|
110
|
+
end
|
111
|
+
|
112
|
+
items.all do |item|
|
113
|
+
puts item.name
|
80
114
|
end
|
81
115
|
```
|
82
116
|
|
83
|
-
###
|
117
|
+
### Genre
|
84
118
|
|
85
|
-
Genre
|
119
|
+
Genre class provides an interface to traverse sub genres.
|
86
120
|
|
87
121
|
```ruby
|
88
122
|
root = RakutenWebService::Ichiba::Genre.root # root genre
|
@@ -96,13 +130,60 @@ Genreクラスは、`children`や`parent`といったジャンル階層を辿る
|
|
96
130
|
```
|
97
131
|
|
98
132
|
|
99
|
-
###
|
133
|
+
### Ichiba Item Ranking
|
100
134
|
|
101
135
|
```ruby
|
102
|
-
RakutenWebService::Ichiba::Item.ranking(:
|
103
|
-
|
136
|
+
ranking_by_age = RakutenWebService::Ichiba::Item.ranking(age: 30, sex: 1) # returns the TOP 30 items for Male in 30s
|
137
|
+
# For attributes other than 'itemName', see: http://webservice.rakuten.co.jp/api/ichibaitemsearch/#outputParameter
|
138
|
+
ranking_by_age.each do |ranking|
|
139
|
+
puts ranking['itemName']
|
140
|
+
end
|
141
|
+
|
142
|
+
ranking_by_genre = RakutenWebService::Ichiba::Genre[200162].ranking # the TOP 30 items in "水・ソフトドリンク" genre
|
143
|
+
ranking_by_genre.each do |ranking|
|
144
|
+
puts ranking['itemName']
|
145
|
+
end
|
104
146
|
```
|
105
147
|
|
148
|
+
## Supported APIs
|
149
|
+
|
150
|
+
Now rakuten\_web\_service is supporting the following APIs:
|
151
|
+
|
152
|
+
### Rakuten Ichiba APIs
|
153
|
+
|
154
|
+
* [Rakuten Ichiba Item Search API](http://webservice.rakuten.co.jp/api/ichibaitemsearch/)
|
155
|
+
* [Rakuten Ichiba Genre Search API](http://webservice.rakuten.co.jp/api/ichibagenresearch/)
|
156
|
+
* [Rakuten Ichiba Ranking API](http://webservice.rakuten.co.jp/api/ichibaitemranking/)
|
157
|
+
* [Rakuten Product API](http://webservice.rakuten.co.jp/api/productsearch/)
|
158
|
+
|
159
|
+
### Rakuten Books APIs
|
160
|
+
|
161
|
+
* [Rakuten Books Total Search API](http://webservice.rakuten.co.jp/api/bookstotalsearch/)
|
162
|
+
* [Rakuten Books Book Search API](http://webservice.rakuten.co.jp/api/booksbooksearch/)
|
163
|
+
* [Rakuten Books CD Search API](http://webservice.rakuten.co.jp/api/bookscdsearch/)
|
164
|
+
* [Rakuten Books DVD/Blu-ray Search API](http://webservice.rakuten.co.jp/api/booksdvdsearch/)
|
165
|
+
* [Rakuten Books ForeignBook Search API](http://webservice.rakuten.co.jp/api/booksforeignbooksearch/)
|
166
|
+
* [Rakuten Books Magazine Search API](http://webservice.rakuten.co.jp/api/booksmagazinesearch/)
|
167
|
+
* [Rakuten Books Game Search API](http://webservice.rakuten.co.jp/api/booksgamesearch/)
|
168
|
+
* [Rakuten Books Software Search API](http://webservice.rakuten.co.jp/api/bookssoftwaresearch/)
|
169
|
+
* [Rakuten Books Genre Search API](http://webservice.rakuten.co.jp/api/booksgenresearch/)
|
170
|
+
|
171
|
+
### Rakuten Kobo APIs
|
172
|
+
|
173
|
+
* [Rakuten Kobo Ebook Search API](http://webservice.rakuten.co.jp/api/koboebooksearch/)
|
174
|
+
* [Rakuten Kobo Genre Search API](http://webservice.rakuten.co.jp/api/kobogenresearch/)
|
175
|
+
|
176
|
+
### Rakuten Recipe APIs
|
177
|
+
|
178
|
+
* [Rakuten Recipe Category List API](https://webservice.rakuten.co.jp/api/recipecategorylist/)
|
179
|
+
* [Rakuten Recipe Category Ranking API](https://webservice.rakuten.co.jp/api/recipecategoryranking/)
|
180
|
+
|
181
|
+
### Rakuten GORA APIs
|
182
|
+
|
183
|
+
* [Rakuten GORA Golf Course Search API](https://webservice.rakuten.co.jp/api/goragolfcoursesearch/)
|
184
|
+
* [Rakuten GORA Golf Course Detail Search API](https://webservice.rakuten.co.jp/api/goragolfcoursedetail/)
|
185
|
+
* [Rakuten GORA Plan Search API](https://webservice.rakuten.co.jp/api/goraplansearch/)
|
186
|
+
|
106
187
|
## Contributing
|
107
188
|
|
108
189
|
1. Fork it
|