yahoo-api 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +84 -30
- data/lib/yahoo/api.rb +2 -1
- data/lib/yahoo/api/request.rb +1 -1
- data/lib/yahoo/api/response.rb +1 -1
- data/lib/yahoo/api/shopping.rb +1 -1
- data/lib/yahoo/api/version.rb +2 -2
- data/test.rb +68 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7ecfc2b6df75048e6cbc30ee85783f2b0ebaef2
|
4
|
+
data.tar.gz: a439d5d50a0996131cbb8602483a94eae7284ac8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64f9f8db9ab1a6794c00c637bbe550f471cced5a4f3e4be59fdcf603ae8435f5c7da36b3e1bc13995e5136668e26a2460791f86494e74d10492192402c73ee47
|
7
|
+
data.tar.gz: 8e7d698f9f1dfeba0cfbe62aaa84f9a6896f009775b5989fb2b54b77c2e18269db53f6e2b83669d01c835220a77679e86f06e06e5c1f7f5d64d0f9f53f534534
|
data/README.md
CHANGED
@@ -19,58 +19,112 @@ Or install it yourself as:
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
+
### Configure
|
23
|
+
|
24
|
+
Yahoo::Api.configure do |options|
|
25
|
+
options[:appid] = 'your api id'
|
26
|
+
options[:affiliate_type] = "vc or yid"
|
27
|
+
options[:affiliate_id] = "your affiliate id"
|
28
|
+
end
|
29
|
+
|
22
30
|
### Yahoo Shopping API
|
23
31
|
|
24
|
-
|
32
|
+
Item Search API v1
|
25
33
|
|
26
|
-
res = Yahoo::Api::Shopping.item_search({:category_id => 13457})
|
34
|
+
res = Yahoo::Api::Shopping.item_search({:category_id => "13457"})
|
27
35
|
res.code # 200
|
28
36
|
res.message # "OK"
|
29
|
-
res["ResultSet"]["totalResultsReturned"].times
|
30
37
|
|
31
|
-
|
32
|
-
|
33
|
-
|
38
|
+
res["ResultSet"]["totalResultsReturned"].times do |i|
|
39
|
+
code = res["ResultSet"]["0"]["Result"]["#{i}"]["Code"]
|
40
|
+
...
|
34
41
|
end
|
35
42
|
|
36
|
-
|
37
|
-
|
38
|
-
|
43
|
+
or
|
44
|
+
|
45
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
46
|
+
next unless i =~ /\d+/
|
47
|
+
code = v["Code"]
|
48
|
+
...
|
39
49
|
end
|
40
50
|
|
41
|
-
|
42
|
-
|
43
|
-
|
51
|
+
Category Ranking API v1
|
52
|
+
|
53
|
+
res = Yahoo::Api::Shopping.category_ranking({:category_id => "13457"})
|
54
|
+
res["ResultSet"]["totalResultsReturned"].times do |i|
|
55
|
+
code = res["ResultSet"]["0"]["Result"]["#{i}"]["Code"]
|
56
|
+
...
|
44
57
|
end
|
45
58
|
|
46
|
-
|
47
|
-
|
48
|
-
|
59
|
+
Category Search API v1
|
60
|
+
|
61
|
+
res = Yahoo::Api::Shopping.category_search({:category_id => "1"})
|
62
|
+
res["ResultSet"]["0"]["Result"]["Categories"]["Children"].each do |i,v|
|
63
|
+
next unless i =~ /\d+/
|
64
|
+
id = v["Id"]
|
65
|
+
...
|
49
66
|
end
|
50
67
|
|
51
|
-
|
52
|
-
|
53
|
-
|
68
|
+
Item Lookup API v1
|
69
|
+
|
70
|
+
res = Yahoo::Api::Shopping.item_lookup({:itemcode => "hair_haclm352nn"})
|
71
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
72
|
+
next unless i =~ /\d+/
|
73
|
+
name = v["Name"]
|
74
|
+
...
|
54
75
|
end
|
55
76
|
|
56
|
-
|
57
|
-
|
58
|
-
|
77
|
+
Query Ranking API v1
|
78
|
+
|
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
|
+
...
|
59
84
|
end
|
60
85
|
|
61
|
-
|
62
|
-
|
63
|
-
|
86
|
+
Content Match Item API v1
|
87
|
+
|
88
|
+
res = Yahoo::Api::Shopping.content_match_item({:url => "http://www.yahoo.co.jp/"})
|
89
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
90
|
+
next unless i =~ /\d+/
|
91
|
+
name = v["Name"]
|
92
|
+
...
|
64
93
|
end
|
65
94
|
|
66
|
-
|
67
|
-
|
68
|
-
|
95
|
+
Content Match Ranking API v1
|
96
|
+
|
97
|
+
res = Yahoo::Api::Shopping.content_match_ranking({:url => "http://www.yahoo.co.jp/"})
|
98
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
99
|
+
next unless i =~ /\d+/
|
100
|
+
name = v["Name"]
|
101
|
+
...
|
102
|
+
end
|
103
|
+
|
104
|
+
Get Module API v1
|
105
|
+
|
106
|
+
res = Yahoo::Api::Shopping.get_module({:category_id => "13457",:position => "eventrecommend"})
|
107
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
108
|
+
next unless i =~ /\d+/
|
109
|
+
title = v["Title"]
|
110
|
+
...
|
69
111
|
end
|
70
112
|
|
71
|
-
|
72
|
-
|
73
|
-
|
113
|
+
Event Search API v1
|
114
|
+
|
115
|
+
res = Yahoo::Api::Shopping.event_search({:event_type => "store"})
|
116
|
+
res["ResultSet"]["0"]["Result"].each do |i,v|
|
117
|
+
next unless i =~ /\d+/
|
118
|
+
code = v["EventCode"]
|
119
|
+
...
|
120
|
+
end
|
121
|
+
|
122
|
+
Review Search API v1
|
123
|
+
|
124
|
+
res = Yahoo::Api::Shopping.review_search({:category_id => "13457"})
|
125
|
+
res["ResultSet"]["Result"].each do |v|
|
126
|
+
code = v["Target"]["Code"]
|
127
|
+
...
|
74
128
|
end
|
75
129
|
|
76
130
|
### Yahoo Auction API
|
data/lib/yahoo/api.rb
CHANGED
data/lib/yahoo/api/request.rb
CHANGED
@@ -3,7 +3,7 @@ module Yahoo
|
|
3
3
|
class Request
|
4
4
|
|
5
5
|
def self.get(path,opts)
|
6
|
-
uri = URI.parse("#{path}?#{opts.map {|k,v|"#{k}=#{
|
6
|
+
uri = URI.parse("#{path}?#{opts.map {|k,v|"#{k}=#{CGI.escape(v)}"}.join('&')}")
|
7
7
|
Yahoo::Response.new(Net::HTTP.get_response(uri))
|
8
8
|
end
|
9
9
|
|
data/lib/yahoo/api/response.rb
CHANGED
data/lib/yahoo/api/shopping.rb
CHANGED
data/lib/yahoo/api/version.rb
CHANGED
data/test.rb
CHANGED
@@ -1,5 +1,69 @@
|
|
1
1
|
require "yahoo/api"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
Yahoo::Api.configure do |options|
|
3
|
+
options[:appid] = 'dj0zaiZpPVBzbEY1RWlSNVd2biZzPWNvbnN1bWVyc2VjcmV0Jng9MTU-'
|
4
|
+
end
|
5
|
+
|
6
|
+
# http://shopping.yahooapis.jp/ShoppingWebService/V1/json/reviewSearch?appid=dj0zaiZpPVBzbEY1RWlSNVd2biZzPWNvbnN1bWVyc2VjcmV0Jng9MTU-&category_id=13457
|
7
|
+
res = Yahoo::Api::Shopping.review_search({:category_id => "13457"})
|
8
|
+
# p res["ResultSet"]["Result"][]
|
9
|
+
res["ResultSet"]["Result"].each do |v|
|
10
|
+
# next unless i =~ /\d+/
|
11
|
+
p code = v["Target"]["Code"]
|
12
|
+
end
|
13
|
+
# res = Yahoo::Api::Shopping.event_search({:event_type => "store"})
|
14
|
+
# res["ResultSet"]["0"]["Result"].each do |i,v|
|
15
|
+
# next unless i =~ /\d+/
|
16
|
+
# p code = v["EventCode"]
|
17
|
+
# end
|
18
|
+
# res = Yahoo::Api::Shopping.get_module({:category_id => "13457",:position => "eventrecommend"})
|
19
|
+
# res["ResultSet"]["0"]["Result"].each do |i,v|
|
20
|
+
# next unless i =~ /\d+/
|
21
|
+
# p title = v["Title"]
|
22
|
+
# end
|
23
|
+
|
24
|
+
# res = Yahoo::Api::Shopping.content_match_ranking({:url => "http://www.yahoo.co.jp/"})
|
25
|
+
# res["ResultSet"]["0"]["Result"].each do |i,v|
|
26
|
+
# next unless i =~ /\d+/
|
27
|
+
# p name = v["Name"]
|
28
|
+
# end
|
29
|
+
# res = Yahoo::Api::Shopping.content_match_item({:url => "http://www.yahoo.co.jp/"})
|
30
|
+
# res["ResultSet"]["0"]["Result"].each do |i,v|
|
31
|
+
# next unless i =~ /\d+/
|
32
|
+
# p name = v["Name"]
|
33
|
+
# end
|
34
|
+
# res = Yahoo::Api::Shopping.query_ranking({:category_id => "13457"})
|
35
|
+
# res["ResultSet"]["0"]["Result"].each do |i,v|
|
36
|
+
# next unless i =~ /\d+/
|
37
|
+
# p url = v["Url"]
|
38
|
+
# end
|
39
|
+
# res = Yahoo::Api::Shopping.item_lookup({:itemcode => "hair_haclm352nn"})
|
40
|
+
# res["ResultSet"]["0"]["Result"].each do |i,v|
|
41
|
+
# next unless i =~ /\d+/
|
42
|
+
# p name = v["Name"]
|
43
|
+
# end
|
44
|
+
# res = Yahoo::Api::Shopping.category_search({:category_id => "1"})
|
45
|
+
# res["ResultSet"]["0"]["Result"]["Categories"]["Children"].each do |k,v|
|
46
|
+
# p id = v["Id"]
|
47
|
+
# next if id.nil?
|
48
|
+
# end
|
49
|
+
# # 0.times{|i| p i}
|
50
|
+
|
51
|
+
# res = Yahoo::Api::Shopping.category_ranking({:category_id => "13457"})
|
52
|
+
# res.code # 200
|
53
|
+
# res.message # "OK"
|
54
|
+
# res["ResultSet"]["0"]["Result"].each do |i,v|
|
55
|
+
# next unless i =~ /\d+/
|
56
|
+
# p v["Code"]
|
57
|
+
# end
|
58
|
+
# res["ResultSet"]["totalResultsReturned"].times do |i|
|
59
|
+
# p res["ResultSet"]["0"]["Result"]["#{i}"]["Code"]
|
60
|
+
# end
|
61
|
+
|
62
|
+
|
63
|
+
# res = Yahoo::Api::Shopping.item_search({:category_id => "13457"})
|
64
|
+
# p res.code # 200
|
65
|
+
# p res.message # "OK"
|
66
|
+
# res["ResultSet"]["totalResultsReturned"].times do |i|
|
67
|
+
# p res["ResultSet"]["0"]["Result"]["#{i}"]["Code"]
|
68
|
+
# end
|
69
|
+
|