top4r 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,7 @@ class Top4R::Client
9
9
  params = {:fields => Top4R::Item.fields}.merge(options)
10
10
  response = http_connect {|conn| create_http_get_request(@@ITEM_METHODS[method], params)}
11
11
  result = JSON.parse(response.body)[rsp(@@ITEM_METHODS[method])]
12
- if result['items']
12
+ if result.is_a?(Hash) and result['items']
13
13
  items = Top4R::Item.unmarshal(result["items"]["item"])
14
14
  items.each {|item| bless_model(item); yield item if block_given?}
15
15
  @total_results = result["total_results"].to_i
@@ -16,7 +16,7 @@ class Top4R::Client
16
16
  params = {:fields => Top4R::Area.fields}.merge(options)
17
17
  response = http_connect {|conn| create_http_get_request(@@AREA_METHODS[method], params)}
18
18
  result = JSON.parse(response.body)[rsp(@@AREA_METHODS[method])]
19
- if result["areas"]
19
+ if result.is_a?(Hash) and result["areas"]
20
20
  areas = Top4R::Area.unmarshal(result["areas"]["area"])
21
21
  areas.each {|area| bless_model(area); yield area if block_given?}
22
22
  else
@@ -30,7 +30,7 @@ class Top4R::Client
30
30
  params = {:fields => Top4R::LogisticCompany.fields}.merge(options)
31
31
  response = http_connect {|conn| create_http_get_request(@@LOGISTIC_COMPANY_METHODS[method], params)}
32
32
  result = JSON.parse(response.body)[rsp(@@LOGISTIC_COMPANY_METHODS[method])]
33
- if result["logistics_companies"]
33
+ if result.is_a?(Hash) and result["logistics_companies"]
34
34
  logistic_companies = Top4R::LogisticCompany.unmarshal(result["logistics_companies"]["logistics_company"])
35
35
  logistic_companies.each {|logistic_company| bless_model(logistic_company); yield logistic_company if block_given?}
36
36
  else
@@ -10,7 +10,7 @@ class Top4R::Client
10
10
  params = options.merge(:nick => u)
11
11
  response = http_connect {|conn| create_http_get_request(@@SHOP_METHODS[method], params)}
12
12
  result = JSON.parse(response.body)[rsp(@@SHOP_METHODS[method])]
13
- if result["seller_cats"]
13
+ if result.is_a?(Hash) and result["seller_cats"]
14
14
  seller_cats = Top4R::SellerCat.unmarshal(result["seller_cats"]["seller_cat"])
15
15
  seller_cats.each {|cat| bless_model(cat); yield cat if block_given?}
16
16
  else
@@ -15,7 +15,7 @@ class Top4R::Client
15
15
  :uri => @@SUITE_METHODS[method])
16
16
  end
17
17
  result = JSON.parse(response.body)[rsp(@@SUITE_METHODS[method])]
18
- if result["suites"]
18
+ if result.is_a?(Hash) and result["suites"]
19
19
  suites = Top4R::Suite.unmarshal(result["suites"]["suite"])
20
20
  suites.each {|suite| bless_model(suite); yield suite if block_given?}
21
21
  @total_results = result["total_results"].to_i
@@ -9,7 +9,7 @@ class Top4R::Client
9
9
  params = {:fields => Top4R::TaobaokeItem.fields, :v => "2.0"}.merge(options)
10
10
  response = http_connect {|conn| create_http_get_request(@@TAOBAOKEITEM_METHODS[method], params)}
11
11
  result = JSON.parse(response.body)[rsp(@@TAOBAOKEITEM_METHODS[method])]
12
- if result["taobaoke_items"]
12
+ if result.is_a?(Hash) and result["taobaoke_items"]
13
13
  items = Top4R::TaobaokeItem.unmarshal(result["taobaoke_items"]["taobaoke_item"])
14
14
  items.each {|item| bless_model(item); yield item if block_given?}
15
15
  @total_results = result["total_results"].to_i
@@ -20,7 +20,7 @@ class Top4R::Client
20
20
  end
21
21
  response = http_connect {|conn| create_http_get_request(@@TRADE_METHODS[method], params)}
22
22
  result = JSON.parse(response.body)[rsp(@@TRADE_METHODS[method])]
23
- if result["trades"]
23
+ if result.is_a?(Hash) and result["trades"]
24
24
  trades = Top4R::Trade.unmarshal(result["trades"]["trade"])
25
25
  trades.each {|trade| bless_model(trade); yield trade if block_given?}
26
26
  @total_results = result["total_results"].to_i
data/lib/top4r/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Top4R::Version
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- REVISION = 0
4
+ REVISION = 1
5
5
 
6
6
  class << self
7
7
  # Returns X.Y.Z formatted version string
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: top4r
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nowa Zhu
@@ -15,7 +15,7 @@ autorequire: top4r
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-25 00:00:00 +08:00
18
+ date: 2010-09-26 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency