Class: FbGraph::Node
- Inherits:
-
Object
- Object
- FbGraph::Node
- Includes:
- Comparison
- Defined in:
- lib/fb_graph/node.rb
Direct Known Subclasses
AdAccount, AdCampaign, AdCampaignStat, AdGroup, AdGroupStat, AdKeyword, AdKeywordValid, Album, AppRequest, Application, Checkin, Comment, Doc, Domain, Event, FriendList, Group, Insight, Link, Message, Note, Order, Page, Photo, Post, Query, ReachEstimate, Review, Status, Tab, Thread, Thread::BeforeTransition, User, Video
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
Class Method Summary collapse
Instance Method Summary collapse
- #connection(connection, options = {}) ⇒ Object
- #destroy(options = {}) ⇒ Object
- #fetch(options = {}) ⇒ Object
-
#initialize(identifier, options = {}) ⇒ Node
constructor
A new instance of Node.
- #update(options = {}) ⇒ Object
Methods included from Comparison
Constructor Details
#initialize(identifier, options = {}) ⇒ Node
Returns a new instance of Node.
9 10 11 12 13 |
# File 'lib/fb_graph/node.rb', line 9 def initialize(identifier, = {}) @identifier = identifier @endpoint = File.join(ROOT_URL, identifier.to_s) @access_token = [:access_token] end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
7 8 9 |
# File 'lib/fb_graph/node.rb', line 7 def access_token @access_token end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
7 8 9 |
# File 'lib/fb_graph/node.rb', line 7 def endpoint @endpoint end |
#identifier ⇒ Object
Returns the value of attribute identifier.
7 8 9 |
# File 'lib/fb_graph/node.rb', line 7 def identifier @identifier end |
Class Method Details
.fetch(identifier, options = {}) ⇒ Object
22 23 24 |
# File 'lib/fb_graph/node.rb', line 22 def self.fetch(identifier, = {}) new(identifier).fetch() end |
Instance Method Details
#connection(connection, options = {}) ⇒ Object
26 27 28 29 |
# File 'lib/fb_graph/node.rb', line 26 def connection(connection, = {}) collection = [:cached_collection] || Collection.new(get(.merge(:connection => connection))) Connection.new(self, connection, .merge(:collection => collection)) end |
#destroy(options = {}) ⇒ Object
35 36 37 |
# File 'lib/fb_graph/node.rb', line 35 def destroy( = {}) delete() end |
#fetch(options = {}) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/fb_graph/node.rb', line 15 def fetch( = {}) [:access_token] ||= self.access_token if self.access_token _fetched_ = get() _fetched_[:access_token] ||= [:access_token] self.class.new(_fetched_[:id], _fetched_) end |
#update(options = {}) ⇒ Object
31 32 33 |
# File 'lib/fb_graph/node.rb', line 31 def update( = {}) post() end |