Module: TN::HTTP
- Defined in:
- lib/tn/http.rb
Defined Under Namespace
Classes: WrapError
Constant Summary collapse
- ClientError =
Class.new(Faraday::ClientError)
Class Method Summary collapse
Class Method Details
.default_connection ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/tn/http.rb', line 16 def self.default_connection Faraday.new do |conn| conn.use TN::HTTP::WrapError conn.use Faraday::Response::RaiseError yield conn if block_given? conn.adapter Faraday.default_adapter end end |
.default_json_connection ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/tn/http.rb', line 32 def self.default_json_connection default_connection do |conn| conn.response :mashify conn.response :json yield conn if block_given? end end |
.form_connection ⇒ Object
25 26 27 28 29 30 |
# File 'lib/tn/http.rb', line 25 def self.form_connection default_connection do |conn| conn.request :url_encoded yield conn if block_given? end end |