mirror of
https://github.com/nov/fb_graph2
synced 2023-03-27 23:22:15 -04:00
use #collect! instead of #collect for Collection & Edge instances
so that they can keep its class instead of converted into normal Array, and can keep collection attributes (e.g. summaries, cursors etc.).
This commit is contained in:
parent
abc4958733
commit
ef1536d0e2
101 changed files with 109 additions and 73 deletions
|
@ -17,7 +17,7 @@ module FbGraph2
|
|||
private
|
||||
|
||||
def collect_links(attributes, link_attr)
|
||||
Collection.new(attributes[link_attr]).collect do |link|
|
||||
Collection.new(attributes[link_attr]).collect! do |link|
|
||||
klass = case link_attr
|
||||
when :ios, :iphone, :ipad
|
||||
Struct::AppLink::Native::IOS
|
||||
|
|
|
@ -33,7 +33,7 @@ module FbGraph2
|
|||
when :timestamp
|
||||
Time.at raw
|
||||
when :actions
|
||||
Collection.new(raw).collect do |_raw_|
|
||||
Collection.new(raw).collect! do |_raw_|
|
||||
Struct::Action.new _raw_
|
||||
end
|
||||
when :album
|
||||
|
@ -45,17 +45,17 @@ module FbGraph2
|
|||
when :group
|
||||
Group.new raw[:id], raw
|
||||
when :image_sources
|
||||
Collection.new(raw).collect do |_raw_|
|
||||
Collection.new(raw).collect! do |_raw_|
|
||||
Struct::ImageSource.new _raw_
|
||||
end
|
||||
when :messages
|
||||
Collection.new(raw).collect do |_raw_|
|
||||
Collection.new(raw).collect! do |_raw_|
|
||||
Message.new _raw_[:id], _raw_
|
||||
end
|
||||
when :page
|
||||
Page.new raw[:id], raw
|
||||
when :pages
|
||||
Collection.new(raw).collect do |_raw_|
|
||||
Collection.new(raw).collect! do |_raw_|
|
||||
Page.new _raw_[:id], _raw_
|
||||
end
|
||||
when :photo
|
||||
|
@ -65,13 +65,13 @@ module FbGraph2
|
|||
when :profile
|
||||
as_profile raw
|
||||
when :profiles
|
||||
Collection.new(raw).collect do |_raw_|
|
||||
Collection.new(raw).collect! do |_raw_|
|
||||
as_profile _raw_
|
||||
end
|
||||
when :user
|
||||
User.new raw[:id], raw
|
||||
when :users
|
||||
Collection.new(raw).collect do |_raw_|
|
||||
Collection.new(raw).collect! do |_raw_|
|
||||
User.new _raw_[:id], _raw_
|
||||
end
|
||||
else
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
module FbGraph2
|
||||
class Edge < Collection
|
||||
attr_accessor :owner, :edge, :params, :options, :collection
|
||||
attr_accessor :owner, :edge, :params, :options
|
||||
|
||||
def initialize(owner, edge, params = {}, options = {})
|
||||
self.owner = owner
|
||||
self.edge = edge
|
||||
self.params = params
|
||||
self.options = options
|
||||
self.collection = options.delete(:collection) || Collection.new
|
||||
collection = options.delete(:collection) || Collection.new
|
||||
replace collection
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Accounts
|
||||
def accounts(params = {})
|
||||
pages = self.edge :accounts, params
|
||||
pages.collect do |page|
|
||||
pages.collect! do |page|
|
||||
Page.new(page[:id], page).authenticate page[:access_token]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Achievements
|
||||
def achievements(params = {})
|
||||
achievements = self.edge :achievements, params
|
||||
achievements.collect do |achievement|
|
||||
achievements.collect! do |achievement|
|
||||
Achievement.new(achievement[:id], achievement).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Activities
|
||||
def activities(params = {})
|
||||
pages = self.edge :activities, params
|
||||
pages.collect do |page|
|
||||
pages.collect! do |page|
|
||||
Page.new(page[:id], page).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Admins
|
||||
def admins(params = {})
|
||||
users = self.edge :admins, params
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Albums
|
||||
def albums(params = {})
|
||||
albums = self.edge :albums, params
|
||||
albums.collect do |album|
|
||||
albums.collect! do |album|
|
||||
Album.new(album[:id], album).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module AppEventTypes
|
||||
def app_event_types(params = {})
|
||||
types = self.edge :app_event_types, params
|
||||
types.collect do |type|
|
||||
types.collect! do |type|
|
||||
Struct::AppEventType.new type
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module AppLinkHosts
|
||||
def app_link_hosts(params = {})
|
||||
hosts = self.edge :app_link_hosts, params
|
||||
hosts.collect do |host|
|
||||
hosts.collect! do |host|
|
||||
AppLinkHost.new(hosts[:id], hosts).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module AppRequests
|
||||
def app_requests(params = {})
|
||||
requests = self.edge :apprequests, params
|
||||
requests.collect do |request|
|
||||
requests.collect! do |request|
|
||||
Request.new(request[:id], request).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Applications
|
||||
def applications(params = {})
|
||||
apps = self.edge :applications, params, edge_scope: :developer
|
||||
apps.collect do |app|
|
||||
apps.collect! do |app|
|
||||
App.new(app[:id], app).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Attending
|
||||
def attending(params = {})
|
||||
users = self.edge :attending, params
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Banned
|
||||
def banned(params = {})
|
||||
users = self.edge :banned, params
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Blocked
|
||||
def blocked(params = {})
|
||||
users = self.edge :blocked, params
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Books
|
||||
def books(params = {})
|
||||
pages = self.edge :books, params
|
||||
pages.collect do |page|
|
||||
pages.collect! do |page|
|
||||
Page.new(page[:id], page).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ module FbGraph2
|
|||
else
|
||||
self.edge :comments, params
|
||||
end
|
||||
comments.collect do |comment|
|
||||
comments.collect! do |comment|
|
||||
Comment.new(comment[:id], comment).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Declined
|
||||
def declined(params = {})
|
||||
users = self.edge :declined, params
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Docs
|
||||
def docs(params = {})
|
||||
docs = self.edge :docs, params
|
||||
docs.collect do |doc|
|
||||
docs.collect! do |doc|
|
||||
GroupDoc.new(doc[:id], doc).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ module FbGraph2
|
|||
def events(*args)
|
||||
params = args.extract_options!
|
||||
events = self.edge :events, params, edge_scope: args.first
|
||||
events.collect do |event|
|
||||
events.collect! do |event|
|
||||
Event.new(event[:id], event).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Family
|
||||
def family(params = {})
|
||||
users = self.edge :family, params
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Feed
|
||||
def feed(params = {})
|
||||
posts = self.edge :feed, params
|
||||
posts.collect do |post|
|
||||
posts.collect! do |post|
|
||||
Post.new(post[:id], post).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Files
|
||||
def files(params = {})
|
||||
files = self.edge :files, params
|
||||
files.collect do |file|
|
||||
files.collect! do |file|
|
||||
Struct::GroupFile.new file
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module FriendLists
|
||||
def friend_lists(params = {})
|
||||
friend_lists = self.edge :friendlists, params
|
||||
friend_lists.collect do |friend_list|
|
||||
friend_lists.collect! do |friend_list|
|
||||
FriendList.new(friend_list[:id], friend_list).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Friends
|
||||
def friends(params = {})
|
||||
users = self.edge :friends, params
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Games
|
||||
def games(params = {})
|
||||
pages = self.edge :games, params
|
||||
pages.collect do |page|
|
||||
pages.collect! do |page|
|
||||
Page.new(page[:id], page).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module GlobalBrandChildren
|
||||
def global_brand_children(params = {})
|
||||
pages = self.edge :global_brand_children, params
|
||||
pages.collect do |page|
|
||||
pages.collect! do |page|
|
||||
Page.new(page[:id], page).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Groups
|
||||
def groups(params = {})
|
||||
groups = self.edge :groups, params
|
||||
groups.collect do |group|
|
||||
groups.collect! do |group|
|
||||
Group.new(group[:id], group).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Home
|
||||
def home(params = {})
|
||||
posts = self.edge :home, params
|
||||
posts.collect do |post|
|
||||
posts.collect! do |post|
|
||||
Post.new(post[:id], post).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Inbox
|
||||
def inbox(params = {})
|
||||
threads = self.edge :inbox, params
|
||||
threads.collect do |thread|
|
||||
threads.collect! do |thread|
|
||||
Thread.new(thread[:id], thread).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Interests
|
||||
def interests(params = {})
|
||||
pages = self.edge :interests, params
|
||||
pages.collect do |page|
|
||||
pages.collect! do |page|
|
||||
Page.new(page[:id], page).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module InvitableFriends
|
||||
def invitable_friends(params = {})
|
||||
invitable_friends = self.edge :invitable_friends, params
|
||||
invitable_friends.collect do |friend|
|
||||
invitable_friends.collect! do |friend|
|
||||
Struct::Friend.new friend
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Invited
|
||||
def invited(params = {})
|
||||
users = self.edge :invited, params
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ module FbGraph2
|
|||
module LikerContext
|
||||
def likes(params = {})
|
||||
pages = self.edge :likes, params
|
||||
pages.collect do |page|
|
||||
pages.collect! do |page|
|
||||
Page.new(page[:id], page).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
@ -29,7 +29,7 @@ module FbGraph2
|
|||
else
|
||||
self.edge :likes, params
|
||||
end
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Links
|
||||
def links(params = {})
|
||||
posts = self.edge :links, params
|
||||
posts.collect do |post|
|
||||
posts.collect! do |post|
|
||||
Post.new(post[:id], post).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Locations
|
||||
def locations(params = {})
|
||||
pages = self.edge :locations, params
|
||||
pages.collect do |page|
|
||||
pages.collect! do |page|
|
||||
Page.new(page[:id], page).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Maybe
|
||||
def maybe(params = {})
|
||||
users = self.edge :maybe, params
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Members
|
||||
def members(params = {})
|
||||
users = self.edge :members, params
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Milestones
|
||||
def milestones(params = {})
|
||||
milestones = self.edge :milestones, params
|
||||
milestones.collect do |milestone|
|
||||
milestones.collect! do |milestone|
|
||||
Milestone.new(milestone[:id], milestone).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Movies
|
||||
def movies(params = {})
|
||||
pages = self.edge :movies, params
|
||||
pages.collect do |page|
|
||||
pages.collect! do |page|
|
||||
Page.new(page[:id], page).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Music
|
||||
def music(params = {})
|
||||
pages = self.edge :music, params
|
||||
pages.collect do |page|
|
||||
pages.collect! do |page|
|
||||
Page.new(page[:id], page).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Noreply
|
||||
def noreply(params = {})
|
||||
users = self.edge :noreply, params
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Notifications
|
||||
def notifications(params = {})
|
||||
notifications = self.edge :notifications, params
|
||||
notifications.collect do |notification|
|
||||
notifications.collect! do |notification|
|
||||
Notification.new notification[:id], notification
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Offers
|
||||
def offers(params = {})
|
||||
offers = self.edge :offers, params
|
||||
offers.collect do |offer|
|
||||
offers.collect! do |offer|
|
||||
Offer.new(offer[:id], offer).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Outbox
|
||||
def outbox(params = {})
|
||||
threads = self.edge :outbox, params
|
||||
threads.collect do |thread|
|
||||
threads.collect! do |thread|
|
||||
Thread.new(thread[:id], thread).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module PaymentTransactions
|
||||
def payment_transactions(params = {})
|
||||
payments = self.edge :payment_transactions, params
|
||||
payments.collect do |payment|
|
||||
payments.collect! do |payment|
|
||||
Payment.new(payment[:id], payment).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Permissions
|
||||
def permissions(params = {})
|
||||
permissions = self.edge :permissions, params
|
||||
permissions.collect do |permission|
|
||||
permissions.collect! do |permission|
|
||||
Struct::Permission.new permission
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ module FbGraph2
|
|||
def photos(*args)
|
||||
params = args.extract_options!
|
||||
photos = self.edge :photos, params, edge_scope: args.first
|
||||
photos.collect do |photo|
|
||||
photos.collect! do |photo|
|
||||
Photo.new(photo[:id], photo).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Pokes
|
||||
def pokes(params = {})
|
||||
pokes = self.edge :pokes, params
|
||||
pokes.collect do |poke|
|
||||
pokes.collect! do |poke|
|
||||
Struct::Poke.new poke
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Posts
|
||||
def posts(params = {})
|
||||
posts = self.edge :posts, params
|
||||
posts.collect do |post|
|
||||
posts.collect! do |post|
|
||||
Post.new(post[:id], post).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module PromotablePosts
|
||||
def promotable_posts(params = {})
|
||||
posts = self.edge :promotable_posts, params
|
||||
posts.collect do |post|
|
||||
posts.collect! do |post|
|
||||
Post.new(post[:id], post).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Roles
|
||||
def roles(params = {})
|
||||
roles = self.edge :roles, params
|
||||
roles.collect do |role|
|
||||
roles.collect! do |role|
|
||||
Struct::Role.new role
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Scores
|
||||
def scores(params = {})
|
||||
scores = self.edge :scores, params
|
||||
scores.collect do |score|
|
||||
scores.collect! do |score|
|
||||
Struct::Score.new score
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module SharedPosts
|
||||
def shared_posts(params = {})
|
||||
posts = self.edge :sharedposts, params
|
||||
posts.collect do |post|
|
||||
posts.collect! do |post|
|
||||
Post.new(post[:id], post).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module StaticResources
|
||||
def static_resources(params = {})
|
||||
resources = self.edge :staticresources, params
|
||||
resources.collect do |resource|
|
||||
resources.collect! do |resource|
|
||||
Struct::StaticResource.new resource
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Statuses
|
||||
def statuses(params = {})
|
||||
posts = self.edge :statuses, params
|
||||
posts.collect do |post|
|
||||
posts.collect! do |post|
|
||||
Post.new(post[:id], post).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Subscriptions
|
||||
def subscriptions(params = {})
|
||||
subscriptions = self.edge :subscriptions, params
|
||||
subscriptions.collect do |subscription|
|
||||
subscriptions.collect! do |subscription|
|
||||
Struct::Subscription.new subscription
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module TaggableFriends
|
||||
def taggable_friends(params = {})
|
||||
taggable_friends = self.edge :taggable_friends, params
|
||||
taggable_friends.collect do |friend|
|
||||
taggable_friends.collect! do |friend|
|
||||
Struct::Friend.new friend
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Tagged
|
||||
def tagged(params = {})
|
||||
posts = self.edge :tagged, params
|
||||
posts.collect do |post|
|
||||
posts.collect! do |post|
|
||||
Post.new(post[:id], post).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module TaggedPlaces
|
||||
def tagged_places(params = {})
|
||||
place_tags = self.edge :tagged_places, params
|
||||
place_tags.collect do |place_tag|
|
||||
place_tags.collect! do |place_tag|
|
||||
PlaceTag.new(place_tag[:id], place_tag).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Tags
|
||||
def tags(params = {})
|
||||
users = self.edge :tags, params
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Television
|
||||
def television(params = {})
|
||||
pages = self.edge :television, params
|
||||
pages.collect do |page|
|
||||
pages.collect! do |page|
|
||||
Page.new(page[:id], page).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module TestUsers
|
||||
def test_users(params = {})
|
||||
users = self.edge :accounts, params, edge_scope: :'test-users'
|
||||
users.collect do |user|
|
||||
users.collect! do |user|
|
||||
User.new(user[:id], user)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ module FbGraph2
|
|||
module Translations
|
||||
def translations(params = {})
|
||||
translations = self.edge :translations, params
|
||||
translations.collect do |translation|
|
||||
translations.collect! do |translation|
|
||||
Translation.new(translation[:id], translation).authenticate self.authenticate
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ module FbGraph2
|
|||
def videos(*args)
|
||||
params = args.extract_options!
|
||||
videos = self.edge :videos, params, edge_scope: args.first
|
||||
videos.collect do |video|
|
||||
videos.collect! do |video|
|
||||
Video.new(video[:id], video).authenticate self.access_token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ module FbGraph2
|
|||
def initialize(attributes = {})
|
||||
super
|
||||
if attributes.include? :parameters
|
||||
self.parameters = Collection.new(attributes[:parameters]).collect do |param|
|
||||
self.parameters = Collection.new(attributes[:parameters]).collect! do |param|
|
||||
Parameter.new param
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Accounts do
|
|||
accounts = mock_graph :get, 'me/accounts', 'user/accounts', access_token: 'token' do
|
||||
me.accounts
|
||||
end
|
||||
accounts.should be_instance_of FbGraph2::Edge
|
||||
accounts.should_not be_blank
|
||||
accounts.each do |account|
|
||||
account.should be_instance_of FbGraph2::Page
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Achievements do
|
|||
pages = mock_graph :get, 'me/achievements', 'user/achievements', access_token: 'token' do
|
||||
me.achievements
|
||||
end
|
||||
pages.should be_instance_of FbGraph2::Edge
|
||||
pages.should_not be_blank
|
||||
pages.each do |page|
|
||||
page.should be_instance_of FbGraph2::Achievement
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Activities do
|
|||
pages = mock_graph :get, 'me/activities', 'user/activities', access_token: 'token' do
|
||||
me.activities
|
||||
end
|
||||
pages.should be_instance_of FbGraph2::Edge
|
||||
pages.should_not be_blank
|
||||
pages.each do |page|
|
||||
page.should be_instance_of FbGraph2::Page
|
||||
|
|
|
@ -9,6 +9,7 @@ describe FbGraph2::Edge::Admins do
|
|||
users = mock_graph :get, 'page_id/admins', 'page/admins', access_token: 'page_token' do
|
||||
page.admins
|
||||
end
|
||||
users.should be_instance_of FbGraph2::Edge
|
||||
users.should_not be_blank
|
||||
users.each do |user|
|
||||
user.should be_instance_of FbGraph2::User
|
||||
|
|
|
@ -9,6 +9,7 @@ describe FbGraph2::Edge::Albums do
|
|||
albums = mock_graph :get, 'me/albums', 'user/albums', access_token: 'token' do
|
||||
me.albums
|
||||
end
|
||||
albums.should be_instance_of FbGraph2::Edge
|
||||
albums.should_not be_blank
|
||||
albums.each do |album|
|
||||
album.should be_instance_of FbGraph2::Album
|
||||
|
|
|
@ -11,6 +11,7 @@ describe FbGraph2::Edge::Blocked do
|
|||
users = mock_graph :get, 'page_id/blocked', 'page/blocked', access_token: 'page_token' do
|
||||
page.blocked
|
||||
end
|
||||
users.should be_instance_of FbGraph2::Edge
|
||||
users.should_not be_blank
|
||||
users.each do |user|
|
||||
user.should be_instance_of FbGraph2::User
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Books do
|
|||
pages = mock_graph :get, 'me/books', 'user/books', access_token: 'token' do
|
||||
me.books
|
||||
end
|
||||
pages.should be_instance_of FbGraph2::Edge
|
||||
pages.should_not be_blank
|
||||
pages.each do |page|
|
||||
page.should be_instance_of FbGraph2::Page
|
||||
|
|
|
@ -34,6 +34,7 @@ describe FbGraph2::Edge::Comments do
|
|||
comments = mock_graph :get, 'post_id/comments', 'post/comments', access_token: 'token' do
|
||||
post.comments
|
||||
end
|
||||
comments.should be_instance_of FbGraph2::Edge
|
||||
comments.should_not be_blank
|
||||
comments.each do |comment|
|
||||
comment.should be_instance_of FbGraph2::Comment
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Events do
|
|||
events = mock_graph :get, 'me/events', 'user/events', access_token: 'token' do
|
||||
me.events
|
||||
end
|
||||
events.should be_instance_of FbGraph2::Edge
|
||||
events.should_not be_blank
|
||||
events.each do |event|
|
||||
event.should be_instance_of FbGraph2::Event
|
||||
|
|
|
@ -9,6 +9,7 @@ describe FbGraph2::Edge::Feed do
|
|||
posts = mock_graph :get, 'me/feed', 'user/feed', access_token: 'token' do
|
||||
me.feed
|
||||
end
|
||||
posts.should be_instance_of FbGraph2::Edge
|
||||
posts.should_not be_blank
|
||||
posts.each do |post|
|
||||
post.should be_instance_of FbGraph2::Post
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::FriendLists do
|
|||
friend_lists = mock_graph :get, 'me/friendlists', 'user/friend_lists', access_token: 'token' do
|
||||
me.friend_lists
|
||||
end
|
||||
friend_lists.should be_instance_of FbGraph2::Edge
|
||||
friend_lists.should_not be_blank
|
||||
friend_lists.each do |friend_list|
|
||||
friend_list.should be_instance_of FbGraph2::FriendList
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Friends do
|
|||
users = mock_graph :get, 'me/friends', 'user/friends', access_token: 'token' do
|
||||
me.friends
|
||||
end
|
||||
users.should be_instance_of FbGraph2::Edge
|
||||
users.should_not be_blank
|
||||
users.each do |user|
|
||||
user.should be_instance_of FbGraph2::User
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Groups do
|
|||
groups = mock_graph :get, 'me/groups', 'user/groups', access_token: 'token' do
|
||||
me.groups
|
||||
end
|
||||
groups.should be_instance_of FbGraph2::Edge
|
||||
groups.should_not be_blank
|
||||
groups.each do |group|
|
||||
group.should be_instance_of FbGraph2::Group
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Feed do
|
|||
posts = mock_graph :get, 'me/home', 'user/home', access_token: 'token' do
|
||||
me.home
|
||||
end
|
||||
posts.should be_instance_of FbGraph2::Edge
|
||||
posts.should_not be_blank
|
||||
posts.each do |post|
|
||||
post.should be_instance_of FbGraph2::Post
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Interests do
|
|||
pages = mock_graph :get, 'me/interests', 'user/interests', access_token: 'token' do
|
||||
me.interests
|
||||
end
|
||||
pages.should be_instance_of FbGraph2::Edge
|
||||
pages.should_not be_blank
|
||||
pages.each do |page|
|
||||
page.should be_instance_of FbGraph2::Page
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::InvitableFriends do
|
|||
users = mock_graph :get, 'me/invitable_friends', 'user/invitable_friends', access_token: 'token' do
|
||||
me.invitable_friends
|
||||
end
|
||||
users.should be_instance_of FbGraph2::Edge
|
||||
users.should_not be_blank
|
||||
users.each do |user|
|
||||
user.should be_instance_of FbGraph2::Struct::Friend
|
||||
|
|
|
@ -9,6 +9,7 @@ describe FbGraph2::Edge::Likes do
|
|||
likes = mock_graph :get, 'me/likes', 'user/likes', access_token: 'token' do
|
||||
me.likes
|
||||
end
|
||||
likes.should be_instance_of FbGraph2::Edge
|
||||
likes.should_not be_blank
|
||||
likes.each do |like|
|
||||
like.should be_instance_of FbGraph2::Page
|
||||
|
@ -68,6 +69,7 @@ describe FbGraph2::Edge::Likes do
|
|||
likes = mock_graph :get, 'post_id/likes', 'post/likes', access_token: 'token' do
|
||||
post.likes
|
||||
end
|
||||
likes.should be_instance_of FbGraph2::Edge
|
||||
likes.should_not be_blank
|
||||
likes.each do |like|
|
||||
like.should be_instance_of FbGraph2::User
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Links do
|
|||
posts = mock_graph :get, 'me/links', 'user/links', access_token: 'token' do
|
||||
me.links
|
||||
end
|
||||
posts.should be_instance_of FbGraph2::Edge
|
||||
posts.should_not be_blank
|
||||
posts.each do |post|
|
||||
post.should be_instance_of FbGraph2::Post
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Milestones do
|
|||
milestones = mock_graph :get, 'page_id/milestones', 'page/milestones', access_token: 'token' do
|
||||
page.milestones
|
||||
end
|
||||
milestones.should be_instance_of FbGraph2::Edge
|
||||
milestones.should_not be_blank
|
||||
milestones.each do |milestone|
|
||||
milestone.should be_instance_of FbGraph2::Milestone
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Movies do
|
|||
pages = mock_graph :get, 'me/movies', 'user/movies', access_token: 'token' do
|
||||
me.movies
|
||||
end
|
||||
pages.should be_instance_of FbGraph2::Edge
|
||||
pages.should_not be_blank
|
||||
pages.each do |page|
|
||||
page.should be_instance_of FbGraph2::Page
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Music do
|
|||
pages = mock_graph :get, 'me/music', 'user/music', access_token: 'token' do
|
||||
me.music
|
||||
end
|
||||
pages.should be_instance_of FbGraph2::Edge
|
||||
pages.should_not be_blank
|
||||
pages.each do |page|
|
||||
page.should be_instance_of FbGraph2::Page
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Notifications do
|
|||
notifications = mock_graph :get, 'me/notifications', 'user/notifications', access_token: 'token' do
|
||||
me.notifications
|
||||
end
|
||||
notifications.should be_instance_of FbGraph2::Edge
|
||||
notifications.should_not be_blank
|
||||
notifications.each do |notification|
|
||||
notification.should be_instance_of FbGraph2::Notification
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Permissions do
|
|||
permissions = mock_graph :get, 'me/permissions', 'user/permissions', access_token: 'token' do
|
||||
me.permissions
|
||||
end
|
||||
permissions.should be_instance_of FbGraph2::Edge
|
||||
permissions.should_not be_blank
|
||||
permissions.each do |permission|
|
||||
permission.should be_instance_of FbGraph2::Struct::Permission
|
||||
|
|
|
@ -9,6 +9,7 @@ describe FbGraph2::Edge::Photos do
|
|||
photos = mock_graph :get, 'me/photos', 'user/photos', access_token: 'token' do
|
||||
me.photos
|
||||
end
|
||||
photos.should be_instance_of FbGraph2::Edge
|
||||
photos.should_not be_blank
|
||||
photos.each do |photo|
|
||||
photo.should be_instance_of FbGraph2::Photo
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Pokes do
|
|||
pokes = mock_graph :get, 'me/pokes', 'user/pokes', access_token: 'token' do
|
||||
me.pokes
|
||||
end
|
||||
pokes.should be_instance_of FbGraph2::Edge
|
||||
pokes.should_not be_blank
|
||||
pokes.each do |poke|
|
||||
poke.should be_instance_of FbGraph2::Struct::Poke
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Posts do
|
|||
posts = mock_graph :get, 'me/posts', 'user/posts', access_token: 'token' do
|
||||
me.posts
|
||||
end
|
||||
posts.should be_instance_of FbGraph2::Edge
|
||||
posts.should_not be_blank
|
||||
posts.each do |post|
|
||||
post.should be_instance_of FbGraph2::Post
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::PromotablePosts do
|
|||
posts = mock_graph :get, 'page_id/promotable_posts', 'page/promotable_posts', access_token: 'page_token' do
|
||||
page.promotable_posts
|
||||
end
|
||||
posts.should be_instance_of FbGraph2::Edge
|
||||
posts.should_not be_blank
|
||||
posts.each do |post|
|
||||
post.should be_instance_of FbGraph2::Post
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Scores do
|
|||
scores = mock_graph :get, 'me/scores', 'user/scores', access_token: 'token' do
|
||||
me.scores
|
||||
end
|
||||
scores.should be_instance_of FbGraph2::Edge
|
||||
scores.should_not be_blank
|
||||
scores.each do |score|
|
||||
score.should be_instance_of FbGraph2::Struct::Score
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::SharedPosts do
|
|||
posts = mock_graph :get, 'post_id/sharedposts', 'post/shared_posts', access_token: 'token' do
|
||||
post.shared_posts
|
||||
end
|
||||
posts.should be_instance_of FbGraph2::Edge
|
||||
posts.should_not be_blank
|
||||
posts.each do |post|
|
||||
post.should be_instance_of FbGraph2::Post
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Statuses do
|
|||
posts = mock_graph :get, 'me/statuses', 'user/statuses', access_token: 'token' do
|
||||
me.statuses
|
||||
end
|
||||
posts.should be_instance_of FbGraph2::Edge
|
||||
posts.should_not be_blank
|
||||
posts.each do |post|
|
||||
post.should be_instance_of FbGraph2::Post
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Subscriptions do
|
|||
subscriptions = mock_graph :get, 'app/subscriptions', 'app/subscriptions', access_token: 'app_token' do
|
||||
app.subscriptions
|
||||
end
|
||||
subscriptions.should be_instance_of FbGraph2::Edge
|
||||
subscriptions.should_not be_blank
|
||||
subscriptions.each do |subscription|
|
||||
subscription.should be_instance_of FbGraph2::Struct::Subscription
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::TaggableFriends do
|
|||
users = mock_graph :get, 'me/taggable_friends', 'user/taggable_friends', access_token: 'token' do
|
||||
me.taggable_friends
|
||||
end
|
||||
users.should be_instance_of FbGraph2::Edge
|
||||
users.should_not be_blank
|
||||
users.each do |user|
|
||||
user.should be_instance_of FbGraph2::Struct::Friend
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::Television do
|
|||
pages = mock_graph :get, 'me/television', 'user/television', access_token: 'token' do
|
||||
me.television
|
||||
end
|
||||
pages.should be_instance_of FbGraph2::Edge
|
||||
pages.should_not be_blank
|
||||
pages.each do |page|
|
||||
page.should be_instance_of FbGraph2::Page
|
||||
|
|
|
@ -8,6 +8,7 @@ describe FbGraph2::Edge::TestUsers do
|
|||
users = mock_graph :get, 'app/accounts/test-users', 'app/test_users', access_token: 'app_token' do
|
||||
app.test_users
|
||||
end
|
||||
users.should be_instance_of FbGraph2::Edge
|
||||
users.should_not be_blank
|
||||
users.each do |user|
|
||||
user.should be_instance_of FbGraph2::User
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue