coneco 0.0.2 → 1.7.1

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.
@@ -2,3 +2,11 @@
2
2
 
3
3
  * 1 major enhancement:
4
4
  * Initial release
5
+
6
+ == 1.7.1 2008-10-03
7
+
8
+ * corresponding version 1.7.1
9
+ * coneco click affiliate
10
+ * get coneco club review infomation using product search
11
+ * bug fix
12
+
data/README.txt CHANGED
@@ -17,7 +17,9 @@ your own programs.
17
17
  c = Coneco::Client.new(apikey)
18
18
  c.find_categories
19
19
  c.find_products(nil, 'pc')
20
- c.get_reviews(1040908007)
20
+ c.find_products_option({:categoryId=>1011010})
21
+ c.find_reviews(1011010)
22
+ c.find_reviews_option({:com_id=>1070117050})
21
23
 
22
24
  == REQUIREMENTS:
23
25
 
@@ -16,8 +16,10 @@
16
16
  # * c = Coneco::Client.new(apikey)
17
17
  # * c.find_categories
18
18
  # * c.find_products(nil, 'pc')
19
- # * c.get_reviews(1040908007)
20
- #
19
+ # * c.find_products_option({:categoryId=>1011010})
20
+ # * c.find_reviews(1011010)
21
+ # * c.find_reviews_option({:com_id=>1070117050})
22
+ #
21
23
 
22
24
  $KCODE = 'u'
23
25
  require 'rubygems'
@@ -83,7 +85,7 @@ module Coneco
83
85
  include InitHelper
84
86
  attr_accessor :com_id, :name, :top_category, :middle_category, :category, :url, :image_url, :small_image_url,
85
87
  :lowest_price, :highest_price, :average_price, :seller_count, :ranking, :manufacturer, :brand, :release_date,
86
- :specifications, :description, :review,
88
+ :specifications, :description, :cone_click, :review, :user_review,
87
89
  :avg_ratings
88
90
  def initialize(h)
89
91
  populate(h)
@@ -91,7 +93,9 @@ module Coneco
91
93
  @middle_category = Category.new(@middle_category) if @middle_category
92
94
  @category = Category.new(@category) if @category
93
95
  @specifications.map! {|i| Specification.new(i) } if @specifications
96
+ @cone_click = ConeClick.new(@cone_click) if @cone_click
94
97
  @review = ReviewItem.new(@review) if @review
98
+ @user_review.map! {|i| ReviewItem.new(i) } if @user_review
95
99
  @avg_ratings = ReviewItem.new(@avg_ratings) if @avg_ratings
96
100
  end
97
101
  end
@@ -104,6 +108,14 @@ module Coneco
104
108
  end
105
109
  end
106
110
 
111
+ class ConeClick
112
+ include InitHelper
113
+ attr_accessor :click_bonus, :shop_bonus, :bonus_period
114
+ def initialize(h)
115
+ populate(h)
116
+ end
117
+ end
118
+
107
119
  class Review
108
120
  include InitHelper
109
121
  attr_accessor :item, :review
@@ -174,6 +186,7 @@ module Coneco
174
186
  # 商品検索APIを実行。引数に検索条件を指定して絞込みを行う。
175
187
  #
176
188
  def find_products(categoryId, comId=nil, keyword=nil, orFlag=nil, maker=nil, brand=nil, available=nil,
189
+ imageFlag=nil, coneClick=nil,
177
190
  highestPrice=nil, lowestPrice=nil, page=nil, count=nil, sort=nil)
178
191
  h = { :apikey => @key }
179
192
  h[:categoryId] = categoryId if categoryId
@@ -183,6 +196,8 @@ module Coneco
183
196
  h[:maker] = maker if maker
184
197
  h[:brand] = brand if brand
185
198
  h[:available] = available if available
199
+ h[:imageFlag] = imageFlag if imageFlag
200
+ h[:coneClick] = coneClick if coneClick
186
201
  h[:highestPrice] = highestPrice if highestPrice
187
202
  h[:lowestPrice] = lowestPrice if lowestPrice
188
203
  h[:page] = page if page
@@ -196,8 +211,8 @@ module Coneco
196
211
  #
197
212
  def find_reviews_option(option)
198
213
  option[:apikey] = @key
199
- s = get(FIND_REVIEWS_URL, h)
200
- Respose.new(s, parse_reviews(s))
214
+ s = get(FIND_REVIEWS_URL, option)
215
+ Response.new(s, parse_reviews(s))
201
216
  end
202
217
 
203
218
  # レビュー検索APIを実行。引数に検索条件を指定して絞り込みを行う。
@@ -1,8 +1,8 @@
1
1
  module Coneco
2
2
  module VERSION #:nodoc:
3
- MAJOR = 0
4
- MINOR = 0
5
- TINY = 2
3
+ MAJOR = 1
4
+ MINOR = 7
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -111,6 +111,14 @@ class TestConeco < Test::Unit::TestCase
111
111
  assert(p.image_url != 'http://www.coneco.net/images/noimg.gif')
112
112
  }
113
113
 
114
+ #coneClick flag
115
+ condition = {:categoryId=>'0', :coneClick=>'1'}
116
+ products = client.find_products_option(condition)
117
+ assert(products.header.success?)
118
+ products.body.each{|p|
119
+ assert(p.cone_click.click_bonus != '')
120
+ }
121
+
114
122
  #highprice
115
123
  conditions = {:categoryId=>'0',:highestPrice=>10000}
116
124
  products = client.find_products_option(conditions)
@@ -135,7 +143,7 @@ class TestConeco < Test::Unit::TestCase
135
143
  ## page, count
136
144
  products = client.find_products(1011010)
137
145
  assert(products.header.success?)
138
- products_s = client.find_products(1011010,nil,nil,nil,nil,nil,nil,nil,nil,3,10)
146
+ products_s = client.find_products(1011010,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,3,10)
139
147
  assert(products_s.header.success?)
140
148
  assert_equal(products_s.body.size , 10)
141
149
 
@@ -151,10 +159,29 @@ class TestConeco < Test::Unit::TestCase
151
159
 
152
160
  end
153
161
 
162
+ def test_product_review
163
+ client = Coneco::Client.new(API_KEY)
164
+
165
+ condition = {:comId=>1080120001}
166
+ products = client.find_products_option(condition)
167
+
168
+ assert products.header.success?
169
+ assert products.body.size != 0
170
+ products.body.each{|p|
171
+ p.user_review.each{|r|
172
+ assert r.description.length != 0
173
+ r.ratings.each{|s|
174
+ assert s.title.length !=0
175
+ }
176
+ }
177
+ }
178
+
179
+ end
180
+
154
181
  def testProductSort
155
182
  client = Coneco::Client.new(API_KEY)
156
183
  ## sort
157
- products = client.find_products(1011010,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,'ranking')
184
+ products = client.find_products(1011010,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,'ranking')
158
185
  assert_equal(products.body.size , 20)
159
186
  prev = 0
160
187
  products.body.each{ |c|
@@ -164,7 +191,7 @@ class TestConeco < Test::Unit::TestCase
164
191
  prev = c.ranking.to_i
165
192
  }
166
193
 
167
- products = client.find_products(0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,'ranking')
194
+ products = client.find_products(0,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,'ranking')
168
195
  pp products.body.size
169
196
  assert_equal(products.body.size , 20)
170
197
  prev = 0
@@ -174,25 +201,14 @@ class TestConeco < Test::Unit::TestCase
174
201
  assert( prev <= c.ranking.to_i)
175
202
  prev = c.ranking.to_i
176
203
  }
177
-
178
- #nvidia用パラメータ
179
- products = client.find_products(1507010,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,'maker')
180
- # pp products.body.size
181
- #assert_equal(products.body.size , 20)
182
- prev = 0
183
- products.body.each{ |c|
184
- #p c.com_id
185
- #r p c.manufacturer
186
- #assert( prev <= c.ranking.to_i)
187
- prev = c.ranking.to_i
188
- }
204
+
189
205
 
190
206
  end
191
207
 
192
208
  def testProductHash
193
209
  client = Coneco::Client.new(API_KEY)
194
210
  # hash test
195
- condition = {:comId => 1070117050, :specDetail => 1 }
211
+ condition = {:comId => 1070117050 }
196
212
  products = client.find_products_option(condition)
197
213
  assert(products.header.success?)
198
214
  products.body.each{|c|
@@ -244,6 +260,14 @@ class TestConeco < Test::Unit::TestCase
244
260
  assert(r.item.name =~ /core|2|duo/ )
245
261
  }
246
262
 
263
+ #hash
264
+ reviews = client.find_reviews_option({:categoryId=>1011010})
265
+ assert reviews.header.success?
266
+ reviews.body.each{|r|
267
+ assert r.item.name.length != 0
268
+ assert r.review.description.length != 0
269
+ }
270
+
247
271
  end
248
272
 
249
273
  end
@@ -33,19 +33,30 @@
33
33
  <h1>coneco</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/coneco"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/coneco" class="numbers">0.0.2</a>
36
+ <a href="http://rubyforge.org/projects/coneco" class="numbers">1.7.1</a>
37
37
  </div>
38
38
  <h2>What</h2>
