Skip to content
This repository has been archived by the owner on Nov 27, 2019. It is now read-only.

Commit

Permalink
style: fix rubocop issues
Browse files Browse the repository at this point in the history
  • Loading branch information
faustbrian committed Jun 29, 2018
1 parent e624b74 commit 17b8b80
Show file tree
Hide file tree
Showing 37 changed files with 401 additions and 397 deletions.
3 changes: 2 additions & 1 deletion Gemfile
@@ -1,9 +1,10 @@
source "https://rubygems.org"
source 'https://rubygems.org'

# Specify your gem's dependencies in arkecosystem-client.gemspec
gemspec

group :development do
gem 'guard', require: false
gem 'guard-rspec', require: false
gem 'rubocop', '~> 0.56.0', require: false
end
4 changes: 2 additions & 2 deletions Guardfile
@@ -1,8 +1,8 @@
# More info at https://github.com/guard/guard#readme

guard :rspec, cmd: 'rspec', all_on_start: true do
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }

watch(%r{^spec/.+_spec\.rb$})
watch('spec/spec_helper.rb') { 'spec' }
watch('spec/spec_helper.rb') { 'spec' }
end
6 changes: 3 additions & 3 deletions Rakefile
@@ -1,6 +1,6 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
task default: :spec
43 changes: 21 additions & 22 deletions arkecosystem-client.gemspec
@@ -1,39 +1,38 @@
# coding: utf-8
lib = File.expand_path("../lib", __FILE__)
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require_relative "lib/arkecosystem/client/version"
require_relative 'lib/arkecosystem/client/version'

Gem::Specification.new do |spec|
spec.name = "arkecosystem-client"
spec.name = 'arkecosystem-client'
spec.version = ArkEcosystem::Client::VERSION
spec.authors = ["Brian Faust"]
spec.email = ["brian@ark.io"]
spec.authors = ['Brian Faust']
spec.email = ['brian@ark.io']

spec.summary = "A simple Ruby API client for the ARK Blockchain."
spec.description = "A simple Ruby API client for the ARK Blockchain."
spec.homepage = "https://github.com/ArkEcosystem/ruby-client"
spec.license = "MIT"
spec.summary = 'A simple Ruby API client for the ARK Blockchain.'
spec.description = 'A simple Ruby API client for the ARK Blockchain.'
spec.homepage = 'https://github.com/ArkEcosystem/ruby-client'
spec.license = 'MIT'

# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
if spec.respond_to?(:metadata)
spec.metadata["allowed_push_host"] = "https://rubygems.org"
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
else
raise "RubyGems 2.0 or newer is required to protect against " \
"public gem pushes."
raise 'RubyGems 2.0 or newer is required to protect against ' \
'public gem pushes.'
end

spec.files = Dir.glob("lib/**/*.rb")
spec.bindir = "exe"
spec.files = Dir.glob('lib/**/*.rb')
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.require_paths = ['lib']

spec.add_development_dependency "bundler", "~> 1.15"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "webmock", "3.0.1"
spec.add_development_dependency 'bundler', '~> 1.15'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'webmock', '3.0.1'

spec.add_dependency 'faraday', "~> 0.12.2"
spec.add_dependency 'faraday_middleware', "~> 0.12.2"
spec.add_dependency 'faraday', '~> 0.12.2'
spec.add_dependency 'faraday_middleware', '~> 0.12.2'
end
6 changes: 3 additions & 3 deletions bin/console
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "arkecosystem/client"
require 'bundler/setup'
require 'arkecosystem/client'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand All @@ -10,5 +10,5 @@ require "arkecosystem/client"
# require "pry"
# Pry.start

require "irb"
require 'irb'
IRB.start(__FILE__)
1 change: 1 addition & 0 deletions lib/arkecosystem/client/api/base.rb
Expand Up @@ -3,6 +3,7 @@
module ArkEcosystem
module Client
module API
# The base for any API resources.
class Base
# Create a new resource instance.
#
Expand Down
8 changes: 4 additions & 4 deletions lib/arkecosystem/client/api/one/accounts.rb
Expand Up @@ -15,7 +15,7 @@ class Accounts < Base
#
# @return [Faraday::Response]
def balance(address)
@client.get('accounts/getBalance', { address: address })
@client.get('accounts/getBalance', address: address)
end

