Skip to content

Commit

Permalink
Remove log-me dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
prodis committed Nov 18, 2018
1 parent 1ec5a0c commit 526f64f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 32 deletions.
1 change: 0 additions & 1 deletion correios-cep.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 21,6 @@ Gem::Specification.new do |spec|
spec.platform = Gem::Platform::RUBY
spec.required_ruby_version = Gem::Requirement.new('>= 2.2.0')

spec.add_dependency 'log-me', '~> 0.0.10'
spec.add_dependency 'ox', '~> 2.9'
spec.add_dependency 'http', '~> 4.0.0'

Expand Down
3 changes: 0 additions & 3 deletions lib/correios/cep.rb
Original file line number Diff line number Diff line change
@@ -1,9 1,6 @@
# frozen_string_literal: true
require 'log-me'

module Correios
module CEP
extend LogMe
extend Correios::CEP::Config
end
end
15 changes: 8 additions & 7 deletions lib/correios/cep/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 5,19 @@ module Config
WEB_SERVICE_URL = 'https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente'
DEFAULT_REQUEST_TIMEOUT = 5 # seconds

attr_writer :web_service_url, :proxy_url, :request_timeout
attr_accessor :logger, :proxy_url
attr_writer :request_timeout, :web_service_url

def web_service_url
@web_service_url ||= WEB_SERVICE_URL
def request_timeout
(@request_timeout ||= DEFAULT_REQUEST_TIMEOUT).to_i
end

def proxy_url
@proxy_url ||= ''
def web_service_url
@web_service_url ||= WEB_SERVICE_URL
end

def request_timeout
(@request_timeout ||= DEFAULT_REQUEST_TIMEOUT).to_i
def configure
yield self if block_given?
end
end
end
Expand Down
21 changes: 0 additions & 21 deletions spec/correios/cep_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 20,6 @@
end
end

describe '#proxy_url' do
it 'default is empty' do
expect(Correios::CEP.proxy_url).to eq ''
end

context 'when set proxy URL' do
let(:url) { 'http://10.20.30.40:8888' }

around do |example|
Correios::CEP.proxy_url = url
example.run
Correios::CEP.proxy_url = ''
end

it 'returns the given proxy URL' do
expect(Correios::CEP.proxy_url).to eq url
end
end
end

describe "#request_timeout" do
it "default is 5" do
expect(Correios::CEP.request_timeout).to eq 5
Expand All @@ -58,4 38,3 @@
end
end
end

0 comments on commit 526f64f

Please sign in to comment.