Class: FbRails::Graph

Inherits:
Object
  • Object
show all
Defined in:
lib/fb_rails/mock.rb,
lib/fb_rails/graph.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token) ⇒ Graph

Returns a new instance of Graph.



62
63
64
# File 'lib/fb_rails/graph.rb', line 62

def initialize(access_token)
  @access_token = access_token
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



61
62
63
# File 'lib/fb_rails/graph.rb', line 61

def access_token
  @access_token
end

Class Method Details

.facebook_uriObject



9
10
11
# File 'lib/fb_rails/graph.rb', line 9

def facebook_uri
  @facebook_uri ||= URI.parse("https://graph.facebook.com")
end

.get(path, params = {}) ⇒ Object



13
14
15
# File 'lib/fb_rails/graph.rb', line 13

def get(path, params = {})
  json_request(:get, "#{path}?#{params.to_param}")
end

.post(path, params = {}) ⇒ Object



17
18
19
# File 'lib/fb_rails/graph.rb', line 17

def post(path, params = {})
  json_request(:post, path, params.to_param)
end

Instance Method Details

#get(path, params = {}) ⇒ Object



70
71
72
# File 'lib/fb_rails/graph.rb', line 70

def get(path, params = {})
  self.class.get(path, params.merge(access_token: access_token))
end

#post(path, params = {}) ⇒ Object



66
67
68
# File 'lib/fb_rails/graph.rb', line 66

def post(path, params = {})
  self.class.post(path, params.merge(access_token: access_token))
end