class Taobao::User
Attributes
nick[R]
Public Class Methods
new(nickname)
click to toggle source
Retrive user info by nickname @param nickname [String]
# File lib/taobao/user.rb, line 5 def initialize(nickname) @nick = nickname end
Public Instance Methods
buyer_level()
click to toggle source
@return [Integer]
# File lib/taobao/user.rb, line 15 def buyer_level cached_response[:buyer_credit][:level].to_i end
buyer_score()
click to toggle source
@return [Integer]
# File lib/taobao/user.rb, line 20 def buyer_score cached_response[:buyer_credit][:score].to_i end
city()
click to toggle source
@return [String]
# File lib/taobao/user.rb, line 60 def city cached_response[:location][:city] end
good_purchases_count()
click to toggle source
@return [Integer]
# File lib/taobao/user.rb, line 10 def good_purchases_count cached_response[:buyer_credit][:good_num].to_i end
good_sales_count()
click to toggle source
@return [Integer]
# File lib/taobao/user.rb, line 30 def good_sales_count cached_response[:seller_credit][:good_num].to_i end
last_visit()
click to toggle source
@return [DateTime]
# File lib/taobao/user.rb, line 55 def last_visit DateTime.parse cached_response[:last_visit] end
registration_date()
click to toggle source
@return [DateTime]
# File lib/taobao/user.rb, line 50 def registration_date DateTime.parse cached_response[:created] end
seller_level()
click to toggle source
@return [Integer]
# File lib/taobao/user.rb, line 35 def seller_level cached_response[:seller_credit][:level].to_i end
seller_score()
click to toggle source
@return [Integer]
# File lib/taobao/user.rb, line 40 def seller_score cached_response[:seller_credit][:score].to_i end
sex()
click to toggle source
@return [Symbol]
# 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()
click to toggle source
@return [String]
# File lib/taobao/user.rb, line 65 def state cached_response[:location][:state] end
total_purchases_count()
click to toggle source
@return [Integer]
# File lib/taobao/user.rb, line 25 def total_purchases_count cached_response[:buyer_credit][:total_num].to_i end
total_sales_count()
click to toggle source
@return [Integer]
# File lib/taobao/user.rb, line 45 def total_sales_count cached_response[:seller_credit][:total_num].to_i end
type()
click to toggle source
@return [String]
# File lib/taobao/user.rb, line 78 def type cached_response[:type] end
uid()
click to toggle source
@return [String]
# File lib/taobao/user.rb, line 83 def uid cached_response[:uid] end
Private Instance Methods
cached_response()
click to toggle source
# File lib/taobao/user.rb, line 88 def cached_response @response ||= retrieve_response[:user_get_response][:user] end
retrieve_response()
click to toggle source
# File lib/taobao/user.rb, line 92 def retrieve_response fields = [:user_id, :uid, :nick, :sex, :buyer_credit, :seller_credit, :location, :created, :last_visit, :birthday, :type, :status, :alipay_no, :alipay_account, :alipay_account, :email, :consumer_protection, :alipay_bind].join ',' params = {method: 'taobao.user.get', fields: fields, nick: @nick} Taobao.api_request params end