Skip to content

Commit

Permalink
Cop fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
JFernandezWM committed Jul 27, 2018
1 parent 2f5a9da commit 7175bc4
Show file tree
Hide file tree
Showing 47 changed files with 314 additions and 314 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true
source 'https://rubygems.org'
source "https://rubygems.org"

# Specify your gem's dependencies in agris.gemspec
gemspec
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rubocop/rake_task"

RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new
Expand Down
38 changes: 19 additions & 19 deletions agris.gemspec
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'agris/version'
require "agris/version"

Gem::Specification.new do |spec|
spec.name = 'agris'
spec.name = "agris"
spec.version = Agris::VERSION
spec.authors = ['John Gray', 'Joseph Bridgwater-Rowe']
spec.email = ['wopr42@gmail.com', 'freakyjoe@gmail.com']
spec.authors = ["John Gray", "Joseph Bridgwater-Rowe"]
spec.email = ["wopr42@gmail.com", "freakyjoe@gmail.com"]

spec.summary = 'Ruby client library for Agris API'
spec.homepage = 'https://github.com/westernmilling/agris.rb'
spec.license = 'MIT'
spec.summary = "Ruby client library for Agris API"
spec.homepage = "https://github.com/westernmilling/agris.rb"
spec.license = "MIT"

spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = 'exe'
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
spec.require_paths = ["lib"]

spec.add_dependency 'savon', '~> 2.11'
spec.add_dependency "savon", "~> 2.11"

spec.add_development_dependency 'bundler', '~> 1.14'
spec.add_development_dependency 'pry-byebug'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rspec_junit_formatter'
spec.add_development_dependency 'rubocop', '0.54.0'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'webmock', '~> 2.3'
spec.add_development_dependency "bundler", "~> 1.14"
spec.add_development_dependency "pry-byebug"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rspec_junit_formatter"
spec.add_development_dependency "rubocop", "0.54.0"
spec.add_development_dependency "simplecov"
spec.add_development_dependency "webmock", "~> 2.3"
end
24 changes: 12 additions & 12 deletions lib/agris.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true
$LOAD_PATH.unshift File.dirname(__FILE__)

require 'hash'
require 'savon'
require "hash"
require "savon"

module Agris
class ApiError < StandardError; end
Expand Down Expand Up @@ -44,17 +44,17 @@ def configure
end

def root
File.expand_path('..', __dir__)
File.expand_path("..", __dir__)
end
end

autoload :Api, 'agris/api'
autoload :Client, 'agris/client'
autoload :Context, 'agris/context'
autoload :Credentials, 'agris/credentials'
autoload :HTTPartyRequest, 'agris/httparty_request'
autoload :ProcessMessageResponse, 'agris/process_message_response'
autoload :SavonRequest, 'agris/savon_request'
autoload :UserAgent, 'agris/user_agent'
autoload :XmlModel, 'agris/xml_model'
autoload :Api, "agris/api"
autoload :Client, "agris/client"
autoload :Context, "agris/context"
autoload :Credentials, "agris/credentials"
autoload :HTTPartyRequest, "agris/httparty_request"
autoload :ProcessMessageResponse, "agris/process_message_response"
autoload :SavonRequest, "agris/savon_request"
autoload :UserAgent, "agris/user_agent"
autoload :XmlModel, "agris/xml_model"
end
30 changes: 15 additions & 15 deletions lib/agris/api.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# frozen_string_literal: true
module Agris
module Api
autoload :AccountsReceivables, 'agris/api/accounts_receivables'
autoload :AccountsPayables, 'agris/api/accounts_payables'
autoload :AccountsReceivables, "agris/api/accounts_receivables"
autoload :AccountsPayables, "agris/api/accounts_payables"
autoload :DocumentQueryResponse,
'agris/api/document_query_response'
autoload :Grain, 'agris/api/grain'
autoload :Inventory, 'agris/api/inventory'
autoload :Messages, 'agris/api/messages'
autoload :NewOrder, 'agris/api/new_order'
autoload :NewOrderRemark, 'agris/api/new_order_remark'
autoload :NewVoucher, 'agris/api/new_voucher'
autoload :Order, 'agris/api/order'
autoload :OrderLine, 'agris/api/order_line'
autoload :PostResult, 'agris/api/post_result'
autoload :Remark, 'agris/api/remark'
autoload :Support, 'agris/api/support'
autoload :TranCode, 'agris/api/tran_code'
"agris/api/document_query_response"
autoload :Grain, "agris/api/grain"
autoload :Inventory, "agris/api/inventory"
autoload :Messages, "agris/api/messages"
autoload :NewOrder, "agris/api/new_order"
autoload :NewOrderRemark, "agris/api/new_order_remark"
autoload :NewVoucher, "agris/api/new_voucher"
autoload :Order, "agris/api/order"
autoload :OrderLine, "agris/api/order_line"
autoload :PostResult, "agris/api/post_result"
autoload :Remark, "agris/api/remark"
autoload :Support, "agris/api/support"
autoload :TranCode, "agris/api/tran_code"
end
end
6 changes: 3 additions & 3 deletions lib/agris/api/accounts_receivables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
module Agris
module Api
module AccountsReceivables
autoload :Invoice, 'agris/api/accounts_receivables/invoice'
autoload :Invoices, 'agris/api/accounts_receivables/invoices'
autoload :Invoice, "agris/api/accounts_receivables/invoice"
autoload :Invoices, "agris/api/accounts_receivables/invoices"
autoload :SpecificInvoiceExtract,
'agris/api/accounts_receivables/specific_invoice_extract'
"agris/api/accounts_receivables/specific_invoice_extract"
end
end
end
4 changes: 2 additions & 2 deletions lib/agris/api/accounts_receivables/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ class Invoice

