Class: DaFace::Twitter::User
- Inherits:
-
Object
- Object
- DaFace::Twitter::User
- Includes:
- Utilities
- Defined in:
- lib/da_face/twitter/user.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#favourites_count ⇒ Object
readonly
Returns the value of attribute favourites_count.
-
#followers_count ⇒ Object
readonly
Returns the value of attribute followers_count.
-
#friends_count ⇒ Object
readonly
Returns the value of attribute friends_count.
-
#geo_enabled ⇒ Object
readonly
Returns the value of attribute geo_enabled.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#lang ⇒ Object
readonly
Returns the value of attribute lang.
-
#listed_count ⇒ Object
readonly
Returns the value of attribute listed_count.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#profile_image_url ⇒ Object
readonly
Returns the value of attribute profile_image_url.
-
#profile_image_url_https ⇒ Object
readonly
Returns the value of attribute profile_image_url_https.
-
#protected ⇒ Object
readonly
Returns the value of attribute protected.
-
#screen_name ⇒ Object
readonly
Returns the value of attribute screen_name.
-
#statuses_count ⇒ Object
readonly
Returns the value of attribute statuses_count.
-
#verified ⇒ Object
readonly
Returns the value of attribute verified.
Instance Method Summary collapse
- #allowed_attributes ⇒ Object
- #favorites_count ⇒ Object
- #id_str ⇒ Object
-
#initialize(data = {}) ⇒ User
constructor
A new instance of User.
- #normalize_attributes! ⇒ Object
Methods included from Utilities
#parse_json, #parse_timestamp, #parse_uri, #symbolize_keys
Constructor Details
#initialize(data = {}) ⇒ User
Returns a new instance of User.
11 12 13 14 15 16 17 18 19 |
# File 'lib/da_face/twitter/user.rb', line 11 def initialize data={} self.allowed_attributes.each do |attr| unless data[attr].nil? self.instance_variable_set("@#{attr}", data[attr]) end end self.normalize_attributes! return self end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def created_at @created_at end |
#favourites_count ⇒ Object (readonly)
Returns the value of attribute favourites_count.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def favourites_count @favourites_count end |
#followers_count ⇒ Object (readonly)
Returns the value of attribute followers_count.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def followers_count @followers_count end |
#friends_count ⇒ Object (readonly)
Returns the value of attribute friends_count.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def friends_count @friends_count end |
#geo_enabled ⇒ Object (readonly)
Returns the value of attribute geo_enabled.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def geo_enabled @geo_enabled end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def id @id end |
#lang ⇒ Object (readonly)
Returns the value of attribute lang.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def lang @lang end |
#listed_count ⇒ Object (readonly)
Returns the value of attribute listed_count.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def listed_count @listed_count end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def name @name end |
#profile_image_url ⇒ Object (readonly)
Returns the value of attribute profile_image_url.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def profile_image_url @profile_image_url end |
#profile_image_url_https ⇒ Object (readonly)
Returns the value of attribute profile_image_url_https.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def profile_image_url_https @profile_image_url_https end |
#protected ⇒ Object (readonly)
Returns the value of attribute protected.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def protected @protected end |
#screen_name ⇒ Object (readonly)
Returns the value of attribute screen_name.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def screen_name @screen_name end |
#statuses_count ⇒ Object (readonly)
Returns the value of attribute statuses_count.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def statuses_count @statuses_count end |
#verified ⇒ Object (readonly)
Returns the value of attribute verified.
6 7 8 |
# File 'lib/da_face/twitter/user.rb', line 6 def verified @verified end |
Instance Method Details
#allowed_attributes ⇒ Object
21 22 23 24 25 |
# File 'lib/da_face/twitter/user.rb', line 21 def allowed_attributes [:id, :created_at, :favourites_count, :friends_count, :geo_enabled, :lang, :listed_count, :name, :profile_image_url, :profile_image_url_https, :screen_name, :statuses_count, :verified, :protected, :followers_count] end |
#favorites_count ⇒ Object
38 39 40 |
# File 'lib/da_face/twitter/user.rb', line 38 def favorites_count favourites_count end |
#id_str ⇒ Object
50 51 52 |
# File 'lib/da_face/twitter/user.rb', line 50 def id_str @id.to_s end |
#normalize_attributes! ⇒ Object
27 28 29 30 31 32 |
# File 'lib/da_face/twitter/user.rb', line 27 def normalize_attributes! @created_at = (@created_at) if @created_at @profile_image_url = parse_uri(@profile_image_url) if @profile_image_url @profile_image_url_https = parse_uri(@profile_image_url_https) if @profile_image_url_https @protected = false if @protected.nil? end |