Class: Coinbase::Exchange::NetHTTPResponse

Inherits:
APIResponse
  • Object
show all
Defined in:
lib/coinbase/exchange/adapters/net_http.rb

Overview

Net-Http response object

Instance Attribute Summary

Attributes inherited from APIResponse

#received_at

Instance Method Summary collapse

Methods inherited from APIResponse

#initialize, #raw

Constructor Details

This class inherits a constructor from Coinbase::Exchange::APIResponse

Instance Method Details

#bodyObject



51
52
53
# File 'lib/coinbase/exchange/adapters/net_http.rb', line 51

def body
  @response.body
end

#headersObject



55
56
57
58
59
60
# File 'lib/coinbase/exchange/adapters/net_http.rb', line 55

def headers
  out = @response.to_hash.map do |key, val|
    [ key.upcase.gsub('_', '-'), val.count == 1 ? val.first : val ]
  end
  out.to_h
end

#statusObject



62
63
64
# File 'lib/coinbase/exchange/adapters/net_http.rb', line 62

def status
  @response.code.to_i
end