Class: FbGraphApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/fb_graph_api/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Client

Returns a new instance of Client.



5
6
7
8
# File 'lib/fb_graph_api/client.rb', line 5

def initialize(token)
  @address       =  'https://graph.facebook.com'
  @acess_token   =   token
end

Instance Attribute Details

#tokenObject

Returns the value of attribute token.



3
4
5
# File 'lib/fb_graph_api/client.rb', line 3

def token
  @token
end

Instance Method Details

#connectionObject



10
11
12
13
14
15
16
17
# File 'lib/fb_graph_api/client.rb', line 10

def connection
  Faraday.new(url: @address) do |conn|
    conn.authorization 'Bearer', @acess_token
    conn.request  :json
    conn.response :json,  :content_type => /\bjson$/
    conn.adapter  Faraday.default_adapter
  end
end