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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/oca-epak.rb +24 -21
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44700753beb7e310e31375950460dc2308ce4a07
4
- data.tar.gz: 85f4898d1d2d4e095c2945dd97bebc7712725cad
3
+ metadata.gz: 414e0ae32b69014e1d36010be61ebdbd91b26147
4
+ data.tar.gz: 40306c2bc28e9a06a5cdcba863bacef39c728923
5
5
  SHA512:
6
- metadata.gz: 728d279db8774eace3e1e84b00bc49d6c6600f64d57fd26b73e451c2bb30f498806c72ac0505f08b9885296edb4de77ac7b0397359ca366be68e1059373063a2
7
- data.tar.gz: 63012daf4b9a8b0921978309aca0861183c3ec670edd05c76128d36de5f429e7491516a7cce99f2e3cfc3f038dcb6e1b46bde3848fb947bd3fb336a18d56dcb1
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
- WSDL_BASE_URI = 'http://webservice.oca.com.ar/oep_tracking/Oep_Track.asmx?'\
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: WSDL_BASE_URI)
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 check_operativa(cuit, op)
32
+ def check_operation(cuit, op)
34
33
  begin
35
- get_shipping_rates("50", "0.027", "1414", "5403", "1", cuit, op)
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 [String] Total Weight e.g: 20
45
- # @param [String] Total Volume e.g: 0.0015 (0.1mts * 0.15mts * 0.1mts)
46
- # @param [String] Origin ZIP Code
47
- # @param [String] Destination ZIP Code
48
- # @param [String] Quantity of Packages
49
- # @param [String] Client's CUIT e.g: 30-99999999-7
50
- # @param [String] Operation Type
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(wt, vol, origin, destination, qty, cuit, op)
54
+ def get_shipping_rates(opts = {})
53
55
  method = :tarifar_envio_corporativo
54
- opts = { "PesoTotal" => wt, "VolumenTotal" => vol,
55
- "CodigoPostalOrigen" => origin,
56
- "CodigoPostalDestino" => destination, "CantidadPaquetes" => qty,
57
- "Cuit" => cuit, "Operativa" => op }
58
- response = client.call(method, message: opts)
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 "Centros de Imposición"
65
+ # Returns all existing Taxation Centers
63
66
  #
64
- # @return [Array, nil] Information for all the Centros de Imposición
65
- def centros_de_imposicion
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.1.8
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-15 00:00:00.000000000 Z
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.4.5
126
+ rubygems_version: 2.2.2
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: OCA E-Pak