Skip to content

Commit

Permalink
coding style change
Browse files Browse the repository at this point in the history
  • Loading branch information
nov committed Jan 25, 2012
1 parent 0612b27 commit 999569d
Show file tree
Hide file tree
Showing 67 changed files with 245 additions and 235 deletions.
6 changes: 3 additions & 3 deletions lib/fb_graph/connections/accounts.rb
Expand Up @@ -2,14 +2,14 @@ module FbGraph
module Connections
module Accounts
def accounts(options = {})
accounts = self.connection(:accounts, options)
accounts = self.connection :accounts, options
accounts.map! do |account|
account[:access_token] ||= options[:access_token] || self.access_token
case self
when User
Page.new(account[:id], account)
Page.new account[:id], account
when Application
TestUser.new(account[:id], account)
TestUser.new account[:id], account
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/fb_graph/connections/achievements.rb
Expand Up @@ -3,9 +3,9 @@ module Connections
module Achievements
def achievements(options = {})
options[:access_token] ||= self.access_token
achievements = self.connection(:achievements, options)
achievements = self.connection :achievements, options
achievements.map! do |achievement|
Achievement.new(achievement[:id], achievement.merge(:access_token => options[:access_token]))
Achievement.new achievement[:id], achievement.merge(:access_token => options[:access_token])
end
end

