Sha256: 6c0e91e969bbfadf15d0252d945aacd81a2812b3fe3b27a8a69680611e589b4f
Contents?: true
Size: 1009 Bytes
Versions: 3
Compression:
Stored size: 1009 Bytes
Contents
$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib') require 'engaging_networks_rest' require 'faraday/detailed_logger' require 'byebug' def instrument_connection_with_extended_logging(client) default_options = { headers: { 'Accept' => "application/json;q=0.1", 'Accept-Charset' => "utf-8" } } faraday_builder = ->(faraday) do faraday.request :json faraday.response :json, :content_type => /\bjson$/ faraday.use Faraday::Response::Logger if ENV['DEBUG'] faraday.use EngagingNetworksRest::Response::RaiseError faraday.response :detailed_logger faraday.adapter Faraday.default_adapter end instrumented_connection = Faraday.new( default_options.merge(url: "https://#{EngagingNetworksRest::Client::ENS_DOMAIN}"), &faraday_builder ) client.instance_variable_set(:@connection, instrumented_connection) end client = EngagingNetworksRest.new(api_key: ENV['EN_API_KEY']) instrument_connection_with_extended_logging(client) byebug puts "Bye!"
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
engaging-networks-rest-0.6.0 | example.rb |
engaging-networks-rest-0.5.0 | example.rb |
engaging-networks-rest-0.4.1 | example.rb |