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.



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

def initialize(access_token)
  @access_token = access_token
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



64
65
66
# File 'lib/fb_rails/graph.rb', line 64

def access_token
  @access_token
end

Class Method Details

.facebook_uriObject



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

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

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



20
21
22
# File 'lib/fb_rails/graph.rb', line 20

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

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



24
25
26
# File 'lib/fb_rails/graph.rb', line 24

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

Instance Method Details

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



73
74
75
# File 'lib/fb_rails/graph.rb', line 73

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

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



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

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