7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/vaultoro/trading_api/withdraw.rb', line 7
def execute!
ensure_attribute_has_value :btc
return false if @errors.any?
params = { btc: @bitcoin }
response = Client.post("/withdraw", params)
code = response.code rescue ""
case code
when '200'
hash = JSON.parse(response.body)
@status = hash['status'].upcase
@address = hash['data']['address']
unless @status == 'SUCCESS'
set_errors(response)
return false
end
return true
else
set_errors(response)
return false
end
end
|