Class: TwitterAuth::GenericUser
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- TwitterAuth::GenericUser
show all
- Includes:
- BasicUser, OauthUser
- Defined in:
- app/models/twitter_auth/generic_user.rb
Constant Summary
collapse
[
:name,
:location,
:description,
:profile_image_url,
:url,
:protected,
:profile_background_color,
:profile_sidebar_fill_color,
:profile_link_color,
:profile_sidebar_border_color,
:profile_text_color,
:profile_background_image_url,
:profile_background_tile,
:friends_count,
:statuses_count,
:followers_count,
:favourites_count,
:time_zone,
:utc_offset
]
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from BasicUser
included, #password, #password=
Methods included from OauthUser
included, #token
Class Method Details
.from_remember_token(token) ⇒ Object
54
55
56
|
# File 'app/models/twitter_auth/generic_user.rb', line 54
def self.from_remember_token(token)
first(:conditions => ["remember_token = ? AND remember_token_expires_at > ?", token, Time.now])
end
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'app/models/twitter_auth/generic_user.rb', line 38
def self.(hash)
raise ArgumentError, 'Invalid hash: must include screen_name.' unless hash.key?('screen_name')
raise ArgumentError, 'Invalid hash: must include id.' unless hash.key?('id')
user = User.new
user. = hash['id'].to_s
user.login = hash['screen_name']
TWITTER_ATTRIBUTES.each do |att|
user.send("#{att}=", hash[att.to_s]) if user.respond_to?("#{att}=")
end
user
end
|
.table_name ⇒ Object
36
|
# File 'app/models/twitter_auth/generic_user.rb', line 36
def self.table_name; 'users' end
|
Instance Method Details
58
59
60
61
62
|
# File 'app/models/twitter_auth/generic_user.rb', line 58
def (hash)
TWITTER_ATTRIBUTES.each do |att|
send("#{att}=", hash[att.to_s]) if respond_to?("#{att}=")
end
end
|
#forget_me ⇒ Object
98
99
100
101
|
# File 'app/models/twitter_auth/generic_user.rb', line 98
def forget_me
self.remember_token = self.remember_token_expires_at = nil
self.save
end
|
#remember_me ⇒ Object
87
88
89
90
91
92
93
94
95
96
|
# File 'app/models/twitter_auth/generic_user.rb', line 87
def remember_me
return false unless respond_to?(:remember_token)
self.remember_token = ActiveSupport::SecureRandom.hex(10)
self.remember_token_expires_at = Time.now + TwitterAuth.remember_for.days
save
{:value => self.remember_token, :expires => self.remember_token_expires_at}
end
|
64
65
66
67
|
# File 'app/models/twitter_auth/generic_user.rb', line 64
def (hash)
(hash)
save
end
|
#utilize_default_validations ⇒ Object
75
76
77
|
# File 'app/models/twitter_auth/generic_user.rb', line 75
def utilize_default_validations
true
end
|