Class: Taobao::User
- Inherits:
-
Object
- Object
- Taobao::User
- Defined in:
- lib/taobao/user.rb
Instance Attribute Summary collapse
-
#nick ⇒ Object
readonly
Returns the value of attribute nick.
Instance Method Summary collapse
- #buyer_level ⇒ Integer
- #buyer_score ⇒ Integer
- #city ⇒ String
- #good_purchases_count ⇒ Integer
- #good_sales_count ⇒ Integer
- #id ⇒ Integer
-
#initialize(nickname) ⇒ User
constructor
Retrive user info by nickname.
- #last_visit ⇒ DateTime
- #registration_date ⇒ DateTime
- #seller_level ⇒ Integer
- #seller_score ⇒ Integer
- #sex ⇒ Symbol
- #state ⇒ String
- #total_purchases_count ⇒ Integer
- #total_sales_count ⇒ Integer
- #type ⇒ String
- #uid ⇒ String
Constructor Details
#initialize(nickname) ⇒ User
Retrive user info by nickname
7 8 9 |
# File 'lib/taobao/user.rb', line 7 def initialize(nickname) @nick = nickname end |
Instance Attribute Details
#nick ⇒ Object (readonly)
Returns the value of attribute nick.
4 5 6 |
# File 'lib/taobao/user.rb', line 4 def nick @nick end |
Instance Method Details
#buyer_level ⇒ Integer
17 18 19 |
# File 'lib/taobao/user.rb', line 17 def buyer_level cached_response[:buyer_credit][:level].to_i end |
#buyer_score ⇒ Integer
22 23 24 |
# File 'lib/taobao/user.rb', line 22 def buyer_score cached_response[:buyer_credit][:score].to_i end |
#city ⇒ String
62 63 64 |
# File 'lib/taobao/user.rb', line 62 def city cached_response[:location][:city] end |
#good_purchases_count ⇒ Integer
12 13 14 |
# File 'lib/taobao/user.rb', line 12 def good_purchases_count cached_response[:buyer_credit][:good_num].to_i end |
#good_sales_count ⇒ Integer
32 33 34 |
# File 'lib/taobao/user.rb', line 32 def good_sales_count cached_response[:seller_credit][:good_num].to_i end |
#id ⇒ Integer
91 92 93 |
# File 'lib/taobao/user.rb', line 91 def id cached_response[:user_id].to_i end |
#last_visit ⇒ DateTime
57 58 59 |
# File 'lib/taobao/user.rb', line 57 def last_visit DateTime.parse cached_response[:last_visit] end |
#registration_date ⇒ DateTime
52 53 54 |
# File 'lib/taobao/user.rb', line 52 def registration_date DateTime.parse cached_response[:created] end |
#seller_level ⇒ Integer
37 38 39 |
# File 'lib/taobao/user.rb', line 37 def seller_level cached_response[:seller_credit][:level].to_i end |
#seller_score ⇒ Integer
42 43 44 |
# File 'lib/taobao/user.rb', line 42 def seller_score cached_response[:seller_credit][:score].to_i end |
#sex ⇒ Symbol
72 73 74 75 76 77 78 |
# File 'lib/taobao/user.rb', line 72 def sex if cached_response.has_key? :sex return :male if cached_response[:sex] == 'm' return :female if cached_response[:sex] == 'f' end :unknown end |
#state ⇒ String
67 68 69 |
# File 'lib/taobao/user.rb', line 67 def state cached_response[:location][:state] end |
#total_purchases_count ⇒ Integer
27 28 29 |
# File 'lib/taobao/user.rb', line 27 def total_purchases_count cached_response[:buyer_credit][:total_num].to_i end |
#total_sales_count ⇒ Integer
47 48 49 |
# File 'lib/taobao/user.rb', line 47 def total_sales_count cached_response[:seller_credit][:total_num].to_i end |
#type ⇒ String
81 82 83 |
# File 'lib/taobao/user.rb', line 81 def type cached_response[:type] end |
#uid ⇒ String
86 87 88 |
# File 'lib/taobao/user.rb', line 86 def uid cached_response[:uid] end |