39
- <p>pure Ruby Client for coneco.net Web Services</p>
39
+ <p>pure Ruby Client for <a href="http://apidoc.coneco.net/">coneco.net Web Services</a></p>
40
40
  <h2>Installing</h2>
41
41
  <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">coneco</span></pre></p>
42
42
  <h2>The basics</h2>
43
43
  <h2>Demonstration of usage</h2>
44
- apikey = &#8216;xxxx&#8217;<br>
44
+ apikey = &#8216;xxxx&#8217;
45
45
  c = Coneco::Client.new(apikey)<br>
46
46
  c.find_categories<br>
47
47
  c.find_products(nil, &#8217;pc&#8217;)<br>
48
- c.get_reviews(1040908007)<br>
48
+ apikey = &#8216;xxxx&#8217;<br>
49
+ c = Coneco::Client.new(apikey)<br>
50
+ #category search api<br>
51
+ c.find_categories<br>
52
+ #product search api
53
+ products = c.find_products_option({:categoryId=&gt;1011010})<br>
54
+ products.body.each{|p|
55
+ pp p.name
56
+ }
57
+ #review search api
58
+ c.find_reviews(1011010)<br>
59
+ c.find_reviews_option({:com_id=&gt;1070117050})<br>
49
60
  <p>you must get apikey for coneco.net webservices at <a href="https://www.coneco.net/api/">here</a></p>
50
61
  <h2>Forum</h2>
51
62
  <p><a href="http://groups.google.com/group/ruby-coneco">http://groups.google.com/group/ruby-coneco</a></p>
@@ -64,12 +75,19 @@ rake install_gem</pre>
64
75
  <h2>Contact</h2>
65
76
  <p>Comments are welcome. Send an email to ruby-coneco at googlearoups dot com email via the <a href="http://groups.google.com/group/ruby-coneco">forum</a></p>
66
77
  <p class="coda">
67
- <a href="FIXME email">FIXME full name</a>, 24th September 2008<br>
78
+ <a href="kilynn at gmail dot com">kilynn</a>, 3rd October 2008<br>
68
79
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
69
80
  </p>
70
81
  </div>
71
82
 
72
- <!-- insert site tracking codes here, like Google Urchin -->
83
+ <script type="text/javascript">
84
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
85
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
86
+ </script>
87
+ <script type="text/javascript">
88
+ var pageTracker = _gat._getTracker("UA-769168-2");
89
+ pageTracker._trackPageview();
90
+ </script>
73
91
 
74
92
  </body>
75
93
  </html>
@@ -2,7 +2,7 @@ h1. coneco
2
2
 
3
3
  h2. What
4
4
 
5
- pure Ruby Client for coneco.net Web Services
5
+ pure Ruby Client for "coneco.net Web Services":http://apidoc.coneco.net/
6
6
 
7
7
  h2. Installing
8
8
 
@@ -13,11 +13,26 @@ h2. The basics
13
13
 
14
14
  h2. Demonstration of usage
15
15
 
16
- apikey = 'xxxx'<br>
16
+ apikey = 'xxxx'
17
17
  c = Coneco::Client.new(apikey)<br>
18
18
  c.find_categories<br>
19
19
  c.find_products(nil, 'pc')<br>
20
- c.get_reviews(1040908007)<br>
20
+
21
+ apikey = 'xxxx'<br>
22
+ c = Coneco::Client.new(apikey)<br>
23
+
24
+ #category search api<br>
25
+ c.find_categories<br>
26
+
27
+ #product search api
28
+ products = c.find_products_option({:categoryId=>1011010})<br>
29
+ products.body.each{|p|
30
+ pp p.name
31
+ }
32
+
33
+ #review search api
34
+ c.find_reviews(1011010)<br>
35
+ c.find_reviews_option({:com_id=>1070117050})<br>
21
36
 
22
37
  <p>you must get apikey for coneco.net webservices at "here":https://www.coneco.net/api/</p>
23
38
 
@@ -37,12 +37,19 @@
37
37
  </div>
38
38
  <%= body %>
39
39
  <p class="coda">
40
- <a href="FIXME email">FIXME full name</a>, <%= modified.pretty %><br>
40
+ <a href="kilynn at gmail dot com">kilynn</a>, <%= modified.pretty %><br>
41
41
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
42
42
  </p>
43
43
  </div>
44
44
 
45
- <!-- insert site tracking codes here, like Google Urchin -->
45
+ <script type="text/javascript">
46
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
47
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
48
+ </script>
49
+ <script type="text/javascript">
50
+ var pageTracker = _gat._getTracker("UA-769168-2");
51
+ pageTracker._trackPageview();
52
+ </script>
46
53
 
47
54
  </body>
48
55
  </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coneco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kilynn
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-24 00:00:00 +09:00
12
+ date: 2008-10-03 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency