Class: DaFace::Twitter::User

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/da_face/twitter/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_atObject (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_countObject (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_countObject (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_countObject (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_enabledObject (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

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/da_face/twitter/user.rb', line 6

def id
  @id
end

#langObject (readonly)

Returns the value of attribute lang.



6
7
8
# File 'lib/da_face/twitter/user.rb', line 6

def lang
  @lang
end

#listed_countObject (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

#nameObject (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_urlObject (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_httpsObject (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

#protectedObject (readonly)

Returns the value of attribute protected.



6
7
8
# File 'lib/da_face/twitter/user.rb', line 6

def protected
  @protected
end

#screen_nameObject (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_countObject (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

#verifiedObject (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_attributesObject



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_countObject



38
39
40
# File 'lib/da_face/twitter/user.rb', line 38

def favorites_count
  favourites_count
end

#id_strObject



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 = parse_timestamp(@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