Class: FbGraph::User

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Searchable

search, search

Methods included from Connections::Videos

#videos

Methods included from Connections::Threads

#threads

Methods included from Connections::Television

#television

Methods included from Connections::Tagged

#tagged

Methods included from Connections::Statuses

#statuses

Methods included from Connections::Posts

#posts

Methods included from Connections::Picture

#picture

Methods included from Connections::Photos

#photo!, #photos

Methods included from Connections::Notes

#note!, #notes

Methods included from Connections::Music

#music

Methods included from Connections::Movies

#movies

Methods included from Connections::Links

#link!, #links

Methods included from Connections::Likes

#likes

Methods included from Connections::Interests

#interests

Methods included from Connections::Home

#home

Methods included from Connections::Groups

#groups

Methods included from Connections::Games

#games

Methods included from Connections::Friends

#friends

Methods included from Connections::FriendLists

#friend_lists

Methods included from Connections::Feed

#feed, #feed!

Methods included from Connections::Events

#event!, #events

Methods included from Connections::Checkins

#checkin!, #checkins

Methods included from Connections::Books

#books

Methods included from Connections::AppRequests

#app_requests

Methods included from Connections::Albums

#album!, #albums

Methods included from Connections::Activities

#activities

Methods included from Connections::Accounts

#accounts

Methods inherited from Node

#connection, #destroy, fetch, #fetch

Methods included from Comparison

#==

Constructor Details

#initialize(identifier, attributes = {}) ⇒ User

Returns a new instance of User.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/fb_graph/user.rb', line 34

def initialize(identifier, attributes = {})
  super
  @first_name = attributes[:first_name]
  @last_name  = attributes[:last_name]
  @name       = attributes[:name]
  @link       = attributes[:link]
  @about      = attributes[:about]
  if attributes[:birthday]
    month, day, year = attributes[:birthday].split('/').collect(&:to_i)
    year ||= 0
    @birthday = Date.new(year, month, day)
  end
  @work = []
  if attributes[:work]
    attributes[:work].each do |work|
      @work << Work.new(work)
    end
  end
  @education = []
  if attributes[:education]
    attributes[:education].each do |education|
      @education << Education.new(education)
    end
  end
  @email = attributes[:email]
  @website = attributes[:website]
  @websites = attributes[:website].to_s.split
  if (hometown = attributes[:hometown])
    @hometown = Page.new(hometown.delete(:id), hometown)
  end
  if (location = attributes[:location])
    @location = Page.new(location.delete(:id), location)
  end
  @sports = []
  if (sports = attributes[:sports])
    sports.each do |sport|
      @sports << Page.new(sport.delete(:id), sport)
    end
  end
  @favorite_teams = []
  if attributes[:favorite_teams]
    attributes[:favorite_teams].each do |favorite_team|
      @favorite_teams << Page.new(favorite_team.delete(:id), favorite_team)
    end
  end
  @favorite_athletes = []
  if attributes[:favorite_athletes]
    attributes[:favorite_athletes].each do |favorite_athlete|
      @favorite_athletes << Page.new(favorite_athlete.delete(:id), favorite_athlete)
    end
  end
  @inspirational_people = []
  if attributes[:inspirational_people]
    attributes[:inspirational_people].each do |inspirational_person|
      @inspirational_people << Page.new(inspirational_person.delete(:id), inspirational_person)
    end
  end
  @bio                 = attributes[:bio]
  @quotes              = attributes[:quotes]
  @gender              = attributes[:gender]
  @interested_in       = Array(attributes[:interested_in])
  @meeting_for         = Array(attributes[:meeting_for])
  @relationship_status = attributes[:relationship_status]
  @religion            = attributes[:religion]
  @political           = attributes[:political]
  @verified            = attributes[:verified]
  if (significant_other = attributes[:significant_other])
    @significant_other = User.new(significant_other.delete(:id), significant_other)
  end
  @timezone            = attributes[:timezone]
  @locale              = attributes[:locale]
  @third_party_id      = attributes[:third_party_id]
  @languages = []
  if attributes[:languages]
    attributes[:languages].each do |language|
      @languages << Page.new(language.delete(:id), language)
    end
  end
  if attributes[:updated_time]
    @updated_time = Time.parse(attributes[:updated_time]).utc
  end
  if attributes[:address]
    @address = Venue.new(attributes[:address])
  end
  @mobile_phone = attributes[:mobile_phone]
end

Instance Attribute Details

#aboutObject

Returns the value of attribute about.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def about
  @about
end

#addressObject

Returns the value of attribute address.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def address
  @address
end

#bioObject

Returns the value of attribute bio.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def bio
  @bio
end

#birthdayObject

Returns the value of attribute birthday.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def birthday
  @birthday
end

#educationObject

Returns the value of attribute education.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def education
  @education
end

#emailObject

Returns the value of attribute email.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def email
  @email
end

#favorite_athletesObject

Returns the value of attribute favorite_athletes.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def favorite_athletes
  @favorite_athletes
end

#favorite_teamsObject

Returns the value of attribute favorite_teams.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def favorite_teams
  @favorite_teams
end

#first_nameObject

Returns the value of attribute first_name.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def first_name
  @first_name
end

#genderObject

Returns the value of attribute gender.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def gender
  @gender
end

#hometownObject

Returns the value of attribute hometown.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def hometown
  @hometown
end

#inspirational_peopleObject

Returns the value of attribute inspirational_people.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def inspirational_people
  @inspirational_people
end

#interested_inObject

Returns the value of attribute interested_in.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def interested_in
  @interested_in
end

#languagesObject

Returns the value of attribute languages.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def languages
  @languages
end

#last_nameObject

Returns the value of attribute last_name.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def last_name
  @last_name
end

Returns the value of attribute link.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def link
  @link
end

#localeObject

Returns the value of attribute locale.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def locale
  @locale
end

#locationObject

Returns the value of attribute location.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def location
  @location
end

#meeting_forObject

Returns the value of attribute meeting_for.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def meeting_for
  @meeting_for
end

#mobile_phoneObject

Returns the value of attribute mobile_phone.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def mobile_phone
  @mobile_phone
end

#nameObject

Returns the value of attribute name.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def name
  @name
end

#politicalObject

Returns the value of attribute political.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def political
  @political
end

#quotesObject

Returns the value of attribute quotes.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def quotes
  @quotes
end

#relationship_statusObject

Returns the value of attribute relationship_status.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def relationship_status
  @relationship_status
end

#religionObject

Returns the value of attribute religion.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def religion
  @religion
end

#significant_otherObject

Returns the value of attribute significant_other.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def significant_other
  @significant_other
end

#sportsObject

Returns the value of attribute sports.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def sports
  @sports
end

#third_party_idObject

Returns the value of attribute third_party_id.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def third_party_id
  @third_party_id
end

#timezoneObject

Returns the value of attribute timezone.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def timezone
  @timezone
end

#updated_timeObject

Returns the value of attribute updated_time.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def updated_time
  @updated_time
end

#verifiedObject

Returns the value of attribute verified.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def verified
  @verified
end

#websiteObject

Returns the value of attribute website.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def website
  @website
end

#websitesObject

Returns the value of attribute websites.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def websites
  @websites
end

#workObject

Returns the value of attribute work.



32
33
34
# File 'lib/fb_graph/user.rb', line 32

def work
  @work
end

Class Method Details

.me(access_token) ⇒ Object



121
122
123
# File 'lib/fb_graph/user.rb', line 121

def self.me(access_token)
  new('me', :access_token => access_token)
end