# Get the public key for the given address.
Expand All @@ -24,7 +24,7 @@ def balance(address)
#
# @return [Faraday::Response]
def public_key(address)
@client.get('accounts/getPublickey', { address: address })
@client.get('accounts/getPublickey', address: address)
end

# Get the delegate by the given address.
Expand All @@ -33,7 +33,7 @@ def public_key(address)
#
# @return [Faraday::Response]
def delegate(address)
@client.get('accounts/delegates', { address: address })
@client.get('accounts/delegates', address: address)
end

# Get the delegate registration fee.
Expand All @@ -49,7 +49,7 @@ def delegates_fee
#
# @return [Faraday::Response]
def account(address)
@client.get('accounts', { address: address })
@client.get('accounts', address: address)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/arkecosystem/client/api/one/blocks.rb
Expand Up @@ -24,7 +24,7 @@ def all(parameters = {})
#
# @return [Faraday::Response]
def show(id)
@client.get('blocks/get', { id: id })
@client.get('blocks/get', id: id)
end

# Get the blockchain epoch.
Expand Down
17 changes: 11 additions & 6 deletions lib/arkecosystem/client/api/one/delegates.rb
Expand Up @@ -36,12 +36,12 @@ def count

# Search all delegates.
#
# @param q [String]
# @param query [String]
# @param parameters [Hash]
#
# @return [Faraday::Response]
def search(q, parameters = {})
@client.get('delegates/search', { q: q }.merge(parameters))
def search(query, parameters = {})
@client.get('delegates/search', { q: query }.merge(parameters))
end

# Get the voters for the given delegate.
Expand All @@ -51,7 +51,9 @@ def search(q, parameters = {})
#
# @return [Faraday::Response]
def voters(public_key, parameters = {})
@client.get('delegates/voters', { publicKey: public_key }.merge(parameters))
mandatory = { publicKey: public_key }

@client.get('delegates/voters', mandatory.merge(parameters))
end

# Get the delegate registration fee.
Expand All @@ -69,7 +71,8 @@ def fee
#
# @return [Faraday::Response]
def forged_by_account(generator_public_key)
@client.get('delegates/forging/getForgedByAccount', { generatorPublicKey: generator_public_key })
parameters = { generatorPublicKey: generator_public_key }
@client.get('delegates/forging/getForgedByAccount', parameters)
end

# Get a list of the next forgers.
Expand All @@ -88,7 +91,9 @@ def next_forgers
#
# @return [Faraday::Response]
def forging_status(public_key, parameters = {})
@client.get('delegates/forging/status', { publicKey: public_key }.merge(parameters))
mandatory = { publicKey: public_key }

@client.get('delegates/forging/status', mandatory.merge(parameters))
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/arkecosystem/client/api/one/peers.rb
Expand Up @@ -20,12 +20,12 @@ def all(parameters = {})

# Get the peer by the given ip and port.
#
# @param ip [String]
# @param ip_addr [String]
# @param port [Integer]
#
# @return [Faraday::Response]
def show(ip, port)
@client.get('peers/get', { ip: ip, port: port })
def show(ip_addr, port)
@client.get('peers/get', ip: ip_addr, port: port)
end

# Get the node version of the peer.
Expand Down
4 changes: 2 additions & 2 deletions lib/arkecosystem/client/api/one/transactions.rb
Expand Up @@ -24,7 +24,7 @@ def all(parameters = {})
#
# @return [Faraday::Response]
def show(id)
@client.get('transactions/get', { id: id })
@client.get('transactions/get', id: id)
end

# Get all unconfirmed transactions.
Expand All @@ -42,7 +42,7 @@ def all_unconfirmed(parameters = {})
#
# @return [Faraday::Response]
def show_unconfirmed(id)
@client.get('transactions/unconfirmed/get', { id: id })
@client.get('transactions/unconfirmed/get', id: id)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/arkecosystem/client/api/two/blocks.rb
Expand Up @@ -15,7 +15,7 @@ class Blocks < Base
#
# @return [Faraday::Response]
def all(parameters = {})
@client.get("blocks", parameters)
@client.get('blocks', parameters)
end

