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)


5
6
7
# File 'lib/taobao/user.rb', line 5

def initialize(nickname)
  @nick = nickname
end

Instance Attribute Details

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

Returns:

  • (Integer)


15
16
17
# File 'lib/taobao/user.rb', line 15

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

#buyer_scoreInteger

Returns:

  • (Integer)


20
21
22
# File 'lib/taobao/user.rb', line 20

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

#cityString

Returns:

  • (String)


60
61
62
# File 'lib/taobao/user.rb', line 60

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

#good_purchases_countInteger

Returns:

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

Returns:

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

Returns:

  • (DateTime)


55
56
57
# File 'lib/taobao/user.rb', line 55

def last_visit
  DateTime.parse cached_response[:last_visit]
end

#registration_dateDateTime

Returns:

  • (DateTime)


50
51
52
# File 'lib/taobao/user.rb', line 50

def registration_date
  DateTime.parse cached_response[:created]
end

#seller_levelInteger

Returns:

  • (Integer)


35
36
37
# File 'lib/taobao/user.rb', line 35

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

#seller_scoreInteger

Returns:

  • (Integer)


40
41
42
# File 'lib/taobao/user.rb', line 40

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

#sexSymbol

Returns:

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

#stateString

Returns:

  • (String)


65
66
67
# File 'lib/taobao/user.rb', line 65

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

#total_purchases_countInteger

Returns:

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

Returns:

  • (Integer)


45
46
47
# File 'lib/taobao/user.rb', line 45

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

#typeString

Returns:

  • (String)


78
79
80
# File 'lib/taobao/user.rb', line 78

def type
  cached_response[:type]
end

#uidString

Returns:

  • (String)


83
84
85
# File 'lib/taobao/user.rb', line 83

def uid
  cached_response[:uid]
end