Class: FbGraph::User

Direct Known Subclasses

AdUser, TestUser

Constant Summary collapse

@@attributes =
{
  :raw => [
    :name, :first_name, :middle_name, :last_name, :gender,
    :locale, :link, :username, :third_party_id, :timezone,
    :verified, :about, :bio, :email, :political, :quotes,
    :relationship_status, :relationship, :video_upload_limits,
    :website, :mobile_phone, :installed, :rsvp_status,
    :security_settings, :currency, :religion, :is_eligible_promo
  ],
  :custom => [
    :languages, :like_count, :updated_time,
    :birthday, :education, :hometown, :interested_in, :location,
    :favorite_teams, :age_range, :significant_other,
    :work, :devices, :sports, :favorite_athletes, :inspirational_people,
    :address, :mobile_phone
  ]
}

Instance Attribute Summary

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Searchable

search, search, search_query_param

Methods included from OpenGraph::UserContext

#og_action!, #og_actions

Methods included from Connections::Videos

#video!, #videos

Methods included from Connections::UserLikes

#like?, #likes

Methods included from Connections::UserAchievements

#achieve!, #achievements, #unachieve!

Methods included from Connections::Threads

#threads

Methods included from Connections::Television

#television

Methods included from Connections::Tagged

#tagged

Methods included from Connections::Subscribers

#subscribers

Methods included from Connections::SubscribedTo

#subscribed_to

Methods included from Connections::Statuses

#statuses

Methods included from Connections::Scores

#score!, #scores, #unscore!

Methods included from Connections::Questions

#question!, #questions

Methods included from Connections::Posts

#posts

Methods included from Connections::Pokes

#pokes

Methods included from Connections::Picture

#picture

Methods included from Connections::Photos

#photo!, #photos

Methods included from Connections::Permissions

#permissions, #revoke!

Methods included from Connections::Payments

#payments

Methods included from Connections::Outbox

#outbox

Methods included from Connections::Notifications

#notification!, #notifications

Methods included from Connections::Notes

#note!, #notes

Methods included from Connections::MutualFriends

#mutual_friends

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::Inbox

#inbox

Methods included from Connections::Home

#home

Methods included from Connections::Groups

#groups

Methods included from Connections::Games

#games

Methods included from Connections::Family

#family

Methods included from Connections::Friends

#friends

Methods included from Connections::FriendRequests

#friend_requests

Methods included from Connections::FriendLists

#friend_list!, #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_request!, #app_requests

Methods included from Connections::Albums

#album!, #albums

Methods included from Connections::Activities

#activities

Methods included from Connections::AdAccounts

#ad_account!, #ad_accounts

Methods included from Connections::Accounts

#accounts

Methods inherited from Node

#connection, #destroy, fetch, #fetch, #update

Methods included from Comparison

#==

Constructor Details

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

Returns a new instance of User.



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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/fb_graph/user.rb', line 69

def initialize(identifier, attributes = {})
  super
  @@attributes[:raw].each do |key|
    self.send :"#{key}=", attributes[key]
  end
  @languages = []
  if attributes[:languages]
    attributes[:languages].each do |language|
      @languages << Page.new(language[:id], language)
    end
  end
  if attributes[:updated_time]
    @updated_time = Time.parse(attributes[:updated_time]).utc
  end
  if attributes[:birthday]
    month, day, year = attributes[:birthday].split('/').collect(&:to_i)
    year ||= 0
    @birthday = Date.new(year, month, day)
  end
  @education = []
  if attributes[:education]
    attributes[:education].each do |education|
      @education << Education.new(education)
    end
  end
  if (hometown = attributes[:hometown]) && hometown.is_a?(Hash)
    @hometown = Page.new(hometown[:id], hometown)
  end
  @interested_in = Array(attributes[:interested_in])
  if (location = attributes[:location])
    @location = Page.new(location[:id], location)
  end
  @favorite_teams = []
  if attributes[:favorite_teams]
    attributes[:favorite_teams].each do |favorite_team|
      @favorite_teams << Page.new(favorite_team[:id], favorite_team)
    end
  end
  if (significant_other = attributes[:significant_other])
    @significant_other = User.new(significant_other[:id], significant_other)
  end
  @work = []
  if attributes[:work]
    attributes[:work].each do |work|
      @work << Work.new(work)
    end
  end
  @devices = []
  if attributes[:devices]
    attributes[:devices].each do |device|
      @devices << Device.new(device)
    end
  end
  @security_settings = attributes[:security_settings]
  if attributes[:age_range]
    @age_range = AgeRange.new(attributes[:age_range])
  end
  @sports = []
  if (sports = attributes[:sports])
    sports.each do |sport|
      @sports << Page.new(sport[:id], sport)
    end
  end
  @favorite_athletes = []
  if attributes[:favorite_athletes]
    attributes[:favorite_athletes].each do |favorite_athlete|
      @favorite_athletes << Page.new(favorite_athlete[:id], favorite_athlete)
    end
  end
  @inspirational_people = []
  if attributes[:inspirational_people]
    attributes[:inspirational_people].each do |inspirational_person|
      @inspirational_people << Page.new(inspirational_person[:id], inspirational_person)
    end
  end
  if attributes[:address]
    @address = Venue.new(attributes[:address])
  end
end

Class Method Details

.me(access_token) ⇒ Object



149
150
151
# File 'lib/fb_graph/user.rb', line 149

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