Class: Cwallet::Wallet::NetHTTPResponse
Overview
Instance Attribute Summary
Attributes inherited from APIResponse
#client, #method, #params, #received_at
Instance Method Summary
collapse
Methods inherited from APIResponse
#has_more?, #initialize, #raw
Instance Method Details
#body ⇒ Object
41
42
43
|
# File 'lib/cwallet/wallet/adapters/net_http.rb', line 41
def body
JSON.parse(@response.body) rescue {}
end
|
#body=(body) ⇒ Object
45
46
47
|
# File 'lib/cwallet/wallet/adapters/net_http.rb', line 45
def body=(body)
@response.body = body.to_json
end
|
#data ⇒ Object
49
50
51
|
# File 'lib/cwallet/wallet/adapters/net_http.rb', line 49
def data
body['data']
end
|
53
54
55
56
57
58
|
# File 'lib/cwallet/wallet/adapters/net_http.rb', line 53
def
out = @response.to_hash.map do |key, val|
[ key.upcase.gsub('_', '-'), val.count == 1 ? val.first : val ]
end
out.to_h
end
|
#status ⇒ Object
60
61
62
|
# File 'lib/cwallet/wallet/adapters/net_http.rb', line 60
def status
@response.code.to_i
end
|