pombo 1.0.0.beta → 1.0.0.pre.alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/README.md +17 -205
- data/lib/pombo/configuration.rb +6 -29
- data/lib/pombo/exception.rb +1 -10
- data/lib/pombo/package/format.rb +10 -30
- data/lib/pombo/package/item.rb +0 -5
- data/lib/pombo/package.rb +5 -53
- data/lib/pombo/services.rb +35 -71
- data/lib/pombo/support.rb +1 -14
- data/lib/pombo/version.rb +1 -1
- data/lib/pombo/webservice/base.rb +1 -6
- data/lib/pombo/webservice/cpp/base_request.rb +0 -3
- data/lib/pombo/webservice/cpp/delivery_time_request.rb +1 -2
- data/lib/pombo/webservice/cpp/response.rb +2 -6
- data/lib/pombo/webservice/cpp/{service_response.rb → service.rb} +3 -6
- data/lib/pombo/webservice/cpp/shipping_request.rb +0 -2
- data/lib/pombo/webservice/cpp/shipping_value_request.rb +23 -2
- data/lib/pombo/webservice/cpp.rb +8 -9
- data/lib/pombo/webservice.rb +0 -1
- data/lib/pombo.rb +19 -32
- data/pombo.gemspec +15 -17
- metadata +7 -42
- data/CHANGELOG.md +0 -12
- data/lib/pombo/logger.rb +0 -17
- data/locales/en.yml +0 -87
- data/locales/pt-br.yml +0 -87
- data/readmes/README-EN.md +0 -223
data/lib/pombo/support.rb
CHANGED
@@ -1,26 +1,13 @@
|
|
1
1
|
module Pombo
|
2
|
-
# Generic methods
|
3
2
|
module Support
|
4
3
|
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE']
|
5
4
|
FALSE_VALUES = [false, 0, '0', 'f', 'F', 'false', 'FALSE']
|
6
5
|
|
7
|
-
# Convert the string of Brazilian currency to float
|
8
|
-
# @return [String] the converted string pattern R$ (unit brazilian) to pattern Float.
|
9
|
-
# @raise [TypeError] if the value is not a String
|
10
|
-
# @example
|
11
|
-
# Pombo::Support.str_real_to_float('2,00')
|
12
|
-
# # => '2.00'
|
13
6
|
def self.str_real_to_float(value)
|
14
7
|
raise TypeError, "no implicit conversion of #{ value.class.name } into String" unless value.kind_of? String
|
15
|
-
value.
|
8
|
+
value.gsub(',','.').to_f
|
16
9
|
end
|
17
10
|
|
18
|
-
# Used to convert Boolean values to String
|
19
|
-
# @param [Boolean] the value to be converted
|
20
|
-
# @return [String] the string representation of a boolean. 'S' to +true+ and 'N' to +false+
|
21
|
-
# @example
|
22
|
-
# Pombo::Support.boolean_to_string(true)
|
23
|
-
# # => 'S'
|
24
11
|
def self.boolean_to_string(value)
|
25
12
|
value ? 'S' : 'N'
|
26
13
|
end
|
data/lib/pombo/version.rb
CHANGED
@@ -3,12 +3,9 @@ require 'net/http'
|
|
3
3
|
|
4
4
|
module Pombo
|
5
5
|
module Webservice
|
6
|
-
# Class contains the base to make requests
|
7
|
-
# @abstract
|
8
6
|
class Base
|
9
7
|
|
10
8
|
def self.get(url, request = nil)
|
11
|
-
Pombo.logger.info('start_request.webservice') { "GET - #{ url }" }
|
12
9
|
uri = URI.parse url
|
13
10
|
uri.query = request.to_param unless request.nil?
|
14
11
|
http_request = Net::HTTP::Get.new uri
|
@@ -25,9 +22,7 @@ module Pombo
|
|
25
22
|
http = Net::HTTP.new host, port
|
26
23
|
#http.set_debug_output($stdout)
|
27
24
|
http.open_timeout = Pombo.configurations.request_timeout
|
28
|
-
|
29
|
-
Pombo.logger.info('end_request.webservice') { response.inspect }
|
30
|
-
response
|
25
|
+
http.request(http_request)
|
31
26
|
end
|
32
27
|
end
|
33
28
|
end
|
@@ -3,15 +3,12 @@ require 'uri'
|
|
3
3
|
module Pombo
|
4
4
|
module Webservice
|
5
5
|
class CPP
|
6
|
-
# Class to create the requests for services
|
7
|
-
# @abstract
|
8
6
|
class BaseRequest
|
9
7
|
|
10
8
|
def initialize(package)
|
11
9
|
@package = package
|
12
10
|
end
|
13
11
|
|
14
|
-
# Encodes the request for http format
|
15
12
|
def to_param
|
16
13
|
URI.encode_www_form to_hash
|
17
14
|
end
|
@@ -3,9 +3,8 @@ require 'uri'
|
|
3
3
|
module Pombo
|
4
4
|
module Webservice
|
5
5
|
class CPP
|
6
|
-
# Request for delivery time service
|
7
6
|
class DeliveryTimeRequest < BaseRequest
|
8
|
-
|
7
|
+
|
9
8
|
def to_hash
|
10
9
|
{
|
11
10
|
nCdServico: @package.services.join(','),
|
@@ -2,22 +2,18 @@ require 'sax-machine'
|
|
2
2
|
|
3
3
|
module Pombo
|
4
4
|
module Webservice
|
5
|
-
# Class representing the webservice for consulting services
|
6
5
|
class CPP
|
7
|
-
# Performs the parse of the server response
|
8
6
|
class ParseService
|
9
7
|
include SAXMachine
|
10
|
-
elements :cServico, as: :services, class: Pombo::Webservice::CPP::
|
8
|
+
elements :cServico, as: :services, class: Pombo::Webservice::CPP::Service
|
11
9
|
end
|
12
10
|
|
13
|
-
# Comes the response from the server
|
14
11
|
class Response
|
12
|
+
|
15
13
|
def initialize(http_response)
|
16
14
|
@http_response = http_response
|
17
15
|
end
|
18
16
|
|
19
|
-
# Contains services found
|
20
|
-
# @return [Array<Pombo::Webservice::CPP::ServiceResponse>] the services found
|
21
17
|
def body
|
22
18
|
response = Pombo::Webservice::CPP::ParseService.parse @http_response.body
|
23
19
|
response.services
|
@@ -3,8 +3,7 @@ require 'sax-machine'
|
|
3
3
|
module Pombo
|
4
4
|
module Webservice
|
5
5
|
class CPP
|
6
|
-
|
7
|
-
class ServiceResponse
|
6
|
+
class Service
|
8
7
|
include SAXMachine
|
9
8
|
|
10
9
|
element :Codigo, as: :code
|
@@ -30,10 +29,8 @@ module Pombo
|
|
30
29
|
element :EntregaSabado, as: :delivery_sartuday do |value|
|
31
30
|
value == 'S'
|
32
31
|
end
|
33
|
-
element :Erro, as: :error_code
|
34
|
-
element :MsgErro, as: :error_message
|
35
|
-
Pombo.t "webservices.cpp.errors.#{ error_code }"
|
36
|
-
end
|
32
|
+
element :Erro, as: :error_code
|
33
|
+
element :MsgErro, as: :error_message
|
37
34
|
element :obsFim, as: :comments
|
38
35
|
end
|
39
36
|
end
|
@@ -3,10 +3,8 @@ require 'uri'
|
|
3
3
|
module Pombo
|
4
4
|
module Webservice
|
5
5
|
class CPP
|
6
|
-
# Request for shipping service
|
7
6
|
class ShippingRequest < BaseRequest
|
8
7
|
|
9
|
-
# Convert the object to the format accepted in webservice Correios
|
10
8
|
def to_hash
|
11
9
|
{
|
12
10
|
nCdEmpresa: Pombo.configurations.contract_code.to_s,
|
@@ -1,8 +1,29 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
1
3
|
module Pombo
|
2
4
|
module Webservice
|
3
5
|
class CPP
|
4
|
-
|
5
|
-
|
6
|
+
class ShippingValueRequest < BaseRequest
|
7
|
+
|
8
|
+
def to_hash
|
9
|
+
{
|
10
|
+
nCdEmpresa: Pombo.configurations.contract_code.to_s,
|
11
|
+
sDsSenha: Pombo.configurations.password.to_s,
|
12
|
+
nCdServico: @package.services.join(','),
|
13
|
+
sCepOrigem: @package.origin_zip_code,
|
14
|
+
sCepDestino: @package.destination_zip_code,
|
15
|
+
nVlPeso: @package.weight,
|
16
|
+
nCdFormato: @package.format,
|
17
|
+
nVlComprimento: @package.length,
|
18
|
+
nVlAltura: @package.height,
|
19
|
+
nVlLargura: @package.width,
|
20
|
+
nVlDiametro: @package.diameter,
|
21
|
+
sCdMaoPropria: Pombo::Support.boolean_to_string(@package.in_hand?),
|
22
|
+
nVlValorDeclarado: @package.declared_value,
|
23
|
+
sCdAvisoRecebimento: Pombo::Support.boolean_to_string(@package.delivery_notice?)
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
6
27
|
end
|
7
28
|
end
|
8
29
|
end
|
data/lib/pombo/webservice/cpp.rb
CHANGED
@@ -7,21 +7,20 @@ module Pombo
|
|
7
7
|
URL = "#{ PROTOCOL }://#{ HOST }/calculador/CalcPrecoPrazo.asmx"
|
8
8
|
|
9
9
|
def self.shipping(package)
|
10
|
-
|
10
|
+
url = "#{ URL }/CalcPrecoPrazo"
|
11
|
+
response = Response.new get(url, ShippingRequest.new(package))
|
12
|
+
response.body
|
11
13
|
end
|
12
14
|
|
13
15
|
def self.delivery_time(package)
|
14
|
-
|
16
|
+
url = "#{ URL }/CalcPrazo"
|
17
|
+
response = Response.new get(url, DeliveryTimeRequest.new(package))
|
18
|
+
response.body
|
15
19
|
end
|
16
20
|
|
17
21
|
def self.shipping_value(package)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def self.resource(url, request)
|
24
|
-
response = Response.new get(url, request)
|
22
|
+
url = "#{ URL }/CalcPreco"
|
23
|
+
response = Response.new get(url, ShippingValueRequest.new(package))
|
25
24
|
response.body
|
26
25
|
end
|
27
26
|
end
|
data/lib/pombo/webservice.rb
CHANGED
data/lib/pombo.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
require 'i18n'
|
2
|
-
I18n.load_path += Dir[File.expand_path('../../locales/*.yml', __FILE__)]
|
3
|
-
|
4
1
|
require 'pombo/version'
|
5
|
-
require 'pombo/logger'
|
6
2
|
require 'pombo/configuration'
|
7
3
|
require 'pombo/exception'
|
8
4
|
require 'pombo/support'
|
@@ -12,26 +8,39 @@ require 'pombo/package/item'
|
|
12
8
|
require 'pombo/package/format'
|
13
9
|
require 'pombo/webservice/base'
|
14
10
|
require 'pombo/webservice/cpp'
|
15
|
-
require 'pombo/webservice/cpp/
|
11
|
+
require 'pombo/webservice/cpp/service'
|
16
12
|
require 'pombo/webservice/cpp/response'
|
17
13
|
require 'pombo/webservice/cpp/base_request'
|
18
14
|
require 'pombo/webservice/cpp/shipping_request'
|
19
15
|
require 'pombo/webservice/cpp/shipping_value_request'
|
20
16
|
require 'pombo/webservice/cpp/delivery_time_request'
|
21
17
|
|
22
|
-
# It allows you to configure and perform consulting delivery services
|
23
|
-
#
|
24
|
-
# For more information read the file {file:/readmes/README-EN.md}
|
25
18
|
module Pombo
|
26
19
|
# Inform settings for persisting with default
|
27
|
-
# @yield [config] with the configuration data
|
28
|
-
# @
|
20
|
+
# @yield [config] with the configuration data
|
21
|
+
# @option config [String] :contract_code Its administrative code by the ECT
|
22
|
+
# @option config [String] :password Password to access the service, associated with its contract code
|
23
|
+
# @option config [Integer] :extends_delivery Days late on a package
|
24
|
+
# @option config [Integer] :request_timeout Second delay when accessing the webservice
|
25
|
+
# @option config [Symbol] :log_level Log Level, `:info`, `:debug` or `warn`
|
26
|
+
# @option config [Symbol] :logger object to trigger messages (defaults to `:logger`)
|
27
|
+
#
|
28
|
+
# @example
|
29
|
+
# Pombo.setup do |config|
|
30
|
+
# config.contract_code = 'AA99BB'
|
31
|
+
# config.password = '999999'
|
32
|
+
# config.extends_delivery = 0
|
33
|
+
# config.request_timeout = 5
|
34
|
+
# config.log_level = :info
|
35
|
+
# config.logger = :logger
|
36
|
+
# end
|
29
37
|
def self.setup(&block)
|
30
38
|
Configuration.setup(&block)
|
31
39
|
end
|
32
40
|
|
33
41
|
# Tells the settings that will be used at this time
|
34
42
|
# @note Does not modify the default settings
|
43
|
+
# @options (see .setup)
|
35
44
|
# @return [Pombo::Configuration] current settings
|
36
45
|
def self.set(**args)
|
37
46
|
@@configurations = Configuration.new args
|
@@ -42,37 +51,15 @@ module Pombo
|
|
42
51
|
@@configurations ||= Configuration.new
|
43
52
|
end
|
44
53
|
|
45
|
-
# Perform the quotation of delivery of consulting services value and delivery time
|
46
|
-
# @param package [Pombo::Package] the package to be consulted
|
47
|
-
# @return [Array<Pombo::Webservice::CPP::ServiceResponse>]
|
48
54
|
def self.shipping(package)
|
49
55
|
Webservice::CPP.shipping(package)
|
50
56
|
end
|
51
57
|
|
52
|
-
# Perform the quotation of delivery of consulting delivery time
|
53
|
-
# @param package [Pombo::Package] the package to be consulted
|
54
|
-
# @return [Array<Pombo::Webservice::CPP::ServiceResponse>]
|
55
58
|
def self.delivery_time(package)
|
56
59
|
Webservice::CPP.delivery_time(package)
|
57
60
|
end
|
58
61
|
|
59
|
-
# Perform the quotation of delivery of consulting services value
|
60
|
-
# @param package [Pombo::Package] the package to be consulted
|
61
|
-
# @return [Array<Pombo::Webservice::CPP::ServiceResponse>]
|
62
62
|
def self.shipping_value(package)
|
63
63
|
Webservice::CPP.shipping_value(package)
|
64
64
|
end
|
65
|
-
|
66
|
-
# Performs internationalization for informed locale in settings
|
67
|
-
# @return [String] internationalized text
|
68
|
-
def self.t(*args)
|
69
|
-
I18n.with_locale configurations.locale do
|
70
|
-
I18n.translate args
|
71
|
-
end.first
|
72
|
-
end
|
73
|
-
|
74
|
-
# @return [Pombo::Logger] the default log object Pombo
|
75
|
-
def self.logger
|
76
|
-
configurations.logger
|
77
|
-
end
|
78
65
|
end
|
data/pombo.gemspec
CHANGED
@@ -4,31 +4,29 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'pombo/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = "pombo"
|
8
8
|
spec.version = Pombo::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ["Leandro Nunes"]
|
10
|
+
spec.email = ["leandronunes.dev@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Gem to manage the shipping packages using the webservice of the Correios}
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = "https://github.com/adenaecommerce/pombo"
|
15
15
|
spec.license = 'MIT'
|
16
16
|
spec.platform = Gem::Platform::RUBY
|
17
|
-
spec.required_ruby_version = '~> 2.
|
17
|
+
spec.required_ruby_version = '~> 2.3'
|
18
18
|
|
19
19
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
-
spec.bindir =
|
20
|
+
spec.bindir = "exe"
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
-
spec.require_paths = [
|
22
|
+
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_runtime_dependency
|
25
|
-
spec.add_runtime_dependency
|
26
|
-
spec.add_runtime_dependency 'sax-machine', '~> 1.3'
|
24
|
+
spec.add_runtime_dependency "nokogiri", "~> 1.6"
|
25
|
+
spec.add_runtime_dependency "sax-machine", "~> 1.3"
|
27
26
|
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency
|
32
|
-
spec.add_development_dependency
|
33
|
-
spec.add_development_dependency 'yard', '~> 0.8.7.6'
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
28
|
+
spec.add_development_dependency "rake", "~> 11.1"
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
30
|
+
spec.add_development_dependency "pry", "~> 0.10.3"
|
31
|
+
spec.add_development_dependency "webmock", "~> 1.24"
|
34
32
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pombo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.pre.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Nunes
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: i18n
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.7.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.7.0
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: nokogiri
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,30 +100,15 @@ dependencies:
|
|
114
100
|
requirements:
|
115
101
|
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '2.0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: yard
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 0.8.7.6
|
103
|
+
version: '1.24'
|
132
104
|
type: :development
|
133
105
|
prerelease: false
|
134
106
|
version_requirements: !ruby/object:Gem::Requirement
|
135
107
|
requirements:
|
136
108
|
- - "~>"
|
137
109
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
139
|
-
description:
|
140
|
-
of sending packets to check price, delivery time and progress of service
|
110
|
+
version: '1.24'
|
111
|
+
description: Gem to manage the shipping packages using the webservice of the Correios
|
141
112
|
email:
|
142
113
|
- leandronunes.dev@gmail.com
|
143
114
|
executables: []
|
@@ -148,7 +119,6 @@ files:
|
|
148
119
|
- ".rspec"
|
149
120
|
- ".ruby-version"
|
150
121
|
- ".travis.yml"
|
151
|
-
- CHANGELOG.md
|
152
122
|
- CODE_OF_CONDUCT.md
|
153
123
|
- Gemfile
|
154
124
|
- LICENSE
|
@@ -159,7 +129,6 @@ files:
|
|
159
129
|
- lib/pombo.rb
|
160
130
|
- lib/pombo/configuration.rb
|
161
131
|
- lib/pombo/exception.rb
|
162
|
-
- lib/pombo/logger.rb
|
163
132
|
- lib/pombo/package.rb
|
164
133
|
- lib/pombo/package/format.rb
|
165
134
|
- lib/pombo/package/item.rb
|
@@ -172,14 +141,11 @@ files:
|
|
172
141
|
- lib/pombo/webservice/cpp/base_request.rb
|
173
142
|
- lib/pombo/webservice/cpp/delivery_time_request.rb
|
174
143
|
- lib/pombo/webservice/cpp/response.rb
|
175
|
-
- lib/pombo/webservice/cpp/
|
144
|
+
- lib/pombo/webservice/cpp/service.rb
|
176
145
|
- lib/pombo/webservice/cpp/shipping_request.rb
|
177
146
|
- lib/pombo/webservice/cpp/shipping_value_request.rb
|
178
147
|
- lib/pombo/webservice/sro.rb
|
179
|
-
- locales/en.yml
|
180
|
-
- locales/pt-br.yml
|
181
148
|
- pombo.gemspec
|
182
|
-
- readmes/README-EN.md
|
183
149
|
homepage: https://github.com/adenaecommerce/pombo
|
184
150
|
licenses:
|
185
151
|
- MIT
|
@@ -192,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
158
|
requirements:
|
193
159
|
- - "~>"
|
194
160
|
- !ruby/object:Gem::Version
|
195
|
-
version: '2.
|
161
|
+
version: '2.3'
|
196
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
163
|
requirements:
|
198
164
|
- - ">"
|
@@ -205,4 +171,3 @@ signing_key:
|
|
205
171
|
specification_version: 4
|
206
172
|
summary: Gem to manage the shipping packages using the webservice of the Correios
|
207
173
|
test_files: []
|
208
|
-
has_rdoc:
|
data/CHANGELOG.md
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
## v1.0.0
|
2
|
-
|
3
|
-
#### New features
|
4
|
-
|
5
|
-
* It allows you to change the default settings
|
6
|
-
* It allows you to change the runtime settings
|
7
|
-
* Allows the creation of packages with items
|
8
|
-
* Allows the service value of consultation
|
9
|
-
* Allows consultation of service delivery time
|
10
|
-
* It allows you to see the value and service delivery time
|
11
|
-
* It supports internationalization
|
12
|
-
* Accepts a logger compatible with the interface [Log4r](http://log4r.rubyforge.org/index.html)
|
data/lib/pombo/logger.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'logger'
|
2
|
-
|
3
|
-
module Pombo
|
4
|
-
# Used to extend the Logger class and customize the message
|
5
|
-
# @exemple
|
6
|
-
# Pombo.logger.info('event.namespace'){ 'Any error message' }
|
7
|
-
# # => 2016-05-13 15:15:49 -0300 | POMBO | event.namespace | INFO: Any error message
|
8
|
-
class Logger < ::Logger
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
def format_message(severity, datetime, progname, msg)
|
13
|
-
"#{ datetime } | POMBO | #{ progname } | #{ severity }: #{ msg }\n"
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
data/locales/en.yml
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
---
|
2
|
-
en:
|
3
|
-
services:
|
4
|
-
pac:
|
5
|
-
'41106': PAC (without contract)
|
6
|
-
'41068': PAC (with contract)
|
7
|
-
'41300': PAC (large format)
|
8
|
-
sedex:
|
9
|
-
'40010': SEDEX (without contract)
|
10
|
-
'40045': SEDEX to charge (without contract)
|
11
|
-
'40126': SEDEX to charge (with contract)
|
12
|
-
'40215': SEDEX 10 (without contract)
|
13
|
-
'40290': SEDEX today (without contract)
|
14
|
-
'40096': SEDEX (with contract)
|
15
|
-
'40436': SEDEX (with contract)
|
16
|
-
'40444': SEDEX (with contract)
|
17
|
-
'40568': SEDEX (with contract)
|
18
|
-
'40606': SEDEX (with contract)
|
19
|
-
e_sedex:
|
20
|
-
'81019': E-SEDEX (with contract)
|
21
|
-
'81027': E-SEDEX Priority (with contract)
|
22
|
-
'81035': E-SEDEX Express (with contract)
|
23
|
-
'81868': E-SEDEX (with contract, group 1)
|
24
|
-
'81833': E-SEDEX (with contract, group 2)
|
25
|
-
'81850': E-SEDEX (with contract, group 3)
|
26
|
-
|
27
|
-
formats:
|
28
|
-
'1': Box/Package
|
29
|
-
'2': Roll/Prism
|
30
|
-
'3': Envelope
|
31
|
-
|
32
|
-
webservices:
|
33
|
-
cpp:
|
34
|
-
error:
|
35
|
-
'0': Successfully processing
|
36
|
-
'-1': Invalid service code
|
37
|
-
'-2': invalid origin zip code
|
38
|
-
'-3': Invalid destination zip code
|
39
|
-
'-4': Exceeded weight
|
40
|
-
'-5': The declared value must not exceed R$ 10,000.00
|
41
|
-
'-6': Service unavailable to the informed section
|
42
|
-
'-7': The declared Value is required for this service
|
43
|
-
'-8': This service does not accept hand own
|
44
|
-
'-9': This service does not accept return receipt requested
|
45
|
-
'-10': Pricing unavailable for informed stretch
|
46
|
-
'-11': For price setting should be informed also the length, width and height of the object in centimeters (cm)
|
47
|
-
'-12': Invalid length
|
48
|
-
'-13': Invalid width
|
49
|
-
'-14': Invalid height
|
50
|
-
'-15': The length may not exceed 105 cm
|
51
|
-
'-16': The width can not be larger than 105 cm
|
52
|
-
'-17': The height can not be greater than 105 cm
|
53
|
-
'-18': The height can not be less than 2 cm
|
54
|
-
'-20': The width can not be less than 11 cm
|
55
|
-
'-22': Length can not be less than 16 cm
|
56
|
-
'-23': The resulting sum of the length + width + height must not exceed 200 cm
|
57
|
-
'-24': Invalid length
|
58
|
-
'-25': Invalid diameter
|
59
|
-
'-26': Enter the length
|
60
|
-
'-27': Enter the diameter
|
61
|
-
'-28': The length may not exceed 105 cm
|
62
|
-
'-29': The diameter can not be greater than 91 cm
|
63
|
-
'-30': The length can not be less than 18 cm
|
64
|
-
'-31': The diameter can not be less than 5 cm
|
65
|
-
'-32': The resulting sum of the length + two times the diameter should not exceed 200 cm
|
66
|
-
'-33': System temporarily unavailable. Please try later
|
67
|
-
'-34': Administrative Code or invalid password
|
68
|
-
'-35': Incorrect password
|
69
|
-
'-36': Customer does not have current contract with the Post Office
|
70
|
-
'-37': Customer does not have active service in his contract
|
71
|
-
'-38': Service unavailable for this administrative code
|
72
|
-
'-39': Exceeded weight for the envelope format
|
73
|
-
'-40': For definition of price should be informed, as well, the length and the width and height of the object in centimeters (cm)
|
74
|
-
'-41': The length can not be more than 60 cm
|
75
|
-
'-42': Length can not be less than 16 cm
|
76
|
-
'-43': The resulting sum of the length + width must not exceed 120 cm
|
77
|
-
'-44': The width can not be less than 11 cm
|
78
|
-
'-45': The width may be not greater than 60 cm
|
79
|
-
'-888': Error when calculating the rate
|
80
|
-
'006': City of origin does not cover the given service
|
81
|
-
'007': Destination location does not cover the given service
|
82
|
-
'008': Service unavailable to the informed section
|
83
|
-
'009': Initial zip code belonging to risk area
|
84
|
-
'010': Area delivery temporarily subject to different term
|
85
|
-
'011': initial and final zip code belonging to risk area
|
86
|
-
'7': Service unavailable, try again later
|
87
|
-
'99': An error occurred while processing
|