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
-
#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
5 6 7 |
# File 'lib/taobao/user.rb', line 5 def initialize(nickname) @nick = nickname end |
Instance Attribute Details
#nick ⇒ Object (readonly)
Returns the value of attribute nick.
2 3 4 |
# File 'lib/taobao/user.rb', line 2 def nick @nick end |
Instance Method Details
#buyer_level ⇒ Integer
15 16 17 |
# File 'lib/taobao/user.rb', line 15 def buyer_level cached_response[:buyer_credit][:level].to_i end |
#buyer_score ⇒ Integer
20 21 22 |
# File 'lib/taobao/user.rb', line 20 def buyer_score cached_response[:buyer_credit][:score].to_i end |
#city ⇒ String
60 61 62 |
# File 'lib/taobao/user.rb', line 60 def city cached_response[:location][:city] end |
#good_purchases_count ⇒ Integer
10 11 12 |
# File 'lib/taobao/user.rb', line 10 def good_purchases_count cached_response[:buyer_credit][:good_num].to_i end |
#good_sales_count ⇒ Integer
30 31 32 |
# File 'lib/taobao/user.rb', line 30 def good_sales_count cached_response[:seller_credit][:good_num].to_i end |
#last_visit ⇒ DateTime
55 56 57 |
# File 'lib/taobao/user.rb', line 55 def last_visit DateTime.parse cached_response[:last_visit] end |
#registration_date ⇒ DateTime
50 51 52 |
# File 'lib/taobao/user.rb', line 50 def registration_date DateTime.parse cached_response[:created] end |
#seller_level ⇒ Integer
35 36 37 |
# File 'lib/taobao/user.rb', line 35 def seller_level cached_response[:seller_credit][:level].to_i end |
#seller_score ⇒ Integer
40 41 42 |
# File 'lib/taobao/user.rb', line 40 def seller_score cached_response[:seller_credit][:score].to_i end |
#sex ⇒ Symbol
70 71 72 73 74 75 |
# File 'lib/taobao/user.rb', line 70 def sex if !cached_response.has_key?(:sex) || cached_response[:sex].empty? return :unknown end cached_response[:sex] == 'm' ? :male : :female end |
#state ⇒ String
65 66 67 |
# File 'lib/taobao/user.rb', line 65 def state cached_response[:location][:state] end |
#total_purchases_count ⇒ Integer
25 26 27 |
# File 'lib/taobao/user.rb', line 25 def total_purchases_count cached_response[:buyer_credit][:total_num].to_i end |
#total_sales_count ⇒ Integer
45 46 47 |
# File 'lib/taobao/user.rb', line 45 def total_sales_count cached_response[:seller_credit][:total_num].to_i end |
#type ⇒ String
78 79 80 |
# File 'lib/taobao/user.rb', line 78 def type cached_response[:type] end |
#uid ⇒ String
83 84 85 |
# File 'lib/taobao/user.rb', line 83 def uid cached_response[:uid] end |