rubocop corrections
This commit is contained in:
1 parent
4b84df0af9
commit
4a7b752ace
3 files changed
+42
-31
No files matched your search
@@ -13,3 +13,17 @@ Style/Documentation:
|
||||
Metrics/BlockLength:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
|
||||
# The next 3 rubocop enabled disallow visual alignment (EasyAlign)
|
||||
Layout/ExtraSpacing:
|
||||
Enabled: false
|
||||
Layout/HashAlignment:
|
||||
Enabled: false
|
||||
Layout/SpaceBeforeFirstArg:
|
||||
Enabled: false
|
||||
|
||||
Layout/SpaceInsideHashLiteralBraces:
|
||||
Enabled: false
|
||||
Layout/LineLength:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
module StrikeMe
|
||||
module API
|
||||
|
||||
# Factory helper object connecting the client to the models
|
||||
class Account
|
||||
include BaseClient
|
||||
@@ -18,12 +17,11 @@ module StrikeMe
|
||||
response = client.get url
|
||||
# body = response.body.presence
|
||||
# body = JSON.parse(body) if body.is_a? String
|
||||
if response.success?
|
||||
raise ResponseError.new(url, response.body) unless response.success?
|
||||
|
||||
@profile = Profile.new response.body.merge(account: self)
|
||||
else
|
||||
|
||||
# if you see this, something went wrong, this is test code
|
||||
raise ResponseError.new(url, response.body)
|
||||
end
|
||||
end
|
||||
|
||||
def profile_url
|
||||
@@ -39,11 +37,9 @@ module StrikeMe
|
||||
return @balances if @balances.present?
|
||||
|
||||
response = client.get 'balances'
|
||||
if response.success?
|
||||
raise ResponseError.new('balances', response.body) unless response.success?
|
||||
|
||||
@balances = Balances.new self, response.body
|
||||
else
|
||||
raise ResponseError.new('balances', response.body)
|
||||
end
|
||||
end
|
||||
|
||||
def inspect
|
||||
|
||||
@@ -42,22 +42,23 @@ RSpec.describe StrikeMe::API::Account do
|
||||
it '#to_a properly returns the attributes' do
|
||||
expect(subject.to_a).to eq [
|
||||
{
|
||||
"currency" => "BTC",
|
||||
"current" => 0.00085408,
|
||||
"pending" => 2.3e-05,
|
||||
"outgoing" => 5.32e-06,
|
||||
"reserved" => 0.00234,
|
||||
"available" => 0.00085408,
|
||||
"total" => 0.00085408
|
||||
'currency' => 'BTC',
|
||||
'current' => 0.00085408,
|
||||
'pending' => 2.3e-05,
|
||||
'outgoing' => 5.32e-06,
|
||||
'reserved' => 0.00234,
|
||||
'available' => 0.00085408,
|
||||
'total' => 0.00085408
|
||||
}, {
|
||||
"currency" => "USDT",
|
||||
"current" => 50.04,
|
||||
"pending" => 40.06,
|
||||
"outgoing" => 60.15,
|
||||
"reserved" => 0.0,
|
||||
"available" => 0.0,
|
||||
"total" => 0.0
|
||||
}]
|
||||
'currency' => 'USDT',
|
||||
'current' => 50.04,
|
||||
'pending' => 40.06,
|
||||
'outgoing' => 60.15,
|
||||
'reserved' => 0.0,
|
||||
'available' => 0.0,
|
||||
'total' => 0.0
|
||||
}
|
||||
]
|
||||
end
|
||||
|
||||
it '#btc returns the BTC balance' do
|
||||
@@ -65,13 +66,13 @@ RSpec.describe StrikeMe::API::Account do
|
||||
expect(btc).to be_present
|
||||
expect(btc).to be_a StrikeMe::API::Account::Balance
|
||||
expect(btc.attributes).to eq(
|
||||
"available" => 0.00085408,
|
||||
"currency" => "BTC",
|
||||
"current" => 0.00085408,
|
||||
"outgoing" => 5.32e-06,
|
||||
"pending" => 2.3e-05,
|
||||
"reserved" => 0.00234,
|
||||
"total" => 0.00085408
|
||||
'available' => 0.00085408,
|
||||
'currency' => 'BTC',
|
||||
'current' => 0.00085408,
|
||||
'outgoing' => 5.32e-06,
|
||||
'pending' => 2.3e-05,
|
||||
'reserved' => 0.00234,
|
||||
'total' => 0.00085408
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user