rubocop corrections

This commit is contained in:
bterkuile committed 2025-10-18 09:29:55 -05:00
1 parent 4b84df0af9
commit 4a7b752ace
3 files changed
+42 -31

No files matched your search

+14
View File
@@ -13,3 +13,17 @@ Style/Documentation:
Metrics/BlockLength: Metrics/BlockLength:
Exclude: Exclude:
- 'spec/**/*' - '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/**/*'
+5 -9
View File
@@ -2,7 +2,6 @@
module StrikeMe module StrikeMe
module API module API
# Factory helper object connecting the client to the models # Factory helper object connecting the client to the models
class Account class Account
include BaseClient include BaseClient
@@ -18,12 +17,11 @@ module StrikeMe
response = client.get url response = client.get url
# body = response.body.presence # body = response.body.presence
# body = JSON.parse(body) if body.is_a? String # 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) @profile = Profile.new response.body.merge(account: self)
else
# if you see this, something went wrong, this is test code # if you see this, something went wrong, this is test code
raise ResponseError.new(url, response.body)
end
end end
def profile_url def profile_url
@@ -39,11 +37,9 @@ module StrikeMe
return @balances if @balances.present? return @balances if @balances.present?
response = client.get 'balances' response = client.get 'balances'
if response.success? raise ResponseError.new('balances', response.body) unless response.success?
@balances = Balances.new self, response.body @balances = Balances.new self, response.body
else
raise ResponseError.new('balances', response.body)
end
end end
def inspect def inspect
+23 -22
View File
@@ -42,22 +42,23 @@ RSpec.describe StrikeMe::API::Account do
it '#to_a properly returns the attributes' do it '#to_a properly returns the attributes' do
expect(subject.to_a).to eq [ expect(subject.to_a).to eq [
{ {
"currency" => "BTC", 'currency' => 'BTC',
"current" => 0.00085408, 'current' => 0.00085408,
"pending" => 2.3e-05, 'pending' => 2.3e-05,
"outgoing" => 5.32e-06, 'outgoing' => 5.32e-06,
"reserved" => 0.00234, 'reserved' => 0.00234,
"available" => 0.00085408, 'available' => 0.00085408,
"total" => 0.00085408 'total' => 0.00085408
}, { }, {
"currency" => "USDT", 'currency' => 'USDT',
"current" => 50.04, 'current' => 50.04,
"pending" => 40.06, 'pending' => 40.06,
"outgoing" => 60.15, 'outgoing' => 60.15,
"reserved" => 0.0, 'reserved' => 0.0,
"available" => 0.0, 'available' => 0.0,
"total" => 0.0 'total' => 0.0
}] }
]
end end
it '#btc returns the BTC balance' do 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_present
expect(btc).to be_a StrikeMe::API::Account::Balance expect(btc).to be_a StrikeMe::API::Account::Balance
expect(btc.attributes).to eq( expect(btc.attributes).to eq(
"available" => 0.00085408, 'available' => 0.00085408,
"currency" => "BTC", 'currency' => 'BTC',
"current" => 0.00085408, 'current' => 0.00085408,
"outgoing" => 5.32e-06, 'outgoing' => 5.32e-06,
"pending" => 2.3e-05, 'pending' => 2.3e-05,
"reserved" => 0.00234, 'reserved' => 0.00234,
"total" => 0.00085408 'total' => 0.00085408
) )
end end