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.



45
46
47
# File 'lib/fb_rails/graph.rb', line 45

def initialize(access_token)
  @access_token = access_token
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



44
45
46
# File 'lib/fb_rails/graph.rb', line 44

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 = {})
  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 = {})
  request(:post, path, params.to_param)
end

Instance Method Details

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



53
54
55
# File 'lib/fb_rails/graph.rb', line 53

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

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



49
50
51
# File 'lib/fb_rails/graph.rb', line 49

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