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.
data/locales/pt-br.yml DELETED
@@ -1,87 +0,0 @@
1
- ---
2
- pt-BR:
3
- services:
4
- pac:
5
- '41106': PAC (sem contrato)
6
- '41068': PAC (com contrato)
7
- '41300': PAC (grandes formatos)
8
- sedex:
9
- '40010': SEDEX (sem contrato)
10
- '40045': SEDEX a cobrar (sem contrato)
11
- '40126': SEDEX a cobrar (com contrato)
12
- '40215': SEDEX 10 (sem contrato)
13
- '40290': SEDEX hoje (sem contrato)
14
- '40096': SEDEX (com contrato)
15
- '40436': SEDEX (com contrato)
16
- '40444': SEDEX (com contrato)
17
- '40568': SEDEX (com contrato)
18
- '40606': SEDEX (com contrato)
19
- e_sedex:
20
- '81019': E-SEDEX (com contrato)
21
- '81027': E-SEDEX Prioritário (com contrato)
22
- '81035': E-SEDEX Express (com contrato)
23
- '81868': E-SEDEX (com contrato, grupo 1)
24
- '81833': E-SEDEX (com contrato, grupo 2)
25
- '81850': E-SEDEX (com contrato, grupo 3)
26
-
27
- formats:
28
- '1': Caixa/Pacote
29
- '2': Rolo/Prisma
30
- '3': Envelope
31
-
32
- webservices:
33
- cpp:
34
- error:
35
- '0': Processamento com sucesso
36
- '-1': Código de serviço inválido
37
- '-2': CEP de origem inválido
38
- '-3': CEP de destino inválido
39
- '-4': Peso excedido
40
- '-5': O Valor Declarado não deve exceder R$ 10.000,00
41
- '-6': Serviço indisponível para o trecho informado
42
- '-7': O Valor Declarado é obrigatório para este serviço
43
- '-8': Este serviço não aceita Mão Própria
44
- '-9': Este serviço não aceita Aviso de Recebimento
45
- '-10': Precificação indisponível para o trecho informado
46
- '-11': Para definição do preço deverão ser informados, também, o comprimento, a largura e altura do objeto em centímetros (cm)
47
- '-12': Comprimento inválido
48
- '-13': Largura inválida
49
- '-14': Altura inválida
50
- '-15': O comprimento não pode ser maior que 105 cm
51
- '-16': A largura não pode ser maior que 105 cm
52
- '-17': A altura não pode ser maior que 105 cm
53
- '-18': A altura não pode ser inferior a 2 cm
54
- '-20': A largura não pode ser inferior a 11 cm
55
- '-22': O comprimento não pode ser inferior a 16 cm
56
- '-23': A soma resultante do comprimento + largura + altura não deve superar a 200 cm
57
- '-24': Comprimento inválido
58
- '-25': Diâmetro inválido
59
- '-26': Informe o comprimento
60
- '-27': Informe o diâmetro
61
- '-28': O comprimento não pode ser maior que 105 cm
62
- '-29': O diâmetro não pode ser maior que 91 cm
63
- '-30': O comprimento não pode ser inferior a 18 cm
64
- '-31': O diâmetro não pode ser inferior a 5 cm
65
- '-32': A soma resultante do comprimento + o dobro do diâmetro não deve superar a 200 cm
66
- '-33': Sistema temporariamente fora do ar. Favor tentar mais tarde
67
- '-34': Código Administrativo ou Senha inválidos
68
- '-35': Senha incorreta
69
- '-36': Cliente não possui contrato vigente com os Correios
70
- '-37': Cliente não possui serviço ativo em seu contrato
71
- '-38': Serviço indisponível para este código administrativo
72
- '-39': Peso excedido para o formato envelope
73
- '-40': Para definicao do preco deverao ser informados, tambem, o comprimento e a largura e altura do objeto em centimetros (cm)
74
- '-41': O comprimento nao pode ser maior que 60 cm
75
- '-42': O comprimento nao pode ser inferior a 16 cm
76
- '-43': A soma resultante do comprimento + largura nao deve superar a 120 cm
77
- '-44': A largura nao pode ser inferior a 11 cm
78
- '-45': A largura nao pode ser maior que 60 cm
79
- '-888': Erro ao calcular a tarifa
80
- '006': Localidade de origem não abrange o serviço informado
81
- '007': Localidade de destino não abrange o serviço informado
82
- '008': Serviço indisponível para o trecho informado
83
- '009': CEP inicial pertencente a Área de Risco
84
- '010': Área com entrega temporariamente sujeita a prazo diferenciado
85
- '011': CEP inicial e final pertencentes a Área de Risco
86
- '7': Serviço indisponível, tente mais tarde
87
- '99': Ocorreu um error no processamento
data/readmes/README-EN.md DELETED
@@ -1,223 +0,0 @@
1
- # Pombo
2
-
3
- Pombo is a gem that allows the use of the [Correios](http://correios.com.br/para-voce)
4
- webservice to information query shipping packages.
5
-
6
- ## Features
7
-
8
- * Lets put together a package with multiple items
9
- * Lets see the shipping price of a package
10
- * Lets see the period of sending a packet
11
- * It allows you to check the time and shipping price of a package
12
- * It supports internationalization
13
- * Accepts a logger compatible with the interface [Log4r](http://log4r.rubyforge.org/index.html)
14
-
15
- ## Installation
16
-
17
- $ gem install pombo
18
-
19
- or add a line in your Gemfile
20
-
21
- ```ruby
22
- gem 'pombo', '~> 1.0.0.beta'
23
- ```
24
-
25
- and
26
-
27
- $ bundle install
28
-
29
-
30
- ## Configuration
31
-
32
- > The data returned in sending queries are the same provided at a agency of Correios.
33
- > Companies can hire a differentiated service and use the code of their contract in the use of Pombo.
34
-
35
- To modify the default settings, use the `#setup`
36
-
37
- ```ruby
38
- Pombo.setup do |config|
39
- config.contract_code = 'AA99BB'
40
- config.password = '999999'
41
- config.extends_delivery = 0
42
- config.request_timeout = 5
43
- config.log_level = Pombo::Logger::INFO
44
- config.logger = Pombo::Logger.new(STDOUT)
45
- config.locale = 'pt-BR'
46
- end
47
- ```
48
-
49
- If you need to modify some settings at a certain time, use the `#set`
50
-
51
- ```ruby
52
- Pombo.set request_timeout: 10, locale: 'en'
53
- ```
54
-
55
- > The #set does not modify the default settings
56
-
57
- ## Formats
58
-
59
- The formats are predefined objects to information provided by the Correios.
60
- The Correios works with the following formats: box, envelope and roll. Every item must have a format.
61
-
62
- The packet format is reported as items added. For more than two items prevails box format.
63
-
64
-
65
- List all formats supported by delivery services
66
-
67
- ```ruby
68
- Pombo::Package::Format.all
69
-
70
- # => [
71
- # => #<OpenStruct code=3, name="Envelope", max_length=60, min_length=16, max_width=60, min_width=11, max_weight=1>
72
- # => ....
73
- # => ]
74
- ```
75
-
76
- Find a specific format by code or by name
77
-
78
- ```ruby
79
- Pombo::Package::Format.find '3'
80
- # => #<OpenStruct code=3, name="Envelope", max_length=60, min_length=16, max_width=60, min_width=11, max_weight=1>
81
-
82
- # Or
83
-
84
- Pombo::Package::Format.find 'envelope'
85
- # => #<OpenStruct code=3, name="Envelope", max_length=60, min_length=16, max_width=60, min_width=11, max_weight=1>
86
- ```
87
-
88
- ## Services
89
- Services are predefined objects to information provided by the Post Office. To learn more, [click here](http://www.correios.com.br/para-voce/envio/encomendas/encomendas)
90
-
91
- List all formats supported by delivery services
92
-
93
- ```ruby
94
- Pombo::Services.all
95
-
96
- # => [
97
- # => #<OpenStruct code="41106", max_weight=30, name="PAC", description="PAC (without contract)">,
98
- # => ....
99
- # => ]
100
- ```
101
-
102
- Listing all the services of a group
103
-
104
- ```ruby
105
- Pombo::Services.all :pac
106
- # => [
107
- # => #<OpenStruct code="41106", max_weight=30, name="PAC", description="PAC (without contract)">,
108
- # => ....
109
- # => ]
110
- ```
111
-
112
- Search for a service code
113
-
114
- ```ruby
115
- Pombo::Services.find "41106"
116
- # => #<OpenStruct code="41106", max_weight=30, name="PAC", description="PAC (without contract)">
117
- ```
118
-
119
- ## Packages
120
-
121
- Packages are the objects sent to the webservice for the query to be performed.
122
- It consists of several items, the zip code of origin and destination zip code and some optional services,
123
- [see here](https://www.correios.com.br/para-voce/envio/encomendas/servicos-opcionais)
124
-
125
- Creating a package:
126
-
127
- ```ruby
128
- package = Pombo::Package.new ({
129
- destination_zip_code: '29160565',
130
- origin_zip_code: '29108046',
131
- services: "40010",
132
- in_hand: false,
133
- delivery_notice: false
134
- })
135
- # => <Pombo::Package:0x007fcfd32080f0 @items=[], @length=0, @height=0, @width=0, @declared_value=0, @destination_zip_code="29160565", @origin_zip_code="29108046">
136
- ```
137
-
138
- > It can be informer an array of services to carry out the consultation on various services.
139
- > `Pombo::Package.new services: ["40010", "41068", "40568"]`
140
-
141
- Adding items:
142
-
143
- ```ruby
144
- item = Pombo::Package::Item.new weight: 10, length: 17, height: 22, width: 22
145
- package.add_item item
146
- ```
147
-
148
- or you can be informed a hash
149
-
150
- ```ruby
151
- package.add_item weight: 10, length: 15, height: 5, width: 10
152
- ```
153
-
154
- Now we can get various information
155
-
156
- ```ruby
157
- package.in_hand? # => false
158
- package.delivery_notice? # => false
159
- package.weight # => 10
160
- package.diameter # => 0
161
- package.format # => 1
162
- package.volume # => 8228.0
163
- package.single_item? # => true
164
- ```
165
-
166
- ## Usage
167
-
168
- To perform a query to know the value and the delivery
169
-
170
- ```ruby
171
- Pombo.shipping package
172
- # => [
173
- # => [0] #<Pombo::Webservice::CPP::Service:0x007fae1cd9d1a0 @code="40010", @value=31.3, @delivery_time="1", @value_in_hand=0.0, @value_delivery_notice=0.0, @value_declared_value=0.0, @error_code="0", @value_without_additions=31.3, @delivery_home=true, @delivery_sartuday=true>
174
- # => ]
175
- ```
176
-
177
- To make an inquiry to find out the delivery time
178
-
179
- ```ruby
180
- Pombo.delivery_time package
181
- # => [
182
- # => [0] #<Pombo::Webservice::CPP::Service:0x007fae1da0b040 @code="40010", @delivery_time="1", @delivery_home=true, @delivery_sartuday=true>
183
- # => ]
184
- ```
185
-
186
- To perform a query to know the value of delivery
187
-
188
- ```ruby
189
- Pombo.shipping_value package
190
- # => [
191
- # => [0] #<Pombo::Webservice::CPP::Service:0x007fae1d1cb740 @code="40010", @value=31.3, @value_in_hand=0.0, @value_delivery_notice=0.0, @value_declared_value=0.0, @value_without_additions=31.3>
192
- # => ]
193
- ```
194
-
195
- ## Log
196
-
197
- Pombo accepts any logger system compatible with [Log4r](http://log4r.rubyforge.org/index.html) interface.
198
- We have our own logger object, `Pombo::Logger`, which by default sends the messages to the system `STDOUT` and the level is INFO.
199
-
200
- ```ruby
201
- Pombo.logger.info('event.namespace'){ 'Any error message' }
202
- # => 2016-05-13 15:15:49 -0300 | POMBO | event.namespace | INFO: Any error message
203
- ```
204
-
205
- To save file, you can do something like this:
206
-
207
- ```ruby
208
- Pombo.setup do |config|
209
- config.log_level = Pombo::Logger::INFO
210
- config.logger = Pombo::Logger.new('caminho do arquivo')
211
- end
212
- ```
213
-
214
- ## Contributing
215
-
216
- Pombo is maintained by the development team of [Adena E-commerce Platform](http://www.adena.com.br/).
217
-
218
- Bug reports and pull requests are welcome on GitHub at https://github.com/adenaecommerce/pombo.
219
- This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
220
-
221
- ## License
222
-
223
- MIT License. See the included MIT-LICENSE file.