Class: FbGraph2::Node
- Inherits:
-
Object
show all
- Defined in:
- lib/fb_graph2/node.rb
Direct Known Subclasses
Achievement, AchievementType, Album, App, AppLinkHost, Comment, Domain, Event, FriendList, Group, GroupDoc, Insight, Message, Milestone, Notification, Offer, Order, Page, PageCategory, Payment, Photo, PlaceTag, Post, Request, Review, TaggedProfile, Thread, TokenMetadata, Translation, User, Video
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(id, attributes = {}) ⇒ Node
Returns a new instance of Node.
10
11
12
13
14
15
|
# File 'lib/fb_graph2/node.rb', line 10
def initialize(id, attributes = {})
self.id = id
self.raw_attributes = attributes
assign attributes if respond_to? :assign
authenticate attributes[:access_token] if attributes.include? :access_token
end
|
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
3
4
5
|
# File 'lib/fb_graph2/node.rb', line 3
def access_token
@access_token
end
|
#id ⇒ Object
Returns the value of attribute id.
3
4
5
|
# File 'lib/fb_graph2/node.rb', line 3
def id
@id
end
|
#raw_attributes ⇒ Object
Returns the value of attribute raw_attributes.
3
4
5
|
# File 'lib/fb_graph2/node.rb', line 3
def raw_attributes
@raw_attributes
end
|
Class Method Details
.inherited(klass) ⇒ Object
5
6
7
8
|
# File 'lib/fb_graph2/node.rb', line 5
def self.inherited(klass)
klass.send :include, AttributeAssigner
FbGraph2.object_classes << klass
end
|
Instance Method Details
#authenticate(access_token) ⇒ Object
17
18
19
20
|
# File 'lib/fb_graph2/node.rb', line 17
def authenticate(access_token)
self.access_token = access_token
self
end
|
#destroy(params = {}, options = {}) ⇒ Object
48
49
50
|
# File 'lib/fb_graph2/node.rb', line 48
def destroy(params = {}, options = {})
delete params, options
end
|
#edge(edge, params = {}, options = {}) ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/fb_graph2/node.rb', line 27
def edge(edge, params = {}, options = {})
Edge.new(
self,
edge,
params,
options.merge(
collection: edge_for(edge, params, options)
)
)
end
|
#edges ⇒ Object
38
39
40
41
42
|
# File 'lib/fb_graph2/node.rb', line 38
def edges
@edges ||= self.class.included_modules.select do |_module_|
_module_.name =~ /FbGraph2::Edge/
end.collect(&:instance_methods).flatten.sort
end
|
#fetch(params = {}, options = {}) ⇒ Object
22
23
24
25
|
# File 'lib/fb_graph2/node.rb', line 22
def fetch(params = {}, options = {})
attributes = get params, options
self.class.new(attributes[:id], attributes).authenticate access_token
end
|
#update(params = {}, options = {}) ⇒ Object
44
45
46
|
# File 'lib/fb_graph2/node.rb', line 44
def update(params = {}, options = {})
post params, options
end
|