Class: FacebookSDK::Session

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Api
Defined in:
lib/facebook_sdk.rb

Constant Summary collapse

GRAPH_URL =
"https://graph.facebook.com/"

Instance Method Summary collapse

Methods included from Api

#api

Constructor Details

#initialize(&block) ⇒ Session

Returns a new instance of Session.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/facebook_sdk.rb', line 25

def initialize(&block)
  
  @conn = Faraday.new(:url => GRAPH_URL) do |builder|
    #builder.use Faraday::Response::Logger     # log the request to STDOUT

    builder.use Faraday::Adapter::NetHttp       # make http requests with Net::HTTP        

    # order inversed (in response)
    
    builder.use FacebookSDK::FaradayMiddleware::RaiseApiException
    builder.use FacebookSDK::FaradayMiddleware::HashieConverter
    builder.use FacebookSDK::FaradayMiddleware::JSONDecoder  # use own JSONDecoder
    
    @config = Configuration.new
    
    @config.faraday = builder
    yield @config
    
  end
end