def self.from_xml_hash(hash)
super.tap do |document|
if hash['lineitems']
if hash["lineitems"]
document.line_items.concat(
[hash['lineitems']['lineitem']]
[hash["lineitems"]["lineitem"]]
.flatten
.map do |lineitem|
LineItem.from_xml_hash(lineitem)
Expand Down
10 changes: 5 additions & 5 deletions lib/agris/api/document_query_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def initialize(output_hash, resource_type = nil)
def last_request_date_time
Time.parse(
@output_hash[pluralized_resource_name] \
['system'] \
['lastrequestdatetime']
["system"] \
["lastrequestdatetime"]
)
end

Expand All @@ -32,7 +32,7 @@ def parse
def resource_name
@resource_name ||= resource_type
.name
.split('::')
.split("::")
.last
.downcase
end
Expand All @@ -46,9 +46,9 @@ def resource_type
self
.class
.name
.split('::')
.split("::")
.last
.chomp('ExtractResponse')
.chomp("ExtractResponse")
)
end

Expand Down
20 changes: 10 additions & 10 deletions lib/agris/api/grain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
module Agris
module Api
module Grain
autoload :Commodity, 'agris/api/grain/commodity'
autoload :CommodityCodes, 'agris/api/grain/commodity_codes'
autoload :Contract, 'agris/api/grain/contract'
autoload :PurchaseContracts, 'agris/api/grain/purchase_contracts'
autoload :NewTicket, 'agris/api/grain/new_ticket'
autoload :NewTicketApplication, 'agris/api/grain/new_ticket_application'
autoload :NewTicketRemark, 'agris/api/grain/new_ticket_remark'
autoload :Commodity, "agris/api/grain/commodity"
autoload :CommodityCodes, "agris/api/grain/commodity_codes"
autoload :Contract, "agris/api/grain/contract"
autoload :PurchaseContracts, "agris/api/grain/purchase_contracts"
autoload :NewTicket, "agris/api/grain/new_ticket"
autoload :NewTicketApplication, "agris/api/grain/new_ticket_application"
autoload :NewTicketRemark, "agris/api/grain/new_ticket_remark"
autoload :SpecificCommodityCodeExtract,
'agris/api/grain/specific_commodity_code_extract'
"agris/api/grain/specific_commodity_code_extract"
autoload :SpecificPurchaseContractExtract,
'agris/api/grain/specific_purchase_contract_extract'
"agris/api/grain/specific_purchase_contract_extract"
autoload :Tickets,
'agris/api/grain/tickets'
"agris/api/grain/tickets"
end
end
end
2 changes: 1 addition & 1 deletion lib/agris/api/grain/commodity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Commodity
include XmlModel

def self.pluralized_name
'commodities'
"commodities"
end

