top4r 0.1.7 → 0.1.8

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.
@@ -22,4 +22,20 @@ class Top4R::Client
22
22
  end
23
23
  items
24
24
  end
25
+
26
+ def taobaoke_shops(method = :taobaoke_shops_convert, options = {}, &block)
27
+ valid_method(method, @@TAOBAOKEITEM_METHODS, :taobaoke_item)
28
+ params = {:fields => Top4R::TaobaokeItem.fields, :v => "2.0"}.merge(options)
29
+ response = http_connect {|conn| create_http_get_request(@@TAOBAOKEITEM_METHODS[method], params)}
30
+ result = JSON.parse(response.body)[rsp(@@TAOBAOKEITEM_METHODS[method])]
31
+ if result.is_a?(Hash) and result["taobaoke_shops"]
32
+ items = Top4R::TaobaokeShop.unmarshal(result["taobaoke_shops"]["taobaoke_shop"])
33
+ items.each {|item| bless_model(item); yield item if block_given?}
34
+ @total_results = result["total_results"].to_i
35
+ else
36
+ @total_results = 0
37
+ items = []
38
+ end
39
+ items
40
+ end
25
41
  end
@@ -1,6 +1,27 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Top4R
3
3
 
4
+ # TaobaokeShop Model
5
+ class TaobaokeShop
6
+ include ModelMixin
7
+ @@ATTRIBUTES = [:user_id, :shop_title, :click_url, :commission_rate, :seller_credit, :shop_type, :total_auction, :auction_count]
8
+ attr_accessor *@@ATTRIBUTES
9
+
10
+ class << self
11
+ def attributes; @@ATTRIBUTES; end
12
+
13
+ def default_public_fields
14
+ ["user_id", "shop_title", "click_url", "commission_rate"]
15
+ end
16
+ end
17
+
18
+ def unmarshal_other_attrs
19
+ @id = @user_id
20
+
21
+ self
22
+ end
23
+ end
24
+
4
25
  # TaobaokeItem Model
5
26
  class TaobaokeItem
6
27
  include ModelMixin
@@ -2,7 +2,7 @@
2
2
  module Top4R::Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- REVISION = 7
5
+ REVISION = 8
6
6
 
7
7
  class << self
8
8
  # Returns X.Y.Z formatted version string
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: top4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &2153250460 !ruby/object:Gem::Requirement
16
+ requirement: &2153222240 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 1.1.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153250460
24
+ version_requirements: *2153222240
25
25
  description:
26
26
  email: nowazhu@gmail.com
27
27
  executables: