dineromail 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,14 +2,14 @@ module Dineromail
2
2
  class Buyer
3
3
  include HappyMapper
4
4
 
5
- tag 'COMPRADOR'
6
- element :email, String, :tag => 'EMAIL'
7
- element :address, String, :tag => 'DIRECCION'
8
- element :name, String, :tag => 'NOMBRE'
9
- element :phone, String, :tag => 'TELEFONO'
10
- element :document_type, String, :tag => 'TIPODOC'
11
- element :document_number, String, :tag => 'NUMERODOC'
12
- element :comment, String, :tag => 'COMENTARIO'
5
+ tag 'comprador'
6
+ element :email, String, :tag => 'email'
7
+ element :address, String, :tag => 'direccion'
8
+ element :name, String, :tag => 'nombre'
9
+ element :phone, String, :tag => 'telefono'
10
+ element :document_type, String, :tag => 'tipodoc'
11
+ element :document_number, String, :tag => 'numerodoc'
12
+ element :comment, String, :tag => 'comentario'
13
13
 
14
14
  end
15
15
  end
@@ -2,11 +2,11 @@ module Dineromail
2
2
  class Item
3
3
  include HappyMapper
4
4
 
5
- tag 'ITEM'
6
- element :description, String, :tag => 'DESCRIPCION'
7
- element :currency, Integer, :tag => 'MONEDA'
8
- element :unit_price, Float, :tag => 'PRECIOUNITARIO'
9
- element :count, Integer, :tag => 'CANTIDAD'
5
+ tag 'item'
6
+ element :description, String, :tag => 'descripcion'
7
+ element :currency, Integer, :tag => 'moneda'
8
+ element :unit_price, Float, :tag => 'preciounitario'
9
+ element :count, Integer, :tag => 'cantidad'
10
10
 
11
11
  DOLLAR = 2
12
12
  PESO = 1
@@ -3,9 +3,9 @@ module Dineromail
3
3
  class Notification
4
4
  include HappyMapper
5
5
 
6
- tag 'OPERACION'
7
- element :transaction_id, Integer, :tag => 'ID'
8
- element :type, String, :tag => 'TIPO'
6
+ tag 'operacion'
7
+ element :transaction_id, Integer, :tag => 'id'
8
+ element :type, String, :tag => 'tipo'
9
9
 
10
10
  def initialize(options = {})
11
11
  @options = options.symbolize_keys
@@ -28,5 +28,11 @@ module Dineromail
28
28
  end
29
29
  end
30
30
 
31
+ def self.parse(xml)
32
+ #Convert tags to lowercase
33
+ xml = xml.gsub(/<(.*?)[> ]/){|tag| tag.downcase}
34
+ super(xml)
35
+ end
36
+
31
37
  end
32
38
  end
@@ -3,16 +3,16 @@ module Dineromail
3
3
  class Operation
4
4
  include HappyMapper
5
5
 
6
- tag 'OPERACION'
7
- element :transaction_id, Integer, :tag => 'ID'
8
- element :date, DateTime, :tag => 'FECHA'
9
- element :status, Integer, :tag => 'ESTADO'
10
- element :amount, Float, :tag => 'MONTO'
11
- element :net_amount, Float, :tag => 'MONTONETO'
12
- element :pay_method, String, :tag => 'METODOPAGO'
13
- element :pay_medium, String, :tag => 'MEDIOPAGO'
14
- has_one :buyer, Buyer, :tag => 'COMPRADOR'
15
- has_many :items, Dineromail::Item, :tag => 'ITEM'
6
+ tag 'operacion'
7
+ element :transaction_id, Integer, :tag => 'id'
8
+ element :date, DateTime, :tag => 'fecha'
9
+ element :status, Integer, :tag => 'estado'
10
+ element :amount, Float, :tag => 'monto'
11
+ element :net_amount, Float, :tag => 'montoneto'
12
+ element :pay_method, String, :tag => 'metodopago'
13
+ element :pay_medium, String, :tag => 'mediopago'
14
+ has_one :buyer, Buyer, :tag => 'comprador'
15
+ has_many :items, Dineromail::Item, :tag => 'item'
16
16
 
17
17
  PENDING_STATUS = 1
18
18
  COMPLETED_STATUS = 2
@@ -8,8 +8,8 @@ module Dineromail
8
8
 
9
9
  include HappyMapper
10
10
 
11
- tag 'REPORTE'
12
- element :report_status, Integer, :tag => 'ESTADOREPORTE'
11
+ tag 'reporte'
12
+ element :report_status, Integer, :tag => 'estadoreporte'
13
13
  has_many :operations, Operation
14
14
 
15
15
  VALID_REPORT_STATUS = 1
@@ -35,6 +35,12 @@ module Dineromail
35
35
  self.parse response.body
36
36
  end
37
37
 
38
+ def self.parse(xml)
39
+ #Convert tags to lowercase
40
+ xml = xml.gsub(/<(.*?)[> ]/){|tag| tag.downcase}
41
+ super(xml)
42
+ end
43
+
38
44
  def self.xml_request_for(transaction_id,options = {})
39
45
  options = options.symbolize_keys
40
46
  account_number = options[:account_number] || Dineromail.configuration.account_number
@@ -1,3 +1,3 @@
1
1
  module Dineromail
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dineromail
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nicolas Mosconi