oca-epak 0.1.8 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/oca-epak.rb +24 -21
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 414e0ae32b69014e1d36010be61ebdbd91b26147
|
4
|
+
data.tar.gz: 40306c2bc28e9a06a5cdcba863bacef39c728923
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02e313337e4298bdc2f04a28f0dc836357f6a8193853a5dfad9e847b3d0e934741adfc03e7a127700ab13753989f3f8934279f7e0f3958a27ea75c89125a0584
|
7
|
+
data.tar.gz: 76589de806fe29eb82eabf10cc5b36a624742142b3657d8f675fc63590a3c3923acccc051059c49c14dcdd99322bdaea954944f15ec9c3e5a67b86bc80951596
|
data/lib/oca-epak.rb
CHANGED
@@ -3,11 +3,10 @@ require 'savon'
|
|
3
3
|
class Oca
|
4
4
|
attr_reader :client
|
5
5
|
|
6
|
-
|
7
|
-
'WSDL'.freeze
|
6
|
+
WSDL = 'http://webservice.oca.com.ar/oep_tracking/Oep_Track.asmx?WSDL'.freeze
|
8
7
|
|
9
8
|
def initialize
|
10
|
-
@client = Savon.client(wsdl:
|
9
|
+
@client = Savon.client(wsdl: WSDL)
|
11
10
|
end
|
12
11
|
|
13
12
|
# Checks if the user has input valid credentials
|
@@ -30,9 +29,11 @@ class Oca
|
|
30
29
|
# @param [String] Client's CUIT
|
31
30
|
# @param [String] Operation Type
|
32
31
|
# @return [Boolean]
|
33
|
-
def
|
32
|
+
def check_operation(cuit, op)
|
34
33
|
begin
|
35
|
-
|
34
|
+
opts = { wt: "50", vol: "0.027", origin: "1414", destination: "5403",
|
35
|
+
qty: "1", cuit: cuit, op: op }
|
36
|
+
get_shipping_rates(opts)
|
36
37
|
true
|
37
38
|
rescue NoMethodError => e
|
38
39
|
false
|
@@ -41,28 +42,30 @@ class Oca
|
|
41
42
|
|
42
43
|
# Get rates and delivery estimate for a shipment
|
43
44
|
#
|
44
|
-
# @param [
|
45
|
-
# @
|
46
|
-
# @
|
47
|
-
# @
|
48
|
-
# @
|
49
|
-
# @
|
50
|
-
# @
|
45
|
+
# @param [Hash] opts
|
46
|
+
# @option [String] :wt Total Weight e.g: 20
|
47
|
+
# @option [String] :vol Total Volume e.g: 0.0015 (0.1mts * 0.15mts * 0.1mts)
|
48
|
+
# @option [String] :origin Origin ZIP Code
|
49
|
+
# @option [String] :destination Destination ZIP Code
|
50
|
+
# @option [String] :qty Quantity of Packages
|
51
|
+
# @option [String] :cuit Client's CUIT e.g: 30-99999999-7
|
52
|
+
# @option [String] :op Operation Type
|
51
53
|
# @return [Hash, nil] Contains Total Price, Delivery Estimate
|
52
|
-
def get_shipping_rates(
|
54
|
+
def get_shipping_rates(opts = {})
|
53
55
|
method = :tarifar_envio_corporativo
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
message = { "PesoTotal" => opts[:wt], "VolumenTotal" => opts[:vol],
|
57
|
+
"CodigoPostalOrigen" => opts[:origin],
|
58
|
+
"CodigoPostalDestino" => opts[:destination],
|
59
|
+
"CantidadPaquetes" => opts[:qty], "Cuit" => opts[:cuit],
|
60
|
+
"Operativa" => opts[:op] }
|
61
|
+
response = client.call(method, message: message)
|
59
62
|
parse_results(method, response)
|
60
63
|
end
|
61
64
|
|
62
|
-
# Returns all existing
|
65
|
+
# Returns all existing Taxation Centers
|
63
66
|
#
|
64
|
-
# @return [Array, nil] Information for all the
|
65
|
-
def
|
67
|
+
# @return [Array, nil] Information for all the Oca Taxation Centers
|
68
|
+
def taxation_centers
|
66
69
|
method = :get_centros_imposicion
|
67
70
|
response = client.call(method)
|
68
71
|
parse_results(method, response)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oca-epak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mauro Otonelli
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-10-
|
12
|
+
date: 2015-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
125
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.2.2
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: OCA E-Pak
|