Module: TPEX::Connection
- Included in:
- API
- Defined in:
- lib/tpex/connection.rb
Instance Method Summary collapse
-
#connection(raw = false) ⇒ Object
private.
Instance Method Details
#connection(raw = false) ⇒ Object
private
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/tpex/connection.rb', line 10 def connection(raw=false) = { :headers => { 'Accept' => "application/#{format}; charset=utf-8", 'User-Agent' => user_agent, 'Cookie' => , 'X-CSRF-Token' => access_token }.reject{ |k,v| v.nil? }, :ssl => {:verify => false}, :url => endpoint, } Faraday::Connection.new() do |c| c.use FaradayMiddleware::Mashify unless raw c.response :json, :content_type => /\bjson$/ c.response :logger if @logging c.use FaradayMiddleware::RaiseHttpException c.adapter Faraday.default_adapter end end |