require "facebook_sdk/version" require "forwardable" require "faraday" require "facebook_sdk/apiexception" require "facebook_sdk/configuration" require "facebook_sdk/modules/api" require "facebook_sdk/faraday-middleware/json_decoder" require "facebook_sdk/faraday-middleware/hashie_converter" require "facebook_sdk/faraday-middleware/raise_api_exception" module FacebookSDK class Session extend Forwardable include Api GRAPH_URL = "https://graph.facebook.com/" def_delegators :@config, :app_id, :secret def_delegators :@conn, :get, :post 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 end end