Expand Down
6 changes: 3 additions & 3 deletions lib/fb_graph/connections/activities.rb
Expand Up @@ -2,11 +2,11 @@ module FbGraph
module Connections
module Activities
def activities(options = {})
activities = self.connection(:activities, options)
activities = self.connection :activities, options
activities.map! do |activity|
Page.new(activity[:id], activity.merge(
Page.new activity[:id], activity.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/fb_graph/connections/ad_accounts.rb
Expand Up @@ -2,11 +2,11 @@ module FbGraph
module Connections
module AdAccounts
def ad_accounts(options = {})
ad_accounts = self.connection(:adaccounts, options)
ad_accounts = self.connection :adaccounts, options
ad_accounts.map! do |ad_account|
AdAccount.new(ad_account[:id], ad_account.merge(
AdAccount.new ad_account[:id], ad_account.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/fb_graph/connections/ad_campaign_stats.rb
Expand Up @@ -4,11 +4,11 @@ module AdCampaignStats
# When retrieving stats at the AdAccount level we use the 'adcampaignstats' connection
# This returns an Array of statistics
def ad_campaign_stats(options = {})
ad_campaign_stats = self.connection(:adcampaignstats, options)
ad_campaign_stats = self.connection :adcampaignstats, options
ad_campaign_stats.map! do |ad_campaign_stat|
AdCampaignStat.new(ad_campaign_stat[:id], ad_campaign_stat.merge(
AdCampaignStat.new ad_campaign_stat[:id], ad_campaign_stat.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end

Expand Down
12 changes: 6 additions & 6 deletions lib/fb_graph/connections/ad_campaigns.rb
Expand Up @@ -2,19 +2,19 @@ module FbGraph
module Connections
module AdCampaigns
def ad_campaigns(options = {})
ad_campaigns = self.connection(:adcampaigns, options)
ad_campaigns = self.connection :adcampaigns, options
ad_campaigns.map! do |ad_campaign|
AdCampaign.new(ad_campaign[:id], ad_campaign.merge(
AdCampaign.new ad_campaign[:id], ad_campaign.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end

def ad_campaign!(options = {})
ad_campaign = post(options.merge(:connection => :adcampaigns))
AdCampaign.new(ad_campaign[:id], options.merge(ad_campaign).merge(
ad_campaign = post options.merge(:connection => :adcampaigns)
AdCampaign.new ad_campaign[:id], options.merge(ad_campaign).merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/fb_graph/connections/ad_connection_objects.rb
Expand Up @@ -2,11 +2,11 @@ module FbGraph
module Connections
module AdConnectionObjects
def connection_objects(options = {})
connection_objects = self.connection(:connectionobjects, options)
connection_objects = self.connection :connectionobjects, options
connection_objects.map! do |connection_object|
AdConnectionObject.new(connection_object[:id], connection_object.merge(
AdConnectionObject.new connection_object[:id], connection_object.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/fb_graph/connections/ad_group_stats.rb
Expand Up @@ -4,11 +4,11 @@ module AdGroupStats
# When retrieving stats at the AdAccount level we use the 'adgroupstats' connection
# This returns an Array of statistics
def ad_group_stats(options = {})
ad_group_stats = self.connection(:adgroupstats, options)
ad_group_stats = self.connection :adgroupstats, options
ad_group_stats.map! do |ad_group_stat|
AdGroupStat.new(ad_group_stat[:id], ad_group_stat.merge(
AdGroupStat.new ad_group_stat[:id], ad_group_stat.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end

Expand Down
12 changes: 6 additions & 6 deletions lib/fb_graph/connections/ad_groups.rb
Expand Up @@ -2,23 +2,23 @@ module FbGraph
module Connections
module AdGroups
def ad_groups(options = {})
ad_groups = self.connection(:adgroups, options)
ad_groups = self.connection :adgroups, options
ad_groups.map! do |ad_group|
AdGroup.new(ad_group[:id], ad_group.merge(
AdGroup.new ad_group[:id], ad_group.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end

# Note: AdGroups can only be created via the AdAccount connection. Even though it makes sense, they
# cannot be created via the AdCampaign connection
def ad_group!(options = {})
ad_group = post(options.merge(:connection => :adgroups))
AdGroup.new(ad_group[:id], options.merge(ad_group).merge(
ad_group = post options.merge(:connection => :adgroups)
AdGroup.new ad_group[:id], options.merge(ad_group).merge(
:access_token => options[:access_token] || self.access_token,
:ad_id => ad_group[:id].to_i,
:adgroup_id => ad_group[:id].to_i
))
)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/fb_graph/connections/ad_previews.rb
Expand Up @@ -2,8 +2,8 @@ module FbGraph
module Connections
module AdPreviews
def ad_previews(options = {})
ad_previews = self.post(options.merge!(:method => 'get', :connection => :adpreviews))
AdPreview.new(ad_previews.merge(:access_token => options[:access_token] || self.access_token))
ad_previews = self.post options.merge(:method => 'get', :connection => :adpreviews)
AdPreview.new ad_previews.merge(:access_token => options[:access_token] || self.access_token)
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions lib/fb_graph/connections/albums.rb
Expand Up @@ -2,19 +2,19 @@ module FbGraph
module Connections
module Albums
def albums(options = {})
albums = self.connection(:albums, options)
albums = self.connection :albums, options
albums.map! do |album|
Album.new(album[:id], album.merge(
Album.new album[:id], album.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end

def album!(options = {})
album = post(options.merge(:connection => :albums))
Album.new(album[:id], options.merge(album).merge(
album = post options.merge(:connection => :albums)
Album.new album[:id], options.merge(album).merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions lib/fb_graph/connections/app_requests.rb
Expand Up @@ -2,19 +2,19 @@ module FbGraph
module Connections
module AppRequests
def app_requests(options = {})
app_requests = self.connection(:apprequests, options)
app_requests = self.connection :apprequests, options
app_requests.map! do |app_request|
AppRequest.new(app_request[:id], app_request.merge(
AppRequest.new app_request[:id], app_request.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end

def app_request!(options = {})
app_request_id = post options.merge(:connection => :apprequests)
AppRequest.new(app_request_id, options.merge(
AppRequest.new app_request_id, options.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/fb_graph/connections/attending.rb
Expand Up @@ -2,16 +2,16 @@ module FbGraph
module Connections
module Attending
def attending(options = {})
members = self.connection(:attending, options)
members = self.connection :attending, options
members.map! do |member|
User.new(member[:id], member.merge(
User.new member[:id], member.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end

def attending!(options = {})
post(options.merge(:connection => :attending))
post options.merge(:connection => :attending)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fb_graph/connections/blocked.rb
Expand Up @@ -21,7 +21,7 @@ def block!(*users)
blocked.delete_if do |user_id, succeeded|
!succeeded
end.keys.map! do |user_id|
User.new(user_id, :access_token => options[:access_token] || self.access_token)
User.new user_id, :access_token => (options[:access_token] || self.access_token)
end
end

Expand Down
6 changes: 3 additions & 3 deletions lib/fb_graph/connections/books.rb
Expand Up @@ -2,11 +2,11 @@ module FbGraph
module Connections
module Books
def books(options = {})
books = self.connection(:books, options)
books = self.connection :books, options
books.map! do |book|
Page.new(book[:id], book.merge(
Page.new book[:id], book.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/fb_graph/connections/broad_targeting_categories.rb
Expand Up @@ -2,11 +2,11 @@ module FbGraph
module Connections
module BroadTargetingCategories
def broad_targeting_categories(options = {})
broad_targeting_categories = self.connection(:broadtargetingcategories, options)
broad_targeting_categories = self.connection :broadtargetingcategories, options
broad_targeting_categories.map! do |btc|
BroadTargetingCategory.new(btc[:id], btc.merge(
BroadTargetingCategory.new btc[:id], btc.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions lib/fb_graph/connections/checkins.rb
Expand Up @@ -2,19 +2,19 @@ module FbGraph
module Connections
module Checkins
def checkins(options = {})
checkins = self.connection(:checkins, options)
checkins = self.connection :checkins, options
checkins.map! do |checkin|
Checkin.new(checkin[:id], checkin.merge(
Checkin.new checkin[:id], checkin.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end

def checkin!(options = {})
checkin = post(options.merge(:connection => :checkins))
Checkin.new(checkin[:id], options.merge(checkin).merge(
checkin = post options.merge(:connection => :checkins)
Checkin.new checkin[:id], options.merge(checkin).merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions lib/fb_graph/connections/comments.rb
Expand Up @@ -2,19 +2,19 @@ module FbGraph
module Connections
module Comments
def comments(options = {})
comments = self.connection(:comments, options)
comments = self.connection :comments, options
comments.map! do |comment|
Comment.new(comment[:id], comment.merge(
Comment.new comment[:id], comment.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end

def comment!(options = {})
comment = post(options.merge(:connection => :comments))
Comment.new(comment[:id], options.merge(comment).merge(
comment = post options.merge(:connection => :comments)
Comment.new comment[:id], options.merge(comment).merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/fb_graph/connections/declined.rb
Expand Up @@ -2,16 +2,16 @@ module FbGraph
module Connections
module Declined
def declined(options = {})
members = self.connection(:declined, options)
members = self.connection :declined, options
members.map! do |member|
User.new(member[:id], member.merge(
User.new member[:id], member.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end

def declined!(options = {})
post(options.merge(:connection => :declined))
post options.merge(:connection => :declined)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/fb_graph/connections/docs.rb
Expand Up @@ -2,11 +2,11 @@ module FbGraph
module Connections
module Docs
def docs(options = {})
docs = self.connection(:docs, options)
docs = self.connection :docs, options
docs.map! do |doc|
Doc.new(doc[:id], doc.merge(
Doc.new doc[:id], doc.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions lib/fb_graph/connections/events.rb
Expand Up @@ -2,19 +2,19 @@ module FbGraph
module Connections
module Events
def events(options = {})
events = self.connection(:events, options)
events = self.connection :events, options
events.map! do |event|
Event.new(event[:id], event.merge(
Event.new event[:id], event.merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end

def event!(options = {})
event = post(options.merge(:connection => :events))
Event.new(event[:id], options.merge(event).merge(
event = post options.merge(:connection => :events)
Event.new event[:id], options.merge(event).merge(
:access_token => options[:access_token] || self.access_token
))
)
end
end
end
Expand Down

0 comments on commit 999569d

Please sign in to comment.