braspag 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/braspag/gateway.rb +13 -3
  3. metadata +19 -4
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake/gempackagetask'
5
5
  require 'spec/rake/spectask'
6
6
 
7
7
  GEM = "braspag"
8
- GEM_VERSION = "0.3.0"
8
+ GEM_VERSION = "0.4.0"
9
9
  SUMMARY = "Access the Braspag webservices using Ruby"
10
10
  AUTHOR = "Gonow"
11
11
  EMAIL = "labs@gonow.com.br"
@@ -2,8 +2,18 @@ module Braspag
2
2
  class Gateway < Handsoap::Service
3
3
  include Braspag::Service
4
4
 
5
- def authorize!(map)
6
- document = invoke_and_parse('Authorize', "#{base_action_url}/Authorize") do |message|
5
+ %w(authorize capture).each do |method|
6
+ eval <<-METHOD
7
+ def #{method}!(map)
8
+ invoke! "#{method.capitalize}", map
9
+ end
10
+ METHOD
11
+ end
12
+
13
+ protected
14
+
15
+ def invoke!(method, map)
16
+ document = invoke_and_parse(method, "#{base_action_url}/#{method}") do |message|
7
17
  map.each do |key, value|
8
18
  message.add("tns:#{key}", "#{value}")
9
19
  end
@@ -20,7 +30,7 @@ module Braspag
20
30
  end
21
31
 
22
32
  def convert_to_map(document)
23
- map = {"amount" => "", "authorisationNumber" => "", "message" => "", "returnCode" => "", "status" => "", "transactionId" => ""}
33
+ map = { "amount" => "", "authorisationNumber" => "", "message" => "", "returnCode" => "", "status" => "", "transactionId" => "" }
24
34
  map.each_key do |key|
25
35
  document.xpath("//ns:#{key}").each do |text|
26
36
  map[key] = text.to_s
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braspag
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 15
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 3
8
+ - 4
8
9
  - 0
9
- version: 0.3.0
10
+ version: 0.4.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Gonow
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-06-16 00:00:00 -03:00
18
+ date: 2010-09-10 00:00:00 -03:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rubigen
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 19
27
30
  segments:
28
31
  - 1
29
32
  - 3
@@ -35,9 +38,11 @@ dependencies:
35
38
  name: handsoap
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - "="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 29
41
46
  segments:
42
47
  - 1
43
48
  - 1
@@ -49,9 +54,11 @@ dependencies:
49
54
  name: curb
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - "="
54
60
  - !ruby/object:Gem::Version
61
+ hash: 15
55
62
  segments:
56
63
  - 0
57
64
  - 7
@@ -63,9 +70,11 @@ dependencies:
63
70
  name: rspec
64
71
  prerelease: false
65
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
66
74
  requirements:
67
75
  - - ">="
68
76
  - !ruby/object:Gem::Version
77
+ hash: 3
69
78
  segments:
70
79
  - 0
71
80
  version: "0"
@@ -75,9 +84,11 @@ dependencies:
75
84
  name: nokogiri
76
85
  prerelease: false
77
86
  requirement: &id005 !ruby/object:Gem::Requirement
87
+ none: false
78
88
  requirements:
79
89
  - - ">="
80
90
  - !ruby/object:Gem::Version
91
+ hash: 3
81
92
  segments:
82
93
  - 0
83
94
  version: "0"
@@ -110,23 +121,27 @@ rdoc_options: []
110
121
  require_paths:
111
122
  - lib
112
123
  required_ruby_version: !ruby/object:Gem::Requirement
124
+ none: false
113
125
  requirements:
114
126
  - - ">="
115
127
  - !ruby/object:Gem::Version
128
+ hash: 3
116
129
  segments:
117
130
  - 0
118
131
  version: "0"
119
132
  required_rubygems_version: !ruby/object:Gem::Requirement
133
+ none: false
120
134
  requirements:
121
135
  - - ">="
122
136
  - !ruby/object:Gem::Version
137
+ hash: 3
123
138
  segments:
124
139
  - 0
125
140
  version: "0"
126
141
  requirements: []
127
142
 
128
143
  rubyforge_project:
129
- rubygems_version: 1.3.6
144
+ rubygems_version: 1.3.7
130
145
  signing_key:
131
146
  specification_version: 3
132
147
  summary: Access the Braspag webservices using Ruby