Class: Taobao::User

Inherits:
Object
  • Object
show all
Defined in:
lib/taobao/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nickname) ⇒ User

Retrive user info by nickname

Parameters:

  • nickname (String)


7
8
9
# File 'lib/taobao/user.rb', line 7

def initialize(nickname)
  @nick = nickname
end

Instance Attribute Details

#nickObject (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_levelInteger

Returns:

  • (Integer)


17
18
19
# File 'lib/taobao/user.rb', line 17

def buyer_level
  cached_response[:buyer_credit][:level].to_i
end

#buyer_scoreInteger

Returns:

  • (Integer)


22
23
24
# File 'lib/taobao/user.rb', line 22

def buyer_score
  cached_response[:buyer_credit][:score].to_i
end

#cityString

Returns:

  • (String)


62
63
64
# File 'lib/taobao/user.rb', line 62

def city
  cached_response[:location][:city]
end

#good_purchases_countInteger

Returns:

  • (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_countInteger

Returns:

  • (Integer)


32
33
34
# File 'lib/taobao/user.rb', line 32

def good_sales_count
  cached_response[:seller_credit][:good_num].to_i
end

#idInteger

Returns:

  • (Integer)


91
92
93
# File 'lib/taobao/user.rb', line 91

def id
  cached_response[:user_id].to_i
end

#last_visitDateTime

Returns:

  • (DateTime)


57
58
59
# File 'lib/taobao/user.rb', line 57

def last_visit
  DateTime.parse cached_response[:last_visit]
end

#registration_dateDateTime

Returns:

  • (DateTime)


52
53
54
# File 'lib/taobao/user.rb', line 52

def registration_date
  DateTime.parse cached_response[:created]
end

#seller_levelInteger

Returns:

  • (Integer)


37
38
39
# File 'lib/taobao/user.rb', line 37

def seller_level
  cached_response[:seller_credit][:level].to_i
end

#seller_scoreInteger

Returns:

  • (Integer)


42
43
44
# File 'lib/taobao/user.rb', line 42

def seller_score
  cached_response[:seller_credit][:score].to_i
end

#sexSymbol

Returns:

  • (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

#stateString

Returns:

  • (String)


67
68
69
# File 'lib/taobao/user.rb', line 67

def state
  cached_response[:location][:state]
end

#total_purchases_countInteger

Returns:

  • (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_countInteger

Returns:

  • (Integer)


47
48
49
# File 'lib/taobao/user.rb', line 47

def total_sales_count
  cached_response[:seller_credit][:total_num].to_i
end

#typeString

Returns:

  • (String)


81
82
83
# File 'lib/taobao/user.rb', line 81

def type
  cached_response[:type]
end

#uidString

Returns:

  • (String)


86
87
88
# File 'lib/taobao/user.rb', line 86

def uid
  cached_response[:uid]
end