braspag 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +8 -2
- data/Rakefile +6 -1
- data/lib/braspag.rb +1 -3
- data/lib/braspag/{buyer.rb → gateway.rb} +2 -3
- data/lib/braspag/service.rb +1 -9
- metadata +77 -14
data/README.textile
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
h2. INSTALLATION
|
2
2
|
|
3
|
-
|
3
|
+
<pre><code>sudo gem install braspag</code></pre>
|
4
|
+
|
5
|
+
h2. USAGE
|
6
|
+
|
7
|
+
<pre><code>connection = Braspag::Connection.new '{84BE7E7F-698A-6C74-F820-AE359C2A07C2}'
|
8
|
+
gateway = Braspag::Gateway.new connection
|
9
|
+
gateway.authorize! :orderId => 'test001', :customerName => 'Walter Bishop', :amount => '1000000,00', ...</code></pre>
|
4
10
|
|
5
11
|
h2. LICENSE:
|
6
12
|
|
7
13
|
(The MIT License)
|
8
14
|
|
9
|
-
Copyright (c)
|
15
|
+
Copyright (c) 2010
|
10
16
|
|
11
17
|
Permission is hereby granted, free of charge, to any person obtaining
|
12
18
|
a copy of this software and associated documentation files (the
|
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.
|
8
|
+
GEM_VERSION = "0.3.0"
|
9
9
|
SUMMARY = "Access the Braspag webservices using Ruby"
|
10
10
|
AUTHOR = "Gonow"
|
11
11
|
EMAIL = "labs@gonow.com.br"
|
@@ -20,6 +20,11 @@ spec = Gem::Specification.new do |s|
|
|
20
20
|
s.files = FileList['lib/**/*.rb', '[A-Z]*'].to_a
|
21
21
|
|
22
22
|
s.add_dependency(%q<rubigen>, [">= 1.3.4"])
|
23
|
+
s.add_dependency 'handsoap', '=1.1.7'
|
24
|
+
s.add_dependency 'curb', '=0.7.6'
|
25
|
+
|
26
|
+
s.add_development_dependency 'rspec'
|
27
|
+
s.add_development_dependency 'nokogiri'
|
23
28
|
|
24
29
|
s.author = AUTHOR
|
25
30
|
s.email = EMAIL
|
data/lib/braspag.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'handsoap'
|
3
2
|
require 'braspag/service'
|
4
3
|
require 'braspag/cryptography'
|
5
4
|
require 'braspag/connection'
|
6
|
-
require 'braspag/
|
5
|
+
require 'braspag/gateway'
|
7
6
|
require 'braspag/recorrente'
|
8
7
|
|
9
8
|
module Braspag
|
@@ -18,7 +17,6 @@ end
|
|
18
17
|
|
19
18
|
module Handsoap
|
20
19
|
class Service
|
21
|
-
|
22
20
|
private
|
23
21
|
def invoke_and_parse(method_name, soap_action, &block)
|
24
22
|
response = invoke("tns:#{method_name}", soap_action) do |message|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Braspag
|
2
|
-
class
|
2
|
+
class Gateway < Handsoap::Service
|
3
3
|
include Braspag::Service
|
4
4
|
|
5
|
-
def
|
5
|
+
def authorize!(map)
|
6
6
|
document = invoke_and_parse('Authorize', "#{base_action_url}/Authorize") do |message|
|
7
7
|
map.each do |key, value|
|
8
8
|
message.add("tns:#{key}", "#{value}")
|
@@ -28,6 +28,5 @@ module Braspag
|
|
28
28
|
end
|
29
29
|
map
|
30
30
|
end
|
31
|
-
|
32
31
|
end
|
33
32
|
end
|
data/lib/braspag/service.rb
CHANGED
@@ -2,7 +2,7 @@ module Braspag
|
|
2
2
|
module Service
|
3
3
|
def initialize(connection)
|
4
4
|
@connection = connection
|
5
|
-
|
5
|
+
self.class.endpoint :uri => uri, :version => 2
|
6
6
|
end
|
7
7
|
|
8
8
|
def on_create_document(doc)
|
@@ -12,13 +12,5 @@ module Braspag
|
|
12
12
|
def on_response_document(doc)
|
13
13
|
doc.add_namespace 'ns', base_action_url
|
14
14
|
end
|
15
|
-
|
16
|
-
private
|
17
|
-
def configure_endpoint
|
18
|
-
self.class.endpoint :uri => uri,
|
19
|
-
:version => 2
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
15
|
end
|
24
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braspag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
version: 0.3.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Gonow
|
@@ -9,19 +14,75 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-06-16 00:00:00 -03:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rubigen
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 3
|
30
|
+
- 4
|
23
31
|
version: 1.3.4
|
24
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: handsoap
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 1
|
43
|
+
- 1
|
44
|
+
- 7
|
45
|
+
version: 1.1.7
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: curb
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
- 7
|
58
|
+
- 6
|
59
|
+
version: 0.7.6
|
60
|
+
type: :runtime
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
prerelease: false
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
type: :development
|
73
|
+
version_requirements: *id004
|
74
|
+
- !ruby/object:Gem::Dependency
|
75
|
+
name: nokogiri
|
76
|
+
prerelease: false
|
77
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
84
|
+
type: :development
|
85
|
+
version_requirements: *id005
|
25
86
|
description:
|
26
87
|
email: labs@gonow.com.br
|
27
88
|
executables: []
|
@@ -31,14 +92,14 @@ extensions: []
|
|
31
92
|
extra_rdoc_files: []
|
32
93
|
|
33
94
|
files:
|
34
|
-
- lib/braspag.rb
|
35
|
-
- lib/braspag/service.rb
|
36
|
-
- lib/braspag/buyer.rb
|
37
95
|
- lib/braspag/connection.rb
|
38
|
-
- lib/braspag/recorrente.rb
|
39
96
|
- lib/braspag/cryptography.rb
|
40
|
-
-
|
97
|
+
- lib/braspag/gateway.rb
|
98
|
+
- lib/braspag/recorrente.rb
|
99
|
+
- lib/braspag/service.rb
|
100
|
+
- lib/braspag.rb
|
41
101
|
- Rakefile
|
102
|
+
- README.textile
|
42
103
|
has_rdoc: true
|
43
104
|
homepage: http://www.gonow.com.br
|
44
105
|
licenses: []
|
@@ -52,18 +113,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
113
|
requirements:
|
53
114
|
- - ">="
|
54
115
|
- !ruby/object:Gem::Version
|
116
|
+
segments:
|
117
|
+
- 0
|
55
118
|
version: "0"
|
56
|
-
version:
|
57
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
120
|
requirements:
|
59
121
|
- - ">="
|
60
122
|
- !ruby/object:Gem::Version
|
123
|
+
segments:
|
124
|
+
- 0
|
61
125
|
version: "0"
|
62
|
-
version:
|
63
126
|
requirements: []
|
64
127
|
|
65
128
|
rubyforge_project:
|
66
|
-
rubygems_version: 1.3.
|
129
|
+
rubygems_version: 1.3.6
|
67
130
|
signing_key:
|
68
131
|
specification_version: 3
|
69
132
|
summary: Access the Braspag webservices using Ruby
|