yahoo-api 0.1.3 → 0.1.4
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 +4 -4
- data/.gitignore +3 -1
- data/README.md +29 -145
- data/example/auction.rb +53 -0
- data/example/helper.rb +10 -0
- data/example/shopping.rb +72 -0
- data/lib/yahoo/api.rb +4 -0
- data/lib/yahoo/api/auction.rb +10 -0
- data/lib/yahoo/api/shopping.rb +11 -0
- data/lib/yahoo/api/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9faf607ee8fbce9ebfbd1c1eec571ee31f1fc8a3
|
4
|
+
data.tar.gz: 0aa2aa2c5f1aa1cc7dfa5d1b690bed07d3362e05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b8ec20438ab3bfcb1488ec27728eb23f5256cd5be758761baee2dceb4c6cfe3bb552392af8f85c47dc4568421f149741377099d2bfb44c4fe64b3c87011394a
|
7
|
+
data.tar.gz: 9abafb342878c83b8ed7a794d6f87de578b9d2ad2c1feb4cef50d893eda9427956da91f0ba0c9dc01487ffecb3c87c27b2f1be685c3b91f8b9f5c5c2a270dabc
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Yahoo::Api
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/yahoo-api)
|
4
|
-
Ruby Yahoo Japan Web API ( Shopping & Auction )
|
4
|
+
Ruby Yahoo Japan Web API ( Shopping & Auction supported )
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
@@ -19,26 +19,20 @@ Or install it yourself as:
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
-
### Configure
|
23
|
-
|
24
22
|
```ruby
|
23
|
+
require 'yahoo/api'
|
24
|
+
|
25
|
+
# configure
|
25
26
|
Yahoo::Api.configure do |options|
|
26
27
|
options[:appid] = 'your api id'
|
27
28
|
options[:affiliate_type] = "vc or yid"
|
28
29
|
options[:affiliate_id] = "your affiliate id"
|
29
30
|
end
|
30
|
-
```
|
31
|
-
|
32
|
-
### Yahoo Shopping API
|
33
|
-
|
34
|
-
Refer to [Shopping Web API documentation](http://developer.yahoo.co.jp/webapi/shopping/) for more infomation.
|
35
31
|
|
36
|
-
```ruby
|
37
32
|
# Item Search API v1
|
38
|
-
res = Yahoo::Api::Shopping
|
33
|
+
res = Yahoo::Api.get(Yahoo::Api::Shopping::ItemSearch,{:category_id => "13457"})
|
39
34
|
res.code # 200
|
40
35
|
res.message # "OK"
|
41
|
-
|
42
36
|
res["ResultSet"]["totalResultsReturned"].times do |i|
|
43
37
|
code = res["ResultSet"]["0"]["Result"]["#{i}"]["Code"]
|
44
38
|
...
|
@@ -51,146 +45,36 @@ res["ResultSet"]["0"]["Result"].each do |i,v|
|
|
51
45
|
code = v["Code"]
|
52
46
|
...
|
53
47
|
end
|
54
|
-
|
55
|
-
# Category Ranking API v1
|
56
|
-
res = Yahoo::Api::Shopping.category_ranking({:category_id => "13457"})
|
57
|
-
res["ResultSet"]["totalResultsReturned"].times do |i|
|
58
|
-
code = res["ResultSet"]["0"]["Result"]["#{i}"]["Code"]
|
59
|
-
...
|
60
|
-
end
|
61
|
-
|
62
|
-
# Category Search API v1
|
63
|
-
res = Yahoo::Api::Shopping.category_search({:category_id => "1"})
|
64
|
-
res["ResultSet"]["0"]["Result"]["Categories"]["Children"].each do |i,v|
|
65
|
-
next unless i =~ /\d+/
|
66
|
-
id = v["Id"]
|
67
|
-
...
|
68
|
-
end
|
69
|
-
|
70
|
-
# Item Lookup API v1
|
71
|
-
res = Yahoo::Api::Shopping.item_lookup({:itemcode => "hair_haclm352nn"})
|
72
|
-
res["ResultSet"]["0"]["Result"].each do |i,v|
|
73
|
-
next unless i =~ /\d+/
|
74
|
-
name = v["Name"]
|
75
|
-
...
|
76
|
-
end
|
77
|
-
|
78
|
-
# Query Ranking API v1
|
79
|
-
res = Yahoo::Api::Shopping.query_ranking({:category_id => "13457"})
|
80
|
-
res["ResultSet"]["0"]["Result"].each do |i,v|
|
81
|
-
next unless i =~ /\d+/
|
82
|
-
url = v["Url"]
|
83
|
-
...
|
84
|
-
end
|
85
|
-
|
86
|
-
# Content Match Item API v1
|
87
|
-
res = Yahoo::Api::Shopping.content_match_item({:url => "http://www.yahoo.co.jp/"})
|
88
|
-
res["ResultSet"]["0"]["Result"].each do |i,v|
|
89
|
-
next unless i =~ /\d+/
|
90
|
-
name = v["Name"]
|
91
|
-
...
|
92
|
-
end
|
93
|
-
|
94
|
-
# Content Match Ranking API v1
|
95
|
-
res = Yahoo::Api::Shopping.content_match_ranking({:url => "http://www.yahoo.co.jp/"})
|
96
|
-
res["ResultSet"]["0"]["Result"].each do |i,v|
|
97
|
-
next unless i =~ /\d+/
|
98
|
-
name = v["Name"]
|
99
|
-
...
|
100
|
-
end
|
101
|
-
|
102
|
-
# Get Module API v1
|
103
|
-
res = Yahoo::Api::Shopping.get_module({:category_id => "13457",:position => "eventrecommend"})
|
104
|
-
res["ResultSet"]["0"]["Result"].each do |i,v|
|
105
|
-
next unless i =~ /\d+/
|
106
|
-
title = v["Title"]
|
107
|
-
...
|
108
|
-
end
|
109
|
-
|
110
|
-
# Event Search API v1
|
111
|
-
res = Yahoo::Api::Shopping.event_search({:event_type => "store"})
|
112
|
-
res["ResultSet"]["0"]["Result"].each do |i,v|
|
113
|
-
next unless i =~ /\d+/
|
114
|
-
code = v["EventCode"]
|
115
|
-
...
|
116
|
-
end
|
117
|
-
|
118
|
-
# Review Search API v1
|
119
|
-
res = Yahoo::Api::Shopping.review_search({:category_id => "13457"})
|
120
|
-
res["ResultSet"]["Result"].each do |v|
|
121
|
-
code = v["Target"]["Code"]
|
122
|
-
...
|
123
|
-
end
|
124
48
|
```
|
125
49
|
|
126
|
-
|
127
|
-
|
128
|
-
Refer to [Auction Web API documentation](http://developer.yahoo.co.jp/webapi/auctions/) for more infomation.
|
50
|
+
See the [examples directory](https://github.com/shoprev/yahoo-api/tree/master/example) for more usage.
|
129
51
|
|
130
52
|
```ruby
|
131
|
-
#
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
#
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
#
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
end
|
153
|
-
|
154
|
-
# Search API v2
|
155
|
-
res = Yahoo::Api::Auction.item({:query => "au"})
|
156
|
-
res["ResultSet"]["Result"]["Item"].each do |v|
|
157
|
-
id = v["AuctionID"]
|
158
|
-
...
|
159
|
-
end
|
160
|
-
|
161
|
-
# Item API v2
|
162
|
-
res = Yahoo::Api::Auction.item({:auctionID => "x297261554"})
|
163
|
-
title = res["ResultSet"]["Result"]["Title"]
|
164
|
-
|
165
|
-
# Bid History API v1
|
166
|
-
res = Yahoo::Api::Auction.bid_history({:auctionID => "x297261554"})
|
167
|
-
res["ResultSet"]["Result"].each do |v|
|
168
|
-
id = v["Bidder"]
|
169
|
-
...
|
170
|
-
end
|
171
|
-
|
172
|
-
# Bid History Detail API v1
|
173
|
-
res = Yahoo::Api::Auction.bid_history_detail({:auctionID => "x297261554"})
|
174
|
-
res["ResultSet"]["Result"].each do |v|
|
175
|
-
id = v["Bidder"]
|
176
|
-
...
|
177
|
-
end
|
178
|
-
|
179
|
-
# Show Q & A API v1
|
180
|
-
res = Yahoo::Api::Auction.show_q_and_a({:auctionID => "h180241200"})
|
181
|
-
res["ResultSet"]["Result"]["QandA"].each do |v|
|
182
|
-
title = v["Title"]
|
183
|
-
...
|
184
|
-
end
|
185
|
-
|
186
|
-
# Show Rating API v1
|
187
|
-
res = Yahoo::Api::Auction.show_rating({:id => "kaz_vegi"})
|
188
|
-
res["ResultSet"]["Result"].each do |v|
|
189
|
-
title = v["Title"]
|
190
|
-
...
|
191
|
-
end
|
53
|
+
# Yahoo Shopping Web API
|
54
|
+
Yahoo::Api::Shopping::ItemSearch # Item Search API v1
|
55
|
+
Yahoo::Api::Shopping::CategoryRanking # Category Ranking API v1
|
56
|
+
Yahoo::Api::Shopping::CategorySearch # Category Search API v1
|
57
|
+
Yahoo::Api::Shopping::ItemLookup # Item Lookup API v1
|
58
|
+
Yahoo::Api::Shopping::QueryRanking # Query Ranking API v1
|
59
|
+
Yahoo::Api::Shopping::ContentMatchItem # Content Match Item API v1
|
60
|
+
Yahoo::Api::Shopping::ContentMatchRanking # Content Match Ranking API v1
|
61
|
+
Yahoo::Api::Shopping::GetModule # Get Module API v1
|
62
|
+
Yahoo::Api::Shopping::EventSearch # Event Search API v1
|
63
|
+
Yahoo::Api::Shopping::ReviewSearch # Review Search API v1
|
64
|
+
# Yahoo Auction Web API
|
65
|
+
Yahoo::Api::Auction::CategoryTree # Category Tree API v2
|
66
|
+
Yahoo::Api::Auction::CategoryLeaf # Category Leaf API v2
|
67
|
+
Yahoo::Api::Auction::SellingList # Selling List API v2
|
68
|
+
Yahoo::Api::Auction::Search # Search API v2
|
69
|
+
Yahoo::Api::Auction::Item # Item API v2
|
70
|
+
Yahoo::Api::Auction::BidHistory # Bid History API v1
|
71
|
+
Yahoo::Api::Auction::BidHistoryDetail # Bid History Detail API v1
|
72
|
+
Yahoo::Api::Auction::ShowQAndA # Show Q & A API v1
|
73
|
+
Yahoo::Api::Auction::ShowRating # Show Rating API v1
|
192
74
|
```
|
193
75
|
|
76
|
+
Refer to [Shopping Web API documentation](http://developer.yahoo.co.jp/webapi/shopping/) or [Auction Web API documentation](http://developer.yahoo.co.jp/webapi/auctions/) for more infomation.
|
77
|
+
|
194
78
|
## Contributing
|
195
79
|
|
196
80
|
1. Fork it
|
data/example/auction.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
# Category Tree API v2
|
4
|
+
res = Yahoo::Api.get(Yahoo::Api::Auction::CategoryTree,{:category => "0"})
|
5
|
+
res["ResultSet"]["Result"]["ChildCategory"].each do |v|
|
6
|
+
p v["CategoryId"]
|
7
|
+
end
|
8
|
+
|
9
|
+
# Category Leaf API v2
|
10
|
+
res = Yahoo::Api.get(Yahoo::Api::Auction::CategoryLeaf,{:category => "23336"})
|
11
|
+
res["ResultSet"]["Result"]["Item"].each do |v|
|
12
|
+
p v["AuctionID"]
|
13
|
+
end
|
14
|
+
|
15
|
+
# Selling List API v2
|
16
|
+
res = Yahoo::Api.get(Yahoo::Api::Auction::SellingList,{:sellerID => "ichienshop55"})
|
17
|
+
res["ResultSet"]["Result"]["Item"].each do |v|
|
18
|
+
p v["AuctionID"]
|
19
|
+
end
|
20
|
+
|
21
|
+
# Search API v2
|
22
|
+
res = Yahoo::Api.get(Yahoo::Api::Auction::Search,{:query => "au"})
|
23
|
+
res["ResultSet"]["Result"]["Item"].each do |v|
|
24
|
+
p v["AuctionID"]
|
25
|
+
end
|
26
|
+
|
27
|
+
# Item API v2
|
28
|
+
res = Yahoo::Api.get(Yahoo::Api::Auction::Item,{:auctionID => "x297261554"})
|
29
|
+
p res["ResultSet"]["Result"]["Title"]
|
30
|
+
|
31
|
+
# Bid History API v1
|
32
|
+
res = Yahoo::Api.get(Yahoo::Api::Auction::BidHistory,{:auctionID => "x297261554"})
|
33
|
+
res["ResultSet"]["Result"].each do |v|
|
34
|
+
p v["Bidder"]
|
35
|
+
end
|
36
|
+
|
37
|
+
# Bid History Detail API v1
|
38
|
+
res = Yahoo::Api.get(Yahoo::Api::Auction::BidHistoryDetail,{:auctionID => "x297261554"})
|
39
|
+
res["ResultSet"]["Result"].each do |v|
|
40
|
+
p v["Bidder"]
|
41
|
+
end
|
42
|
+
|
43
|
+
# Show Q & A API v1
|
44
|
+
res = Yahoo::Api.get(Yahoo::Api::Auction::ShowQAndA,{:auctionID => "h180241200"})
|
45
|
+
res["ResultSet"]["Result"]["QandA"].each do |v|
|
46
|
+
p v["Title"]
|
47
|
+
end
|
48
|
+
|
49
|
+
# Show Rating API v1
|
50
|
+
res = Yahoo::Api.get(Yahoo::Api::Auction::ShowRating,{:id => "kaz_vegi"})
|
51
|
+
res["ResultSet"]["Result"].each do |v|
|
52
|
+
p v["Title"]
|
53
|
+
end
|
data/example/helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "yahoo/api"
|
3
|
+
|
4
|
+
config = YAML.load_file(File.dirname(__FILE__)+'/config.yml')
|
5
|
+
|
6
|
+
Yahoo::Api.configure do |options|
|
7
|
+
options[:appid] = config['appid']
|
8
|
+
# options[:affiliate_type] = config['affiliate_type']
|
9
|
+
# options[:affiliate_id] = config['affiliate_id']
|
10
|
+
end
|
data/example/shopping.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
# Item Search API v1
|
4
|
+
res = Yahoo::Api.get(Yahoo::Api::Shopping::ItemSearch,{:category_id => "13457"})
|
5
|
+
res["ResultSet"]["totalResultsReturned"].times do |i|
|
6
|
+
p res["ResultSet"]["0"]["Result"]["#{i}"]["Code"]
|
7
|
+
end
|
8
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
9
|
+
next unless i =~ /\d+/
|
10
|
+
p v["Code"]
|
11
|
+
end
|
12
|
+
|
13
|
+
# Category Ranking API v1
|
14
|
+
res = Yahoo::Api.get(Yahoo::Api::Shopping::CategoryRanking,{:category_id => "13457"})
|
15
|
+
res["ResultSet"]["totalResultsReturned"].times do |i|
|
16
|
+
p res["ResultSet"]["0"]["Result"]["#{i}"]["Code"]
|
17
|
+
end
|
18
|
+
|
19
|
+
# Category Search API v1
|
20
|
+
res = Yahoo::Api.get(Yahoo::Api::Shopping::CategorySearch,{:category_id => "1"})
|
21
|
+
res["ResultSet"]["0"]["Result"]["Categories"]["Children"].each do |i,v|
|
22
|
+
next unless i =~ /\d+/
|
23
|
+
p v["Id"]
|
24
|
+
end
|
25
|
+
|
26
|
+
# Item Lookup API v1
|
27
|
+
res = Yahoo::Api.get(Yahoo::Api::Shopping::ItemLookup,{:itemcode => "hair_haclm352nn"})
|
28
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
29
|
+
next unless i =~ /\d+/
|
30
|
+
p v["Name"]
|
31
|
+
end
|
32
|
+
|
33
|
+
# Query Ranking API v1
|
34
|
+
res = Yahoo::Api.get(Yahoo::Api::Shopping::QueryRanking,{:category_id => "13457"})
|
35
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
36
|
+
next unless i =~ /\d+/
|
37
|
+
p v["Url"]
|
38
|
+
end
|
39
|
+
|
40
|
+
# Content Match Item API v1
|
41
|
+
res = Yahoo::Api.get(Yahoo::Api::Shopping::ContentMatchItem,{:url => "http://www.yahoo.co.jp/"})
|
42
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
43
|
+
next unless i =~ /\d+/
|
44
|
+
p v["Name"]
|
45
|
+
end
|
46
|
+
|
47
|
+
# Content Match Ranking API v1
|
48
|
+
res = Yahoo::Api.get(Yahoo::Api::Shopping::ContentMatchRanking,{:url => "http://www.yahoo.co.jp/"})
|
49
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
50
|
+
next unless i =~ /\d+/
|
51
|
+
p v["Name"]
|
52
|
+
end
|
53
|
+
|
54
|
+
# Get Module API v1
|
55
|
+
res = Yahoo::Api.get(Yahoo::Api::Shopping::GetModule,{:category_id => "13457",:position => "eventrecommend"})
|
56
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
57
|
+
next unless i =~ /\d+/
|
58
|
+
p v["Title"]
|
59
|
+
end
|
60
|
+
|
61
|
+
# Event Search API v1
|
62
|
+
res = Yahoo::Api.get(Yahoo::Api::Shopping::EventSearch,{:event_type => "store"})
|
63
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
64
|
+
next unless i =~ /\d+/
|
65
|
+
p v["EventCode"]
|
66
|
+
end
|
67
|
+
|
68
|
+
# Review Search API v1
|
69
|
+
res = Yahoo::Api.get(Yahoo::Api::Shopping::ReviewSearch,{:category_id => "13457"})
|
70
|
+
res["ResultSet"]["Result"].each do |v|
|
71
|
+
p v["Target"]["Code"]
|
72
|
+
end
|
data/lib/yahoo/api.rb
CHANGED
data/lib/yahoo/api/auction.rb
CHANGED
@@ -4,6 +4,16 @@ module Yahoo
|
|
4
4
|
|
5
5
|
class Auction
|
6
6
|
|
7
|
+
CategoryTree = "Yahoo::Api::Auction.category_tree"
|
8
|
+
CategoryLeaf = "Yahoo::Api::Auction.category_leaf"
|
9
|
+
SellingList = "Yahoo::Api::Auction.selling_list"
|
10
|
+
Search = "Yahoo::Api::Auction.search"
|
11
|
+
Item = "Yahoo::Api::Auction.item"
|
12
|
+
BidHistory = "Yahoo::Api::Auction.bid_history"
|
13
|
+
BidHistoryDetail = "Yahoo::Api::Auction.bid_history_detail"
|
14
|
+
ShowQAndA = "Yahoo::Api::Auction.show_q_and_a"
|
15
|
+
ShowRating = "Yahoo::Api::Auction.show_rating"
|
16
|
+
|
7
17
|
class << self
|
8
18
|
|
9
19
|
# Yahoo Auction Category Tree API v2
|
data/lib/yahoo/api/shopping.rb
CHANGED
@@ -4,6 +4,17 @@ module Yahoo
|
|
4
4
|
|
5
5
|
class Shopping
|
6
6
|
|
7
|
+
ItemSearch = "Yahoo::Api::Shopping.item_search"
|
8
|
+
CategoryRanking = "Yahoo::Api::Shopping.category_ranking"
|
9
|
+
CategorySearch = "Yahoo::Api::Shopping.category_search"
|
10
|
+
ItemLookup = "Yahoo::Api::Shopping.item_lookup"
|
11
|
+
QueryRanking = "Yahoo::Api::Shopping.query_ranking"
|
12
|
+
ContentMatchItem = "Yahoo::Api::Shopping.content_match_item"
|
13
|
+
ContentMatchRanking = "Yahoo::Api::Shopping.content_match_ranking"
|
14
|
+
GetModule = "Yahoo::Api::Shopping.get_module"
|
15
|
+
EventSearch = "Yahoo::Api::Shopping.event_search"
|
16
|
+
ReviewSearch = "Yahoo::Api::Shopping.review_search"
|
17
|
+
|
7
18
|
class << self
|
8
19
|
|
9
20
|
# Yahoo Shopping Item Search API v1
|
data/lib/yahoo/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yahoo-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shoprev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,6 +92,9 @@ files:
|
|
92
92
|
- LICENSE.txt
|
93
93
|
- README.md
|
94
94
|
- Rakefile
|
95
|
+
- example/auction.rb
|
96
|
+
- example/helper.rb
|
97
|
+
- example/shopping.rb
|
95
98
|
- lib/yahoo/api.rb
|
96
99
|
- lib/yahoo/api/auction.rb
|
97
100
|
- lib/yahoo/api/request.rb
|