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, Message, Milestone, Notification, Offer, Order, Page, PageCategory, Payment, Photo, PlaceTag, Post, Request, Review, TaggedProfile, Thread, 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
|
# File 'lib/fb_graph2/node.rb', line 10
def initialize(id, attributes = {})
self.id = id
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
.fetch(identifier, params = {}, options = {}) ⇒ Object
26
27
28
|
# File 'lib/fb_graph2/node.rb', line 26
def self.fetch(identifier, params = {}, options = {})
new(identifier).fetch params, options
end
|
.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
16
17
18
19
|
# File 'lib/fb_graph2/node.rb', line 16
def authenticate(access_token)
self.access_token = access_token
self
end
|
#destroy(params = {}, options = {}) ⇒ Object
51
52
53
|
# File 'lib/fb_graph2/node.rb', line 51
def destroy(params = {}, options = {})
delete params, options
end
|
#edge(edge, params = {}, options = {}) ⇒ Object
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/fb_graph2/node.rb', line 30
def edge(edge, params = {}, options = {})
Edge.new(
self,
edge,
params,
options.merge(
collection: edge_for(edge, params, options)
)
)
end
|
#edges ⇒ Object
41
42
43
44
45
|
# File 'lib/fb_graph2/node.rb', line 41
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
21
22
23
24
|
# File 'lib/fb_graph2/node.rb', line 21
def fetch(params = {}, options = {})
attributes = get params, options
self.class.new(attributes[:id], attributes).authenticate access_token
end
|
#update(params = {}, options = {}) ⇒ Object
47
48
49
|
# File 'lib/fb_graph2/node.rb', line 47
def update(params = {}, options = {})
post params, options
end
|