citybox_api 0.9.0 → 0.9.1
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 +5 -13
- data/README.md +68 -9
- data/lib/citybox_api/shipments.rb +3 -2
- data/lib/citybox_api/take_ups.rb +1 -0
- data/lib/citybox_api/tariff.rb +4 -0
- data/lib/citybox_api/utilities.rb +28 -0
- data/lib/citybox_api/version.rb +1 -1
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NzdkZDQ0ZWM2YWI4OWEwNWE3MDQxYzA5N2IzZjliZDUzZjJkN2UyMA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b32a3035535a026b94498ae9a498a49ba29d75d8
|
4
|
+
data.tar.gz: a37cda685f6761a713085673dcdd21df7a334fbe
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ODVhYTI1M2IzZGQ4NGMzODM5NmMzYWZmMjI5MGJlMWQzMTRlMjI4MzBlMThi
|
11
|
-
Yjg2MjhlNmU5NWMzYmExNTZjODk4YjRmNmJiNzMxNzg4NDI1ZTY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YTlmZTAzYjAyODE3YTEyZDQ0MWVjNWFmZjA4ZjY5ZjdjMzZhY2Q4ZTkyYTE5
|
14
|
-
ZTAzNmE1YmQ2Y2I2ZDg3YjY3NmQ1MTVjMDQwYWMzZjhlZjJiM2Y5ZThlNTU5
|
15
|
-
YzkxZjUyODA4MDg3NjJhMmMwNDFkNjg4YmM4MTUzZDc0YWJjYmY=
|
6
|
+
metadata.gz: 95a9396a5084b1c85151aba3f8bbf502d2c7dd42345b30a6d360400578133956ff86dd8fa2e5af456808551eb38b9d403be2b053f115d65f2660ea5499183c47
|
7
|
+
data.tar.gz: 0b8572334f1ac8237094c9844178e9a0d3f203dad8190eecb1ac3117d354ed6721fb861db66baff01d9038a6be46bab9b53ebd07390fe4bd2df4bfc6571bfb0c
|
data/README.md
CHANGED
@@ -30,25 +30,84 @@ Configure CityboxApi
|
|
30
30
|
config.key = your_password
|
31
31
|
end
|
32
32
|
|
33
|
-
In this version of citybox_api gem you can
|
34
|
-
* Regions Services
|
35
|
-
* Branch Offices Services
|
33
|
+
In this version of citybox_api gem you can use all the 21 API services:
|
36
34
|
|
37
35
|
- Regions Services:
|
38
36
|
|
39
37
|
@regions_services = CityboxApi::Regions.new
|
40
38
|
|
41
|
-
@regions_services.list_regions # return a list with all availables regions
|
42
|
-
|
43
|
-
@regions_services.
|
39
|
+
1) @regions_services.list_regions # return a list with all availables regions
|
40
|
+
|
41
|
+
2) @regions_services.list_comunes # return a list with all availables communes
|
42
|
+
|
43
|
+
3) @regions_services.list_comunes_by_region(region_id) # return a list with all availables communes for region with id 'region_id'
|
44
44
|
|
45
45
|
- Branch Offices Services
|
46
46
|
|
47
47
|
@branch_offices_services = CityboxApi::BranchOffices.new
|
48
48
|
|
49
|
-
@branch_offices_services.list_branch_offices # return a list with all availables branch offices
|
50
|
-
|
51
|
-
@branch_offices_services.
|
49
|
+
4) @branch_offices_services.list_branch_offices # return a list with all availables branch offices
|
50
|
+
|
51
|
+
5) @branch_offices_services.list_branch_offices_by_commune(commune_id) # return a list with all availables branch offices for commue with id 'commune_id'
|
52
|
+
|
53
|
+
6) @branch_offices_services.list_branch_offices_near_to(street_name: '', street_number: '', commune_name: '') # return a list with all availables branch offices near to especific location
|
54
|
+
|
55
|
+
- Shipments
|
56
|
+
|
57
|
+
@shipments = CityboxApi::Shipments.new
|
58
|
+
|
59
|
+
7) @shipments.allow_shipment # sent an allow shipping request => 'admitirEnvio' Service
|
60
|
+
|
61
|
+
8) @shipments.validate_shipment # send a validate shipment request => 'validarEnvio' service
|
62
|
+
|
63
|
+
9) @shipments.cancel_shipment # send a cancel shipment request => 'anularEnvio' service
|
64
|
+
|
65
|
+
- Take ups
|
66
|
+
|
67
|
+
@take_ups = CityboxApi::TakeUps.new
|
68
|
+
|
69
|
+
10) @take_ups.register # send a register take up request => 'reistrarRetiro' service
|
70
|
+
|
71
|
+
- Tariff
|
72
|
+
|
73
|
+
@tariff = CityboxApi::Tariff.new
|
74
|
+
|
75
|
+
11) @tariff.apply_tariff_to_person # send an apply tariff to person request => 'aplicarTarifaPersona' service
|
76
|
+
|
77
|
+
12) @tariff.see_scope # see scope => 'consultarCobertura' service
|
78
|
+
|
79
|
+
13) @tariff.see_scope_by_product # see scope by product => 'consultarCoberturaPorProducto' service
|
80
|
+
|
81
|
+
14) @tariff.see_products_by_client # see products by client => 'consultaProductosPorCliente' service
|
82
|
+
|
83
|
+
- Utilities
|
84
|
+
|
85
|
+
@utilities = CityboxApi::Utilities.new
|
86
|
+
|
87
|
+
15) @utilities.list_cityboxes # list available cityboxes => 'listarCityboxDisponibles' service
|
88
|
+
|
89
|
+
16) @utilities.list_master_products # list master products => 'listarMaestroProductos' service
|
90
|
+
|
91
|
+
17) @utilities.list_master_countries # list countries => 'listarTodosLosPaises' service
|
92
|
+
|
93
|
+
18) @utilities.see_scl_documents # see scl documents => 'consultaDocumentosSCL' service
|
94
|
+
|
95
|
+
19) @utilities.see_fivps # see fivps => 'consultaFIVPS' service
|
96
|
+
|
97
|
+
20) @utilities.normalize_address # return a hash with normalized address => 'normalizarDireccion' service
|
98
|
+
|
99
|
+
21) @utilities.claim_status # see clain status => 'consultaEstadoDeReclamo' service
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
52
111
|
|
53
112
|
## Development
|
54
113
|
|
@@ -7,7 +7,7 @@ module CityboxApi
|
|
7
7
|
@password = CityboxApi.configuration.key
|
8
8
|
end
|
9
9
|
|
10
|
-
# sent an allow shipping request
|
10
|
+
# sent an allow shipping request => 'admitirEnvio' service
|
11
11
|
def allow_shipment opts={}
|
12
12
|
server_url = "http://b2b.correos.cl:8008/ServicioAdmisionCEPExterno/cch/ws/enviosCEP/externo/implementacion/ServicioExternoAdmisionCEP.asmx"
|
13
13
|
opts = check_shipment_opts opts
|
@@ -22,7 +22,7 @@ module CityboxApi
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
# send a validate shipment request => 'validarEnvio' service
|
26
26
|
def validate_shipment opts={}
|
27
27
|
server_url = "http://b2b.correos.cl:8008/ServicioValidacionAdmisionCEPExterno/cch/ws/enviosCEP/externo/implementacion/ServicioExternoValidaAdmisionCEP.asmx"
|
28
28
|
opts = check_shipment_opts opts
|
@@ -37,6 +37,7 @@ module CityboxApi
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
# send a cancel shipment request => 'anularEnvio' service
|
40
41
|
def cancel_shipment opts={}
|
41
42
|
server_url = "http://b2b.correos.cl:8008/ServicioAnulacionExterno/cch/ws/enviosCEP/externo/implementacion/ServicioExternoAnulacionEnvio.asmx"
|
42
43
|
|
data/lib/citybox_api/take_ups.rb
CHANGED
@@ -8,6 +8,7 @@ module CityboxApi
|
|
8
8
|
@server_url = "http://b2b.correos.cl:8008/ServicioRetiroEnvioExterno/cch/ws/retirosCEP/externo/implementacion/ServicioExternoRetiro.asmx"
|
9
9
|
end
|
10
10
|
|
11
|
+
# send a register take up request => 'reistrarRetiro' service
|
11
12
|
def register opts={}
|
12
13
|
# default values
|
13
14
|
opts[:sender_country] ||= "056"
|
data/lib/citybox_api/tariff.rb
CHANGED
@@ -8,6 +8,7 @@ module CityboxApi
|
|
8
8
|
@server_url = "http://b2b.correos.cl:8008/ServicioTarificacionCEPEmpresasExterno/cch/ws/tarificacionCEP/externo/implementacion/ExternoTarificacion.asmx"
|
9
9
|
end
|
10
10
|
|
11
|
+
# send an apply tariff to person request => 'aplicarTarifaPersona' service
|
11
12
|
def apply_tariff_to_person opts={}
|
12
13
|
server_url = "http://b2b.correos.cl:8008/ServicioTarificadorPersonasExterno/cch/ws/tarificacion/externo/implementacion/ServicioExternoTarificadorPersonas.asmx"
|
13
14
|
|
@@ -39,6 +40,7 @@ module CityboxApi
|
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
43
|
+
# see scope => 'consultarCobertura' service
|
42
44
|
def see_scope opts={}
|
43
45
|
# default values
|
44
46
|
opts[:sender_country] ||= "056" # chilean by default
|
@@ -82,6 +84,7 @@ module CityboxApi
|
|
82
84
|
end
|
83
85
|
end
|
84
86
|
|
87
|
+
# see scope by product => 'consultarCoberturaPorProducto' service
|
85
88
|
def see_scope_by_product opts={}
|
86
89
|
# default values
|
87
90
|
opts[:sender_country] ||= "056" # chilean by default
|
@@ -126,6 +129,7 @@ module CityboxApi
|
|
126
129
|
end
|
127
130
|
end
|
128
131
|
|
132
|
+
# see products by client => 'consultaProductosPorCliente' service
|
129
133
|
def see_products_by_client
|
130
134
|
xml = "<?xml version='1.0' encoding='utf-8'?>
|
131
135
|
<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
|
@@ -7,6 +7,7 @@ module CityboxApi
|
|
7
7
|
@password = CityboxApi.configuration.key
|
8
8
|
end
|
9
9
|
|
10
|
+
# list available cityboxes => 'listarCityboxDisponibles' service
|
10
11
|
def list_cityboxes
|
11
12
|
server_url = "http://b2b.correos.cl:8008/ServicioCityboxExterno/cch/ws/citybox/externo/implementacion/ServicioCityboxExterno.asmx"
|
12
13
|
xml = "<?xml version='1.0' encoding='utf-8'?>
|
@@ -28,6 +29,7 @@ module CityboxApi
|
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
32
|
+
# list master products => 'listarMaestroProductos' service
|
31
33
|
def list_master_products
|
32
34
|
server_url = "http://b2b.correos.cl:8008/ServicioProductosCorreosExterno/cch/ws/ProductosCorreos/externo/implementacion/ServicioExternoProductoCorreos.asmx"
|
33
35
|
xml = "<?xml version='1.0' encoding='utf-8'?>
|
@@ -49,6 +51,29 @@ module CityboxApi
|
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
54
|
+
# list countries => 'listarTodosLosPaises' service
|
55
|
+
def list_countries
|
56
|
+
server_url = "http://b2b.correos.cl:8008/ServicioListadoPaisesExterno/cch/ws/distribucionGeografica/externo/implementacion/ServicioExternoListadoPaises.asmx"
|
57
|
+
xml = "<?xml version='1.0' encoding='utf-8'?>
|
58
|
+
<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
|
59
|
+
<soap:Body>
|
60
|
+
<listarTodosLosPaises xmlns='http://tempuri.org/'>
|
61
|
+
<usuario>#{@user}</usuario>
|
62
|
+
<contrasena>#{@password}</contrasena>
|
63
|
+
</listarTodosLosPaises>
|
64
|
+
</soap:Body>
|
65
|
+
</soap:Envelope>"
|
66
|
+
|
67
|
+
begin
|
68
|
+
xml_response = RestClient.post server_url, xml, content_type: "text/xml"
|
69
|
+
json_response = Crack::XML.parse(xml_response)
|
70
|
+
json_response["soap:Envelope"]["soap:Body"]["listarTodosLosPaisesResponse"]["listarTodosLosPaisesResult"]["PaisTO"]
|
71
|
+
rescue => error
|
72
|
+
return CityboxApi.catch_error(error)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# see scl documents => 'consultaDocumentosSCL' service
|
52
77
|
def see_scl_documents shipment_number
|
53
78
|
server_url = "http://b2b.correos.cl:8008/ServicioConsultaAvisoDocumentoSCLExterno/cch/ws/externo/implementacion/ServicioExternoConsultaAvisoDocumentoSCL.asmx"
|
54
79
|
xml = "<?xml version='1.0' encoding='utf-8'?>
|
@@ -71,6 +96,7 @@ module CityboxApi
|
|
71
96
|
end
|
72
97
|
end
|
73
98
|
|
99
|
+
# see fivps => 'consultaFIVPS' service
|
74
100
|
def see_fivps shipment_number
|
75
101
|
server_url = "http://b2b.correos.cl:8008/ServicioConsultaFivpsExterno/cch/ws/aduana/externo/implementacion/ServicioExternoConsultaFivps.asmx"
|
76
102
|
xml = "<?xml version='1.0' encoding='utf-8'?>
|
@@ -93,6 +119,7 @@ module CityboxApi
|
|
93
119
|
end
|
94
120
|
end
|
95
121
|
|
122
|
+
# return a hash with normalized address => 'normalizarDireccion' service
|
96
123
|
def normalize_address opts={}
|
97
124
|
server_url = "http://b2b.correos.cl:8008/ServicioNormalizacionExterno/cch/ws/distribucionGeografica/externo/implementacion/ServicioExternoNormalizacion.asmx"
|
98
125
|
# default values
|
@@ -123,6 +150,7 @@ module CityboxApi
|
|
123
150
|
end
|
124
151
|
end
|
125
152
|
|
153
|
+
# see clain status => 'consultaEstadoDeReclamo' service
|
126
154
|
def claim_status claim_number
|
127
155
|
server_url = "http://b2b.correos.cl:8008/ServicioEstadoDeReclamosExterno/cch/ws/reclamos/implementacion/ServicioExternoEstadoDeReclamos.asmx"
|
128
156
|
xml = "<?xml version='1.0' encoding='utf-8'?>
|
data/lib/citybox_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: citybox_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joaquin Nuñez
|
@@ -14,70 +14,70 @@ dependencies:
|
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rest-client
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: crack
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: This gem allow you to consume the chilean citybox SOAP API in a simple
|
@@ -88,9 +88,9 @@ executables: []
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
-
- .gitignore
|
92
|
-
- .rspec
|
93
|
-
- .travis.yml
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".travis.yml"
|
94
94
|
- CODE_OF_CONDUCT.md
|
95
95
|
- Gemfile
|
96
96
|
- LICENSE.txt
|
@@ -118,17 +118,17 @@ require_paths:
|
|
118
118
|
- lib
|
119
119
|
required_ruby_version: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- -
|
121
|
+
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
125
|
requirements:
|
126
|
-
- -
|
126
|
+
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.
|
131
|
+
rubygems_version: 2.2.2
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Citybox for ruby
|