rakuten-api 0.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +96 -0
- data/Rakefile +1 -0
- data/example/auction.rb +26 -0
- data/example/bookmark.rb +15 -0
- data/example/books.rb +55 -0
- data/example/etc.rb +19 -0
- data/example/gora.rb +19 -0
- data/example/helper.rb +10 -0
- data/example/ichiba.rb +19 -0
- data/example/product.rb +19 -0
- data/example/recipe.rb +13 -0
- data/example/travel.rb +43 -0
- data/lib/rakuten/api.rb +43 -0
- data/lib/rakuten/api/auction.rb +40 -0
- data/lib/rakuten/api/bookmark.rb +34 -0
- data/lib/rakuten/api/books.rb +70 -0
- data/lib/rakuten/api/etc.rb +39 -0
- data/lib/rakuten/api/gora.rb +43 -0
- data/lib/rakuten/api/ichiba.rb +34 -0
- data/lib/rakuten/api/product.rb +43 -0
- data/lib/rakuten/api/recipe.rb +29 -0
- data/lib/rakuten/api/request.rb +12 -0
- data/lib/rakuten/api/response.rb +29 -0
- data/lib/rakuten/api/travel.rb +79 -0
- data/lib/rakuten/api/version.rb +5 -0
- data/rakuten-api.gemspec +26 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e809c4972052b855f3ae4ab121bde40af51d3389
|
4
|
+
data.tar.gz: 29dc5d316ce711d816a8de9d3073c07c372dfd87
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 532b424d6c15f75cbea06823aa6a53bdaa9ec9485db9e448ef1f6f0b3e7dd760e59fc6f5eaa58c827996793f6c9696eb3df80f76783cf28787d93db8b843f283
|
7
|
+
data.tar.gz: 3cd8620888d3944327da4efb851c36c50ed41c322d36e715718ab9d9249f7a843dc669386b5a6ac1a1d55c97f7d49f1d2e4958f1976fa0ee84b6603e6ba7d53d
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 shoprev
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# Rakuten::Api
|
2
|
+
|
3
|
+
Ruby Rakuten Web API fully supported
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'rakuten-api'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install rakuten-api
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require "rakuten/api"
|
23
|
+
|
24
|
+
# configure
|
25
|
+
Rakuten::Api.configure do |options|
|
26
|
+
options[:appid] = 'your api id'
|
27
|
+
options[:affiliate_id] = "your affiliate id"
|
28
|
+
end
|
29
|
+
|
30
|
+
# Item Search API v1
|
31
|
+
res = Rakuten::Api.get(Rakuten::Api::Ichiba::Search,{:genreId => "101240"})
|
32
|
+
res.code # 200
|
33
|
+
res.message # "OK"
|
34
|
+
res["Items"].each do |v|
|
35
|
+
name = v["Item"]["itemName"]
|
36
|
+
...
|
37
|
+
end
|
38
|
+
```
|
39
|
+
See the [examples directory](https://github.com/shoprev/rakuten-api/tree/master/example) for more usage.
|
40
|
+
```ruby
|
41
|
+
# Rakuten Ichiba API
|
42
|
+
Rakuten::Api::Ichiba::Search # Ichiba Item Search API (version:2013-08-05)
|
43
|
+
Rakuten::Api::Ichiba::GenreSearch # Ichiba Genre Search API (version:2012-07-23)
|
44
|
+
Rakuten::Api::Ichiba::Ranking # Ichiba Item Ranking API (version:2012-09-27)
|
45
|
+
# Rakuten Product API
|
46
|
+
Rakuten::Api::Product::Search # Product Search API (version:2010-11-18)
|
47
|
+
Rakuten::Api::Product::DetailSearch # Product Detail Search API (version:2011-07-14)
|
48
|
+
Rakuten::Api::Product::GenreSearch # Product Genre Search API (version:2010-11-18)
|
49
|
+
# Rakuten Books API
|
50
|
+
Rakuten::Api::Books::TotalSearch # Books Total Search API (version:2013-05-22)
|
51
|
+
Rakuten::Api::Books::BookSearch # Books Book Search API (version:2013-05-22)
|
52
|
+
Rakuten::Api::Books::CdSearch # Books CD Search API (version:2013-05-22)
|
53
|
+
Rakuten::Api::Books::DvdSearch # Books DVD Search API (version:2013-05-22)
|
54
|
+
Rakuten::Api::Books::ForeignBookSearch # Books Foreign Book Search API (version:2013-05-22)
|
55
|
+
Rakuten::Api::Books::MagazineSearch # Books Magazine Search API (version:2013-05-22)
|
56
|
+
Rakuten::Api::Books::GameSearch # Books Game Search API (version:2013-05-22)
|
57
|
+
Rakuten::Api::Books::SoftwareSearch # Books Software Search API (version:2013-05-22)
|
58
|
+
Rakuten::Api::Books::GenreSearch # Books Genre Search API (version:2012-11-28)
|
59
|
+
# Rakuten Auction API
|
60
|
+
Rakuten::Api::Auction::GenreSearch # Auction Genre Search API (version:2012-09-27)
|
61
|
+
Rakuten::Api::Auction::GenreKeywordSearch # Auction Genre Keyword Search API (version:2012-09-27)
|
62
|
+
Rakuten::Api::Auction::Search # Auction Item Search API (version:2013-01-10)
|
63
|
+
Rakuten::Api::Auction::CodeSearch # Auction Item Code Search API (version:2012-10-10)
|
64
|
+
# Rakuten Travel API
|
65
|
+
Rakuten::Api::Travel::Search # Travel Search API (version:2009-10-20)
|
66
|
+
Rakuten::Api::Travel::DetailSearch # Travel Detail Search API (version:2009-09-09)
|
67
|
+
Rakuten::Api::Travel::VacantSearch # Travel Vacant Search API (version:2009-10-20)
|
68
|
+
Rakuten::Api::Travel::AreaCode # Travel Area Code API (version:2009-03-26)
|
69
|
+
Rakuten::Api::Travel::KeywordSearch # Travel Keyword Search API (version:2009-10-20)
|
70
|
+
Rakuten::Api::Travel::ChainList # Travel Chain List API (version:2009-05-12)
|
71
|
+
Rakuten::Api::Travel::Ranking # Travel Ranking API (version:2009-06-25)
|
72
|
+
# Rakuten Bookmark API
|
73
|
+
Rakuten::Api::Bookmark::List # Favorite Bookmark List API (version:2012-06-27)
|
74
|
+
Rakuten::Api::Bookmark::Add # Favorite Bookmark Add API (version:2012-06-27)
|
75
|
+
Rakuten::Api::Bookmark::Delete # Favorite Bookmark Delete API (version:2012-06-27)
|
76
|
+
# Rakuten Recipe API
|
77
|
+
Rakuten::Api::Recipe::CategoryList # Recipe Category List API (version:2012-11-21)
|
78
|
+
Rakuten::Api::Recipe::CategoryRanking # Recipe Category Ranking API (version:2012-11-21)
|
79
|
+
# Rakuten GORA API
|
80
|
+
Rakuten::Api::Gora::Search # Gora Search API (version:2010-06-30)
|
81
|
+
Rakuten::Api::Gora::DetailSearch # Gora Detail Search API (version:2010-06-30)
|
82
|
+
Rakuten::Api::Gora::PlanSearch # Gora Plan Search API (version:2012-12-10)
|
83
|
+
# Rakuten Etc API
|
84
|
+
Rakuten::Api::Etc::DynamicAd # Dynamic Ad API
|
85
|
+
Rakuten::Api::Etc::DynamicAdTravel # Dynamic Ad Travel API
|
86
|
+
Rakuten::Api::Etc::HighCommissionShop # High Commission Shop API (version:2012-03-13)
|
87
|
+
```
|
88
|
+
Refer to [Rakuten Web API documentation](https://webservice.rakuten.co.jp/document/) for more infomation.
|
89
|
+
|
90
|
+
## Contributing
|
91
|
+
|
92
|
+
1. Fork it
|
93
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
94
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
95
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
96
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/example/auction.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
# Auction Genre Search API (version:2012-09-27)
|
4
|
+
res = Rakuten::Api.get(Rakuten::Api::Auction::GenreSearch,{:auctionGenreId => "0"})
|
5
|
+
res["children"].each do |v|
|
6
|
+
p v["child"]["genreName"]
|
7
|
+
end
|
8
|
+
|
9
|
+
# Auction Genre Keyword Search API (version:2012-09-27)
|
10
|
+
res = Rakuten::Api.get(Rakuten::Api::Auction::GenreKeywordSearch,{:keyword => "CD"})
|
11
|
+
res["auctionGenreList"].each do |v|
|
12
|
+
p v["fullGenrePath"]
|
13
|
+
end
|
14
|
+
|
15
|
+
# Auction Item Search API (version:2013-01-10)
|
16
|
+
res = Rakuten::Api.get(Rakuten::Api::Auction::Search,{:keyword => "CD"})
|
17
|
+
res["Items"].each do |v|
|
18
|
+
p v["Item"]["itemName"]
|
19
|
+
end
|
20
|
+
|
21
|
+
# Auction Item Code Search API (version:2012-10-10)
|
22
|
+
res = Rakuten::Api.get(Rakuten::Api::Auction::CodeSearch,{:itemCode => "i:mycloset:10006143"})
|
23
|
+
res["Items"].each do |v|
|
24
|
+
p v["Item"]["itemName"]
|
25
|
+
end
|
26
|
+
|
data/example/bookmark.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
# Favorite Bookmark List API (version:2012-06-27)
|
4
|
+
res = Rakuten::Api.get(Rakuten::Api::Bookmark::List,{:hits => "10"})
|
5
|
+
res["items"].each do |v|
|
6
|
+
p v["item"]["itemName"]
|
7
|
+
end
|
8
|
+
|
9
|
+
Favorite Bookmark Add API (version:2012-06-27)
|
10
|
+
res = Rakuten::Api.get(Rakuten::Api::Bookmark::Add,{:itemCode => "donya:10657590"})
|
11
|
+
p res["bookmarkId"]
|
12
|
+
|
13
|
+
# Favorite Bookmark Delete API (version:2012-06-27)
|
14
|
+
res = Rakuten::Api.get(Rakuten::Api::Bookmark::Delete,{:bookmarkId => "4639852"})
|
15
|
+
p res["affectedCount"]
|
data/example/books.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
# Books Total Search API (version:2013-05-22)
|
4
|
+
res = Rakuten::Api.get(Rakuten::Api::Books::TotalSearch,{:booksGenreId => "000"})
|
5
|
+
res["Items"].each do |v|
|
6
|
+
p v["Item"]["title"]
|
7
|
+
end
|
8
|
+
|
9
|
+
# Books Book Search API (version:2013-05-22)
|
10
|
+
res = Rakuten::Api.get(Rakuten::Api::Books::BookSearch,{:booksGenreId => "001004008"})
|
11
|
+
res["Items"].each do |v|
|
12
|
+
p v["Item"]["title"]
|
13
|
+
end
|
14
|
+
|
15
|
+
# Books CD Search API (version:2013-05-22)
|
16
|
+
res = Rakuten::Api.get(Rakuten::Api::Books::CdSearch,{:booksGenreId => "002"})
|
17
|
+
res["Items"].each do |v|
|
18
|
+
p v["Item"]["title"]
|
19
|
+
end
|
20
|
+
|
21
|
+
# Books DVD Search API (version:2013-05-22)
|
22
|
+
res = Rakuten::Api.get(Rakuten::Api::Books::DvdSearch,{:booksGenreId => "003"})
|
23
|
+
res["Items"].each do |v|
|
24
|
+
p v["Item"]["title"]
|
25
|
+
end
|
26
|
+
|
27
|
+
# Books Foreign Book Search API (version:2013-05-22)
|
28
|
+
res = Rakuten::Api.get(Rakuten::Api::Books::ForeignBookSearch,{:booksGenreId => "005407"})
|
29
|
+
res["Items"].each do |v|
|
30
|
+
p v["Item"]["title"]
|
31
|
+
end
|
32
|
+
|
33
|
+
# Books Magazine Search API (version:2013-05-22)
|
34
|
+
res = Rakuten::Api.get(Rakuten::Api::Books::MagazineSearch,{:booksGenreId => "007604001"})
|
35
|
+
res["Items"].each do |v|
|
36
|
+
p v["Item"]["title"]
|
37
|
+
end
|
38
|
+
|
39
|
+
# Books Game Search API (version:2013-05-22)
|
40
|
+
res = Rakuten::Api.get(Rakuten::Api::Books::GameSearch,{:booksGenreId => "006"})
|
41
|
+
res["Items"].each do |v|
|
42
|
+
p v["Item"]["title"]
|
43
|
+
end
|
44
|
+
|
45
|
+
# Books Software Search API (version:2013-05-22)
|
46
|
+
res = Rakuten::Api.get(Rakuten::Api::Books::SoftwareSearch,{:booksGenreId => "004"})
|
47
|
+
res["Items"].each do |v|
|
48
|
+
p v["Item"]["title"]
|
49
|
+
end
|
50
|
+
|
51
|
+
# Books Genre Search API (version:2012-11-28)
|
52
|
+
res = Rakuten::Api.get(Rakuten::Api::Books::GenreSearch,{:booksGenreId => "000"})
|
53
|
+
res["children"].each do |v|
|
54
|
+
p v["child"]["booksGenreName"]
|
55
|
+
end
|
data/example/etc.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
# Dynamic Ad API
|
4
|
+
res = Rakuten::Api.get(Rakuten::Api::Etc::DynamicAd,{:url => 'http://plaza.rakuten.co.jp/isblog/diary/200705230001/'})
|
5
|
+
res["Body"]["Ads"]["Ad"].each do |v|
|
6
|
+
p v["ItemName"]
|
7
|
+
end
|
8
|
+
|
9
|
+
# Dynamic Ad Travel API
|
10
|
+
res = Rakuten::Api.get(Rakuten::Api::Etc::DynamicAdTravel,{:url => 'http://plaza.rakuten.co.jp/travelblog02/diary/200706140000/'})
|
11
|
+
res["Body"]["Ads"]["Ad"].each do |v|
|
12
|
+
p v["HotelName"]
|
13
|
+
end
|
14
|
+
|
15
|
+
# High Commission Shop API (version:2012-03-13)
|
16
|
+
res = Rakuten::Api.get(Rakuten::Api::Etc::HighCommissionShop,{:hits => '10'})
|
17
|
+
res["Body"]["HighCommissionShop"]["Shops"]["Shop"].each do |v|
|
18
|
+
p v["shopName"]
|
19
|
+
end
|
data/example/gora.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
# Gora Search API (version:2010-06-30)
|
4
|
+
res = Rakuten::Api.get(Rakuten::Api::Gora::Search,{:areaCode => "1"})
|
5
|
+
res["Body"]["GoraGolfCourseSearch"]["Items"]["Item"].each do |v|
|
6
|
+
p v["golfCourseName"]
|
7
|
+
end
|
8
|
+
|
9
|
+
# Gora Detail Search API (version:2010-06-30)
|
10
|
+
res = Rakuten::Api.get(Rakuten::Api::Gora::DetailSearch,{:golfCourseId => "70008"})
|
11
|
+
res["Body"]["GoraGolfCourseDetail"]["Item"].each do |v|
|
12
|
+
p v["golfCourseName"]
|
13
|
+
end
|
14
|
+
|
15
|
+
# Gora Plan Search API (version:2012-12-10)
|
16
|
+
res = Rakuten::Api.get(Rakuten::Api::Gora::PlanSearch,{:areaCode => "1",:playDate => "2013-09-28"})
|
17
|
+
res["Body"]["GoraPlanSearch"]["Items"]["Item"].each do |v|
|
18
|
+
p v["golfCourseId"]
|
19
|
+
end
|
data/example/helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "rakuten/api"
|
3
|
+
|
4
|
+
config = YAML.load_file(File.dirname(__FILE__)+'/config.yml')
|
5
|
+
|
6
|
+
Rakuten::Api.configure do |options|
|
7
|
+
options[:applicationId] = config['applicationId']
|
8
|
+
options[:affiliateId] = config['affiliateId']
|
9
|
+
# options[:access_token] = config['access_token']
|
10
|
+
end
|
data/example/ichiba.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
# Ichiba Item Search API (version:2013-08-05)
|
4
|
+
res = Rakuten::Api.get(Rakuten::Api::Ichiba::Search,{:genreId => "101240"})
|
5
|
+
res["Items"].each do |v|
|
6
|
+
p v["Item"]["itemName"]
|
7
|
+
end
|
8
|
+
|
9
|
+
# Ichiba Genre Search API (version:2012-07-23)
|
10
|
+
res = Rakuten::Api.get(Rakuten::Api::Ichiba::GenreSearch,{:genreId => "101240"})
|
11
|
+
res["children"].each do |v|
|
12
|
+
p v["child"]["genreName"]
|
13
|
+
end
|
14
|
+
|
15
|
+
# Ichiba Item Ranking API (version:2012-09-27)
|
16
|
+
res = Rakuten::Api.get(Rakuten::Api::Ichiba::Ranking,{:genreId => "101240"})
|
17
|
+
res["Items"].each do |v|
|
18
|
+
p v["Item"]["itemName"]
|
19
|
+
end
|
data/example/product.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
# Product Search API (version:2010-11-18)
|
4
|
+
res = Rakuten::Api.get(Rakuten::Api::Product::Search,{:genreId => "101240"})
|
5
|
+
res["Body"]["ProductSearch"]["Items"]["Item"].each do |v|
|
6
|
+
p v["productName"]
|
7
|
+
end
|
8
|
+
|
9
|
+
# Product Detail Search API (version:2011-07-14)
|
10
|
+
res = Rakuten::Api.get(Rakuten::Api::Product::DetailSearch,{:productId => "182649bd754f31e43123378ea108411a"})
|
11
|
+
res["Body"]["ProductDetail"]["Item"].each do |v|
|
12
|
+
p v["productNo"]
|
13
|
+
end
|
14
|
+
|
15
|
+
# Product Genre Search API (version:2010-11-18)
|
16
|
+
res = Rakuten::Api.get(Rakuten::Api::Product::GenreSearch,{:genreId => "101240"})
|
17
|
+
res["Body"]["ProductGenreInfo"]["GenreInformation"]["child"].each do |v|
|
18
|
+
p v["genreName"]
|
19
|
+
end
|
data/example/recipe.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
# Recipe Category List API (version:2012-11-21)
|
4
|
+
res = Rakuten::Api.get(Rakuten::Api::Recipe::CategoryList,{:categoryType => "large"})
|
5
|
+
res["result"]["large"].each do |v|
|
6
|
+
p v["categoryName"]
|
7
|
+
end
|
8
|
+
|
9
|
+
# Recipe Category Ranking API (version:2012-11-21)
|
10
|
+
res = Rakuten::Api.get(Rakuten::Api::Recipe::CategoryRanking,{:categoryId => "10"})
|
11
|
+
res["result"].each do |v|
|
12
|
+
p v["recipeTitle"]
|
13
|
+
end
|
data/example/travel.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
# Travel Search API (version:2009-10-20)
|
4
|
+
res = Rakuten::Api.get(Rakuten::Api::Travel::Search,{:largeClassCode => "japan",:middleClassCode => "hokkaido",:smallClassCode => "sapporo",:detailClassCode => "A"})
|
5
|
+
res['Body']['SimpleHotelSearch']['hotel'].each do |v|
|
6
|
+
p v['hotelBasicInfo']["hotelName"]
|
7
|
+
end
|
8
|
+
|
9
|
+
# Travel Detail Search API (version:2009-09-09)
|
10
|
+
res = Rakuten::Api.get(Rakuten::Api::Travel::DetailSearch,{:hotelNo => "142610"})
|
11
|
+
res['Body']['HotelDetailSearch']['hotel'].each do |v|
|
12
|
+
p v['hotelBasicInfo']["hotelName"]
|
13
|
+
end
|
14
|
+
|
15
|
+
# Travel Vacant Search API (version:2009-10-20)
|
16
|
+
res = Rakuten::Api.get(Rakuten::Api::Travel::VacantSearch,{:checkinDate => "2013-09-26",:checkoutDate => "2013-09-27",:largeClassCode => "japan",:middleClassCode => "hokkaido",:smallClassCode => "sapporo",:detailClassCode => "A"})
|
17
|
+
res["Body"]["hotel"].each do |v|
|
18
|
+
p v["hotelInfo"][0]["hotelBasicInfo"]["hotelName"]
|
19
|
+
end
|
20
|
+
|
21
|
+
# Travel Area Code API (version:2009-03-26)
|
22
|
+
res = Rakuten::Api.get(Rakuten::Api::Travel::AreaCode)
|
23
|
+
res["Body"]["GetAreaClassInfo"]["largeClass"]["middleClass"].each do |v|
|
24
|
+
p v["smallClass"]
|
25
|
+
end
|
26
|
+
|
27
|
+
# Travel Keyword Search API (version:2009-10-20)
|
28
|
+
res = Rakuten::Api.get(Rakuten::Api::Travel::KeywordSearch,{:keyword => 'au'})
|
29
|
+
res['Body']['KeywordHotelSearch']['hotel'].each do |v|
|
30
|
+
p v["hotelBasicInfo"]["hotelName"]
|
31
|
+
end
|
32
|
+
|
33
|
+
# Travel Chain List API (version:2009-05-12)
|
34
|
+
res = Rakuten::Api.get(Rakuten::Api::Travel::ChainList)
|
35
|
+
res["Body"]["GetHotelChainList"]["hotelChainList"][0]["hotelChain"].each do |v|
|
36
|
+
p v["hotelChainName"]
|
37
|
+
end
|
38
|
+
|
39
|
+
# Travel Ranking API (version:2009-06-25)
|
40
|
+
res = Rakuten::Api.get(Rakuten::Api::Travel::Ranking,{:genre => "all"})
|
41
|
+
res["Body"]["HotelRanking"]["ranking"][0]["hotelRankInfo"].each do |v|
|
42
|
+
p v["hotelName"]
|
43
|
+
end
|
data/lib/rakuten/api.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require "net/http"
|
2
|
+
require "uri"
|
3
|
+
require "cgi"
|
4
|
+
require "json"
|
5
|
+
require "rakuten/api/version"
|
6
|
+
require "rakuten/api/response"
|
7
|
+
require "rakuten/api/request"
|
8
|
+
require "rakuten/api/auction"
|
9
|
+
require "rakuten/api/bookmark"
|
10
|
+
require "rakuten/api/books"
|
11
|
+
require "rakuten/api/etc"
|
12
|
+
require "rakuten/api/gora"
|
13
|
+
require "rakuten/api/ichiba"
|
14
|
+
require "rakuten/api/product"
|
15
|
+
require "rakuten/api/recipe"
|
16
|
+
require "rakuten/api/travel"
|
17
|
+
|
18
|
+
module Rakuten
|
19
|
+
|
20
|
+
class Api
|
21
|
+
|
22
|
+
@@options = {}
|
23
|
+
|
24
|
+
class << self
|
25
|
+
|
26
|
+
def options
|
27
|
+
@@options
|
28
|
+
end
|
29
|
+
|
30
|
+
def configure(&proc)
|
31
|
+
raise ArgumentError, "Block is required." unless block_given?
|
32
|
+
yield @@options
|
33
|
+
end
|
34
|
+
|
35
|
+
def get(method,opts={})
|
36
|
+
eval method+"(#{opts})"
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Rakuten
|
2
|
+
|
3
|
+
class Api
|
4
|
+
|
5
|
+
class Auction
|
6
|
+
|
7
|
+
GenreSearch = "Rakuten::Api::Auction.genre_search"
|
8
|
+
GenreKeywordSearch = "Rakuten::Api::Auction.genre_keyword_search"
|
9
|
+
Search = "Rakuten::Api::Auction.search"
|
10
|
+
CodeSearch = "Rakuten::Api::Auction.code_search"
|
11
|
+
|
12
|
+
class << self
|
13
|
+
|
14
|
+
# Auction Genre Search API (version:2012-09-27)
|
15
|
+
def genre_search(opts={})
|
16
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/AuctionGenreId/Search/20120927", opts.merge(Rakuten::Api.options))
|
17
|
+
end
|
18
|
+
|
19
|
+
# Auction Genre Keyword Search API (version:2012-09-27)
|
20
|
+
def genre_keyword_search(opts={})
|
21
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/AuctionGenreKeyword/Search/20120927", opts.merge(Rakuten::Api.options))
|
22
|
+
end
|
23
|
+
|
24
|
+
# Auction Item Search API (version:2013-01-10)
|
25
|
+
def search(opts={})
|
26
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/AuctionItem/Search/20130110", opts.merge(Rakuten::Api.options))
|
27
|
+
end
|
28
|
+
|
29
|
+
# Auction Item Code Search API (version:2012-10-10)
|
30
|
+
def code_search(opts={})
|
31
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/AuctionItemCode/Search/20121010", opts.merge(Rakuten::Api.options))
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Rakuten
|
2
|
+
|
3
|
+
class Api
|
4
|
+
|
5
|
+
class Bookmark
|
6
|
+
|
7
|
+
List = "Rakuten::Api::Bookmark.list"
|
8
|
+
Add = "Rakuten::Api::Bookmark.add"
|
9
|
+
Delete = "Rakuten::Api::Bookmark.delete"
|
10
|
+
|
11
|
+
class << self
|
12
|
+
|
13
|
+
# Favorite Bookmark List API (version:2012-06-27)
|
14
|
+
def list(opts={})
|
15
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/FavoriteBookmark/List/20120627", opts.merge(Rakuten::Api.options))
|
16
|
+
end
|
17
|
+
|
18
|
+
# Favorite Bookmark Add API (version:2012-06-27)
|
19
|
+
def add(opts={})
|
20
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/FavoriteBookmark/Add/20120627", opts.merge(Rakuten::Api.options))
|
21
|
+
end
|
22
|
+
|
23
|
+
# Favorite Bookmark Delete API (version:2012-06-27)
|
24
|
+
def delete(opts={})
|
25
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/FavoriteBookmark/Delete/20120627", opts.merge(Rakuten::Api.options))
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Rakuten
|
2
|
+
|
3
|
+
class Api
|
4
|
+
|
5
|
+
class Books
|
6
|
+
|
7
|
+
TotalSearch = "Rakuten::Api::Books.total_search"
|
8
|
+
BookSearch = "Rakuten::Api::Books.book_search"
|
9
|
+
CdSearch = "Rakuten::Api::Books.cd_search"
|
10
|
+
DvdSearch = "Rakuten::Api::Books.dvd_search"
|
11
|
+
ForeignBookSearch = "Rakuten::Api::Books.foreign_book_search"
|
12
|
+
MagazineSearch = "Rakuten::Api::Books.magazine_search"
|
13
|
+
GameSearch = "Rakuten::Api::Books.game_search"
|
14
|
+
SoftwareSearch = "Rakuten::Api::Books.software_search"
|
15
|
+
GenreSearch = "Rakuten::Api::Books.genre_search"
|
16
|
+
|
17
|
+
class << self
|
18
|
+
|
19
|
+
# Books Total Search API (version:2013-05-22)
|
20
|
+
def total_search(opts={})
|
21
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/BooksTotal/Search/20130522", opts.merge(Rakuten::Api.options))
|
22
|
+
end
|
23
|
+
|
24
|
+
# Books Book Search API (version:2013-05-22)
|
25
|
+
def book_search(opts={})
|
26
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/BooksBook/Search/20130522", opts.merge(Rakuten::Api.options))
|
27
|
+
end
|
28
|
+
|
29
|
+
# Books CD Search API (version:2013-05-22)
|
30
|
+
def cd_search(opts={})
|
31
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/BooksCD/Search/20130522", opts.merge(Rakuten::Api.options))
|
32
|
+
end
|
33
|
+
|
34
|
+
# Books DVD Search API (version:2013-05-22)
|
35
|
+
def dvd_search(opts={})
|
36
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/BooksDVD/Search/20130522", opts.merge(Rakuten::Api.options))
|
37
|
+
end
|
38
|
+
|
39
|
+
# Books Foreign Book Search API (version:2013-05-22)
|
40
|
+
def foreign_book_search(opts={})
|
41
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/BooksForeignBook/Search/20130522", opts.merge(Rakuten::Api.options))
|
42
|
+
end
|
43
|
+
|
44
|
+
# Books Magazine Search API (version:2013-05-22)
|
45
|
+
def magazine_search(opts={})
|
46
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/BooksMagazine/Search/20130522", opts.merge(Rakuten::Api.options))
|
47
|
+
end
|
48
|
+
|
49
|
+
# Books Game Search API (version:2013-05-22)
|
50
|
+
def game_search(opts={})
|
51
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/BooksGame/Search/20130522", opts.merge(Rakuten::Api.options))
|
52
|
+
end
|
53
|
+
|
54
|
+
# Books Software Search API (version:2013-05-22)
|
55
|
+
def software_search(opts={})
|
56
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/BooksSoftware/Search/20130522", opts.merge(Rakuten::Api.options))
|
57
|
+
end
|
58
|
+
|
59
|
+
# Books Genre Search API (version:2012-11-28)
|
60
|
+
def genre_search(opts={})
|
61
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/BooksGenre/Search/20121128", opts.merge(Rakuten::Api.options))
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Rakuten
|
2
|
+
|
3
|
+
class Api
|
4
|
+
|
5
|
+
class Etc
|
6
|
+
|
7
|
+
DynamicAd = "Rakuten::Api::Etc.dynamic_ad"
|
8
|
+
DynamicAdTravel = "Rakuten::Api::Etc.dynamic_ad_travel"
|
9
|
+
HighCommissionShop = "Rakuten::Api::Etc.high_commission_shop"
|
10
|
+
|
11
|
+
class << self
|
12
|
+
|
13
|
+
# Dynamic Ad API
|
14
|
+
def dynamic_ad(opts={})
|
15
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
16
|
+
Rakuten::Request.get("http://dynamic.rakuten.co.jp/rcm/1.0/i/json", opts.merge(Rakuten::Api.options))
|
17
|
+
end
|
18
|
+
|
19
|
+
# Dynamic Ad Travel API
|
20
|
+
def dynamic_ad_travel(opts={})
|
21
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
22
|
+
Rakuten::Request.get("http://dynamic.rakuten.co.jp/rcm/1.0/t/json", opts.merge(Rakuten::Api.options))
|
23
|
+
end
|
24
|
+
|
25
|
+
# High Commission Shop API (version:2012-03-13)
|
26
|
+
def high_commission_shop(opts={})
|
27
|
+
opts[:version] = '2012-03-13' unless opts.key?(:version)
|
28
|
+
opts[:operation] = 'HighCommissionShop' unless opts.key?(:operation)
|
29
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
30
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Rakuten
|
2
|
+
|
3
|
+
class Api
|
4
|
+
|
5
|
+
class Gora
|
6
|
+
|
7
|
+
Search = "Rakuten::Api::Gora.search"
|
8
|
+
DetailSearch = "Rakuten::Api::Gora.detail_search"
|
9
|
+
PlanSearch = "Rakuten::Api::Gora.plan_search"
|
10
|
+
|
11
|
+
class << self
|
12
|
+
|
13
|
+
# Gora Search API (version:2010-06-30)
|
14
|
+
def search(opts={})
|
15
|
+
opts[:version] = '2010-06-30' unless opts.key?(:version)
|
16
|
+
opts[:operation] = 'GoraGolfCourseSearch' unless opts.key?(:operation)
|
17
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
18
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
19
|
+
end
|
20
|
+
|
21
|
+
# Gora Detail Search API (version:2010-06-30)
|
22
|
+
def detail_search(opts={})
|
23
|
+
opts[:version] = '2010-06-30' unless opts.key?(:version)
|
24
|
+
opts[:operation] = 'GoraGolfCourseDetail' unless opts.key?(:operation)
|
25
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
26
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
27
|
+
end
|
28
|
+
|
29
|
+
# Gora Plan Search API (version:2012-12-10)
|
30
|
+
def plan_search(opts={})
|
31
|
+
opts[:version] = '2012-12-10' unless opts.key?(:version)
|
32
|
+
opts[:operation] = 'GoraPlanSearch' unless opts.key?(:operation)
|
33
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
34
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Rakuten
|
2
|
+
|
3
|
+
class Api
|
4
|
+
|
5
|
+
class Ichiba
|
6
|
+
|
7
|
+
Search = "Rakuten::Api::Ichiba.search"
|
8
|
+
GenreSearch = "Rakuten::Api::Ichiba.genre_search"
|
9
|
+
Ranking = "Rakuten::Api::Ichiba.ranking"
|
10
|
+
|
11
|
+
class << self
|
12
|
+
|
13
|
+
# Ichiba Item Search API (version:2013-08-05)
|
14
|
+
def search(opts={})
|
15
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/IchibaItem/Search/20130805", opts.merge(Rakuten::Api.options))
|
16
|
+
end
|
17
|
+
|
18
|
+
# Ichiba Genre Search API (version:2012-07-23)
|
19
|
+
def genre_search(opts={})
|
20
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/IchibaGenre/Search/20120723", opts.merge(Rakuten::Api.options))
|
21
|
+
end
|
22
|
+
|
23
|
+
# Ichiba Item Ranking API (version:2012-09-27)
|
24
|
+
def ranking(opts={})
|
25
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20120927", opts.merge(Rakuten::Api.options))
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Rakuten
|
2
|
+
|
3
|
+
class Api
|
4
|
+
|
5
|
+
class Product
|
6
|
+
|
7
|
+
Search = "Rakuten::Api::Product.search"
|
8
|
+
DetailSearch = "Rakuten::Api::Product.detail_search"
|
9
|
+
GenreSearch = "Rakuten::Api::Product.genre_search"
|
10
|
+
|
11
|
+
class << self
|
12
|
+
|
13
|
+
# Product Search API (version:2010-11-18)
|
14
|
+
def search(opts={})
|
15
|
+
opts[:version] = '2010-11-18' unless opts.key?(:version)
|
16
|
+
opts[:operation] = 'ProductSearch' unless opts.key?(:operation)
|
17
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
18
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
19
|
+
end
|
20
|
+
|
21
|
+
# Product Detail Search API (version:2011-07-14)
|
22
|
+
def detail_search(opts={})
|
23
|
+
opts[:version] = '2011-07-14' unless opts.key?(:version)
|
24
|
+
opts[:operation] = 'ProductDetail' unless opts.key?(:operation)
|
25
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
26
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
27
|
+
end
|
28
|
+
|
29
|
+
# Product Genre Search API (version:2010-11-18)
|
30
|
+
def genre_search(opts={})
|
31
|
+
opts[:version] = '2010-11-18' unless opts.key?(:version)
|
32
|
+
opts[:operation] = 'ProductGenreInfo' unless opts.key?(:operation)
|
33
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
34
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Rakuten
|
2
|
+
|
3
|
+
class Api
|
4
|
+
|
5
|
+
class Recipe
|
6
|
+
|
7
|
+
CategoryList = "Rakuten::Api::Recipe.category_list"
|
8
|
+
CategoryRanking = "Rakuten::Api::Recipe.category_ranking"
|
9
|
+
|
10
|
+
class << self
|
11
|
+
|
12
|
+
# Recipe Category List API (version:2012-11-21)
|
13
|
+
def category_list(opts={})
|
14
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/Recipe/CategoryList/20121121", opts.merge(Rakuten::Api.options))
|
15
|
+
end
|
16
|
+
|
17
|
+
# Recipe Category Ranking API (version:2012-11-21)
|
18
|
+
def category_ranking(opts={})
|
19
|
+
Rakuten::Request.get("https://app.rakuten.co.jp/services/api/Recipe/CategoryRanking/20121121", opts.merge(Rakuten::Api.options))
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Rakuten
|
2
|
+
|
3
|
+
class Response
|
4
|
+
|
5
|
+
def initialize(response)
|
6
|
+
@response =response
|
7
|
+
@body = JSON.parse(@response.body)
|
8
|
+
end
|
9
|
+
|
10
|
+
def code
|
11
|
+
@response.code.to_i
|
12
|
+
end
|
13
|
+
|
14
|
+
def message
|
15
|
+
@response.message
|
16
|
+
end
|
17
|
+
|
18
|
+
def method_missing(name, *args, &block)
|
19
|
+
if @body.respond_to?(name)
|
20
|
+
@body.send(name, *args, &block)
|
21
|
+
else
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Rakuten
|
2
|
+
|
3
|
+
class Api
|
4
|
+
|
5
|
+
class Travel
|
6
|
+
|
7
|
+
Search = "Rakuten::Api::Travel.search"
|
8
|
+
DetailSearch = "Rakuten::Api::Travel.detail_search"
|
9
|
+
VacantSearch = "Rakuten::Api::Travel.vacant_search"
|
10
|
+
AreaCode = "Rakuten::Api::Travel.area_code"
|
11
|
+
KeywordSearch = "Rakuten::Api::Travel.keyword_search"
|
12
|
+
ChainList = "Rakuten::Api::Travel.chain_list"
|
13
|
+
Ranking = "Rakuten::Api::Travel.ranking"
|
14
|
+
|
15
|
+
class << self
|
16
|
+
|
17
|
+
# Travel Search API (version:2009-10-20)
|
18
|
+
def search(opts={})
|
19
|
+
opts[:version] = '2009-10-20' unless opts.key?(:version)
|
20
|
+
opts[:operation] = 'SimpleHotelSearch' unless opts.key?(:operation)
|
21
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
22
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
23
|
+
end
|
24
|
+
|
25
|
+
# Travel Detail Search API (version:2009-09-09)
|
26
|
+
def detail_search(opts={})
|
27
|
+
opts[:version] = '2009-09-09' unless opts.key?(:version)
|
28
|
+
opts[:operation] = 'HotelDetailSearch' unless opts.key?(:operation)
|
29
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
30
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
31
|
+
end
|
32
|
+
|
33
|
+
# Travel Vacant Search API (version:2009-10-20)
|
34
|
+
def vacant_search(opts={})
|
35
|
+
opts[:version] = '2009-10-20' unless opts.key?(:version)
|
36
|
+
opts[:operation] = 'VacantHotelSearch' unless opts.key?(:operation)
|
37
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
38
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
39
|
+
end
|
40
|
+
|
41
|
+
# Travel Area Code API (version:2009-03-26)
|
42
|
+
def area_code(opts={})
|
43
|
+
opts[:version] = '2009-03-26' unless opts.key?(:version)
|
44
|
+
opts[:operation] = 'GetAreaClass' unless opts.key?(:operation)
|
45
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
46
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
47
|
+
end
|
48
|
+
|
49
|
+
# Travel Keyword Search API (version:2009-10-20)
|
50
|
+
def keyword_search(opts={})
|
51
|
+
opts[:version] = '2009-10-20' unless opts.key?(:version)
|
52
|
+
opts[:operation] = 'KeywordHotelSearch' unless opts.key?(:operation)
|
53
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
54
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
55
|
+
end
|
56
|
+
|
57
|
+
# Travel Chain List API (version:2009-05-12)
|
58
|
+
def chain_list(opts={})
|
59
|
+
opts[:version] = '2009-05-12' unless opts.key?(:version)
|
60
|
+
opts[:operation] = 'GetHotelChainList' unless opts.key?(:operation)
|
61
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
62
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
63
|
+
end
|
64
|
+
|
65
|
+
# Travel Ranking API (version:2009-06-25)
|
66
|
+
def ranking(opts={})
|
67
|
+
opts[:version] = '2009-06-25' unless opts.key?(:version)
|
68
|
+
opts[:operation] = 'HotelRanking' unless opts.key?(:operation)
|
69
|
+
opts[:developerId] = Rakuten::Api.options[:applicationId] unless opts.key?(:developerId)
|
70
|
+
Rakuten::Request.get("http://api.rakuten.co.jp/rws/3.0/json", opts.merge(Rakuten::Api.options))
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
data/rakuten-api.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rakuten/api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rakuten-api"
|
8
|
+
spec.version = Rakuten::Api::VERSION
|
9
|
+
spec.authors = ["shoprev"]
|
10
|
+
spec.email = ["admin@shoprev.net"]
|
11
|
+
spec.description = %q{Ruby Rakuten Web API}
|
12
|
+
spec.summary = %q{Ruby Rakuten Web API}
|
13
|
+
spec.homepage = "https://github.com/shoprev/rakuten-api"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "vcr"
|
25
|
+
spec.add_development_dependency "webmock", "1.11.0"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rakuten-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- shoprev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: vcr
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.11.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.11.0
|
83
|
+
description: Ruby Rakuten Web API
|
84
|
+
email:
|
85
|
+
- admin@shoprev.net
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- example/auction.rb
|
96
|
+
- example/bookmark.rb
|
97
|
+
- example/books.rb
|
98
|
+
- example/etc.rb
|
99
|
+
- example/gora.rb
|
100
|
+
- example/helper.rb
|
101
|
+
- example/ichiba.rb
|
102
|
+
- example/product.rb
|
103
|
+
- example/recipe.rb
|
104
|
+
- example/travel.rb
|
105
|
+
- lib/rakuten/api.rb
|
106
|
+
- lib/rakuten/api/auction.rb
|
107
|
+
- lib/rakuten/api/bookmark.rb
|
108
|
+
- lib/rakuten/api/books.rb
|
109
|
+
- lib/rakuten/api/etc.rb
|
110
|
+
- lib/rakuten/api/gora.rb
|
111
|
+
- lib/rakuten/api/ichiba.rb
|
112
|
+
- lib/rakuten/api/product.rb
|
113
|
+
- lib/rakuten/api/recipe.rb
|
114
|
+
- lib/rakuten/api/request.rb
|
115
|
+
- lib/rakuten/api/response.rb
|
116
|
+
- lib/rakuten/api/travel.rb
|
117
|
+
- lib/rakuten/api/version.rb
|
118
|
+
- rakuten-api.gemspec
|
119
|
+
homepage: https://github.com/shoprev/rakuten-api
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.0.3
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: Ruby Rakuten Web API
|
143
|
+
test_files: []
|