Class: Coinbase::Wallet::EMHTTPResponse

Inherits:
APIResponse show all
Defined in:
lib/coinbase/wallet/adapters/em_http.rb

Overview

EM-Http response object

Instance Attribute Summary

Attributes inherited from APIResponse

#client, #method, #params, #received_at

Instance Method Summary collapse

Methods inherited from APIResponse

#has_more?, #initialize, #raw

Constructor Details

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

Instance Method Details

#bodyObject



54
55
56
# File 'lib/coinbase/wallet/adapters/em_http.rb', line 54

def body
  JSON.parse(@response.response)
end

#body=(body) ⇒ Object



62
63
64
# File 'lib/coinbase/wallet/adapters/em_http.rb', line 62

def body=(body)
  @response.response = body.to_json
end

#dataObject



58
59
60
# File 'lib/coinbase/wallet/adapters/em_http.rb', line 58

def data
  body['data']
end

#headersObject



66
67
68
69
70
71
# File 'lib/coinbase/wallet/adapters/em_http.rb', line 66

def headers
  out = @response.response_header.map do |key, val|
    [ key.upcase.gsub('_', '-'), val ]
  end
  out.to_h
end

#statusObject



73
74
75
# File 'lib/coinbase/wallet/adapters/em_http.rb', line 73

def status
  @response.response_header.status
end