ATTRIBUTE_NAMES = %w(
Expand Down
2 changes: 1 addition & 1 deletion lib/agris/api/grain/commodity_codes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Agris
module Api
module Grain
module CommodityCodes
def commodity_code(location = '', code = '')
def commodity_code(location = "", code = "")
extract = Agris::Api::Grain::SpecificCommodityCodeExtract
.new(location, code)

Expand Down
8 changes: 4 additions & 4 deletions lib/agris/api/grain/contract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ class Contract

def self.from_xml_hash(hash)
super.tap do |document|
if hash['schedules']
if hash["schedules"]
document.schedules.concat(
[hash['schedules']['schedule']]
[hash["schedules"]["schedule"]]
.flatten
.map do |schedule|
Schedule.from_xml_hash(schedule)
Expand All @@ -82,9 +82,9 @@ def self.from_xml_hash(hash)

def self.from_json_hash(hash)
super.tap do |contract|
if hash['schedules']
if hash["schedules"]
contract.schedules.concat(
hash['schedules'].map do |schedule|
hash["schedules"].map do |schedule|
Schedule.from_json_hash(schedule)
end
)
Expand Down
2 changes: 1 addition & 1 deletion lib/agris/api/grain/new_ticket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class NewTicket
def initialize(hash = {})
super

@record_type = 'GRNT0'
@record_type = "GRNT0"
end

def add_application(application)
Expand Down
2 changes: 1 addition & 1 deletion lib/agris/api/grain/new_ticket_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class NewTicketApplication
def initialize(hash = {})
super

@record_type = 'GRNT1'
@record_type = "GRNT1"
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/agris/api/grain/new_ticket_remark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class NewTicketRemark
def initialize(hash = {})
super

@record_type = 'GRNT2'
@record_type = "GRNT2"
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions lib/agris/api/inventory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
module Agris
module Api
module Inventory
autoload :DeliveryTicket, 'agris/api/inventory/delivery_ticket'
autoload :DeliveryTicket, "agris/api/inventory/delivery_ticket"
autoload :DeliveryTicketLineItem,
'agris/api/inventory/delivery_ticket_line_item'
autoload :DeliveryTickets, 'agris/api/inventory/delivery_tickets'
autoload :Orders, 'agris/api/inventory/orders'
"agris/api/inventory/delivery_ticket_line_item"
autoload :DeliveryTickets, "agris/api/inventory/delivery_tickets"
autoload :Orders, "agris/api/inventory/orders"
autoload :SpecificDeliveryTicketExtract,
'agris/api/inventory/specific_delivery_ticket_extract'
"agris/api/inventory/specific_delivery_ticket_extract"
autoload :SpecificOrderExtract,
'agris/api/inventory/specific_order_extract'
"agris/api/inventory/specific_order_extract"
end
end
end
12 changes: 6 additions & 6 deletions lib/agris/api/inventory/delivery_ticket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,27 @@ class DeliveryTicket

def self.from_xml_hash(hash)
super.tap do |delivery_ticket|
if hash['lineitems']
if hash["lineitems"]
delivery_ticket.line_items.concat(
[hash['lineitems']['lineitem']]
[hash["lineitems"]["lineitem"]]
.flatten
.map do |lineitem|
DeliveryTicketLineItem.from_xml_hash(lineitem)
end
)
end
if hash['remarks']
if hash["remarks"]
delivery_ticket.remarks.concat(
[hash['remarks']['remark']]
[hash["remarks"]["remark"]]
.flatten
.map do |remark|
Agris::Api::Remark.from_xml_hash(remark)
end
)
end
if hash['trancodes']
if hash["trancodes"]
delivery_ticket.tran_codes.concat(
[hash['trancodes']['trancode']]
[hash["trancodes"]["trancode"]]
.flatten
.map do |trancode|
Agris::Api::TranCode.from_xml_hash(trancode)
Expand Down
2 changes: 1 addition & 1 deletion lib/agris/api/inventory/orders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def create_order(order)
PostResult.new(response)
end

def order(order_location, order_number, order_type = 'S')
def order(order_location, order_number, order_type = "S")
extract = SpecificOrderExtract.new(
order_location, order_number, order_type
)
Expand Down
Loading

0 comments on commit 7175bc4

Please sign in to comment.