# Get the block by the given id.
Expand Down Expand Up @@ -43,7 +43,7 @@ def transactions(id, parameters = {})
#
# @return [Faraday::Response]
def search(parameters)
@client.post("blocks/search", parameters)
@client.post('blocks/search', parameters)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/arkecosystem/client/api/two/delegates.rb
Expand Up @@ -15,7 +15,7 @@ class Delegates < Base
#
# @return [Faraday::Response]
def all(parameters = {})
@client.get("delegates", parameters)
@client.get('delegates', parameters)
end

# Get the delegate by the given id.
Expand Down
6 changes: 3 additions & 3 deletions lib/arkecosystem/client/api/two/node.rb
Expand Up @@ -13,21 +13,21 @@ class Node < Base
#
# @return [Faraday::Response]
def status
@client.get("node/status")
@client.get('node/status')
end

# Get the loader syncing status.
#
# @return [Faraday::Response]
def syncing
@client.get("node/syncing")
@client.get('node/syncing')
end

# Get the loader configuration.
#
# @return [Faraday::Response]
def configuration
@client.get("node/configuration")
@client.get('node/configuration')
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/arkecosystem/client/api/two/peers.rb
Expand Up @@ -15,16 +15,16 @@ class Peers < Base
#
# @return [Faraday::Response]
def all(parameters = {})
@client.get("peers", parameters)
@client.get('peers', parameters)
end

# Get the peer by the given ip.
#
# @param ip [String]
# @param ip_addr [String]
#
# @return [Faraday::Response]
def show(ip)
@client.get("peers/#{ip}")
def show(ip_addr)
@client.get("peers/#{ip_addr}")
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions lib/arkecosystem/client/api/two/transactions.rb
Expand Up @@ -15,7 +15,7 @@ class Transactions < Base
#
# @return [Faraday::Response]
def all(parameters = {})
@client.get("transactions", parameters)
@client.get('transactions', parameters)
end

# Create new transactions.
Expand All @@ -24,7 +24,7 @@ def all(parameters = {})
#
# @return [Faraday::Response]
def create(parameters)
@client.post("transactions", parameters)
@client.post('transactions', parameters)
end

# Get the transaction by the given id.
Expand All @@ -42,7 +42,7 @@ def show(id)
#
# @return [Faraday::Response]
def all_unconfirmed(parameters = {})
@client.get("transactions/unconfirmed", parameters)
@client.get('transactions/unconfirmed', parameters)
end

# Get the unconfirmed transaction by the given id.
Expand All @@ -60,14 +60,14 @@ def show_unconfirmed(id)
#
# @return [Faraday::Response]
def search(parameters)
@client.post("transactions/search", parameters)
@client.post('transactions/search', parameters)
end

# Get a list of all transaction types.
#
# @return [Faraday::Response]
def types
@client.get("transactions/types")
@client.get('transactions/types')
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/arkecosystem/client/api/two/votes.rb
Expand Up @@ -15,7 +15,7 @@ class Votes < Base
#
# @return [Faraday::Response]
def all(parameters = {})
@client.get("votes", parameters)
@client.get('votes', parameters)
end

# Get the vote by the given id.
Expand Down
6 changes: 3 additions & 3 deletions lib/arkecosystem/client/api/two/wallets.rb
Expand Up @@ -15,7 +15,7 @@ class Wallets < Base
#
# @return [Faraday::Response]
def all(parameters = {})
@client.get("wallets", parameters)
@client.get('wallets', parameters)
end

# Get all wallets sorted by balance.
Expand All @@ -24,7 +24,7 @@ def all(parameters = {})
#
# @return [Faraday::Response]
def top(parameters = {})
@client.get("wallets/top", parameters)
@client.get('wallets/top', parameters)
end

# Get the wallet by the given id.
Expand Down Expand Up @@ -81,7 +81,7 @@ def votes(id)
#
# @return [Faraday::Response]
def search(parameters)
@client.post("wallets/search", parameters)
@client.post('wallets/search', parameters)
end
end
end
Expand Down

0 comments on commit 17b8b80

Please sign in to comment.