lib/fb_graph/node.rb in fb_graph-0.0.2 vs lib/fb_graph/node.rb in fb_graph-0.0.3
- old
+ new
@@ -1,19 +1,15 @@
module FbGraph
class Node
- attr_accessor :identifier, :endpoint, :access_token
+ include FbGraph::Comparison
- def ==(other)
- instance_variables.all? do |key|
- instance_variable_get(key) == other.instance_variable_get(key)
- end
- end
+ attr_accessor :identifier, :endpoint, :token
def initialize(identifier, options = {})
- @identifier = identifier
- @endpoint = File.join(FbGraph::ROOT_URL, identifier)
- @access_token = options[:access_token]
+ @identifier = identifier
+ @endpoint = File.join(FbGraph::ROOT_URL, identifier)
+ @token = options[:token]
end
def self.fetch(identifier, options = {})
_fetched_ = new(identifier).send(:get, options)
new(_fetched_.delete(:id), _fetched_)
@@ -32,10 +28,10 @@
_endpoint_ = if options[:connection]
File.join(self.endpoint, options.delete(:connection))
else
self.endpoint
end
- options[:access_token] ||= self.access_token
+ options[:token] ||= self.token
_options_ = options.reject do |k, v|
v.blank?
end
_endpoint_ << "?#{_options_.to_query}" unless _options_.blank?
_endpoint_
\ No newline at end of file