Class: FbGraph2::Node
- Inherits:
-
Object
- Object
- FbGraph2::Node
- Defined in:
- lib/fb_graph2/node.rb
Direct Known Subclasses
Achievement, Album, Application, Event, FriendList, Group, Page, Post, User
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#id ⇒ Object
Returns the value of attribute id.
-
#raw_attributes ⇒ Object
Returns the value of attribute raw_attributes.
Class Method Summary collapse
Instance Method Summary collapse
- #authenticate(access_token) ⇒ Object
- #edge(edge, params = {}, options = {}) ⇒ Object
- #fetch(params = {}) ⇒ Object
-
#initialize(id, attributes = {}) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(id, attributes = {}) ⇒ Node
Returns a new instance of Node.
9 10 11 12 |
# File 'lib/fb_graph2/node.rb', line 9 def initialize(id, attributes = {}) self.id = id assign attributes if respond_to?(:assign) 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 = {}) ⇒ Object
24 25 26 |
# File 'lib/fb_graph2/node.rb', line 24 def self.fetch(identifier, params = {}) new(identifier).fetch params end |
.inherited(klass) ⇒ Object
5 6 7 |
# File 'lib/fb_graph2/node.rb', line 5 def self.inherited(klass) klass.include AttributeAssigner end |
Instance Method Details
#authenticate(access_token) ⇒ Object
14 15 16 17 |
# File 'lib/fb_graph2/node.rb', line 14 def authenticate(access_token) self.access_token = access_token self end |
#edge(edge, params = {}, options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fb_graph2/node.rb', line 28 def edge(edge, params = {}, = {}) Edge.new( self, edge, params, .merge( collection: edge_for(edge, params, ) ) ) end |
#fetch(params = {}) ⇒ Object
19 20 21 22 |
# File 'lib/fb_graph2/node.rb', line 19 def fetch(params = {}) attributes = get params self.class.new(attributes[:id], attributes).authenticate access_token end |