Class: FbGraph::AdUser

Inherits:
User show all
Defined in:
lib/fb_graph/ad_user.rb

Constant Summary collapse

ROLES =

Level 1001, administrator access Level 1002, general-user (ad manager) access Level 1003, reports-only access

{
  :admin        => 1001,
  :general      => 1002,
  :reports_only => 1003
}
PERMISSIONS =

1: ACCOUNT_ADMIN: modify the set of users associated with the given account. 2: ADMANAGER_READ: view campaigns and ads 3: ADMANAGER_WRITE: manage campaigns and ads 4: BILLING_READ: view account billing information 5: BILLING_WRITE: modify the account billing information 7: REPORTS: run reports

{
  :account_admin => 1,
  :ad_manager_read => 2,
  :ad_manager_write => 3,
  :billing_read => 4,
  :billing_write => 5,
  # what's "6"??
  :reports => 7
}

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods inherited from User

me

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

#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_accounts

Methods included from Connections::Accounts

#accounts

Methods inherited from Node

#connection, #destroy, fetch, #update

Methods included from Comparison

#==

Constructor Details

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

Returns a new instance of AdUser.



5
6
7
8
9
10
11
# File 'lib/fb_graph/ad_user.rb', line 5

def initialize(identifier, attributes = {})
  super(identifier, attributes)

  %w(role permissions).each do |field|
    self.send("#{field}=", attributes[field.to_sym])
  end
end

Instance Attribute Details

#permissionsObject

Returns the value of attribute permissions.



3
4
5
# File 'lib/fb_graph/ad_user.rb', line 3

def permissions
  @permissions
end

#roleObject

Returns the value of attribute role.



3
4
5
# File 'lib/fb_graph/ad_user.rb', line 3

def role
  @role
end

Instance Method Details

#fetch(options = {}) ⇒ Object

FbGraph::User#fetch does not retrieve the permissions and roles since they are outside the normal attributes for an FbGraph::User, so we just copy them over from this object before returning the fetched one.



51
52
53
54
55
56
# File 'lib/fb_graph/ad_user.rb', line 51

def fetch(options = {})
  super(options).tap do |fetched|
    fetched.role = role
    fetched.permissions = permissions
  end
end