rails-ogone 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/VERSION +1 -1
- data/lib/rails-ogone/form.rb +17 -6
- data/lib/rails-ogone/helper.rb +2 -2
- data/rails-ogone.gemspec +7 -10
- data/spec/lib/rails-ogone/form_spec.rb +19 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67f9a53a0d5d4c42baf717a8f86a14c40003fb6a
|
4
|
+
data.tar.gz: f3bb4d1d9f3ae73dad5c34fa268090d47bc1e2d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f45786a9e246bffe327d1f6ebddae4b200b136b261781977ed765c6d0c5ecaf23ffe369788b5235b910d558791b3744cab80fbfe423f7d30a21f274f6221259d
|
7
|
+
data.tar.gz: 2b812a1d96d2c9f0a29b338a1101f885bd46c0877ecab41ae48ce8d315baa3e5e3d8f15689fd69dc2a4c2a1b7028ee326e338e4b956b9158d08e03ca69df0757
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -56,7 +56,7 @@ GEM
|
|
56
56
|
lumberjack (1.0.9)
|
57
57
|
method_source (0.8.2)
|
58
58
|
mini_portile (0.6.0)
|
59
|
-
multi_json (1.
|
59
|
+
multi_json (1.10.1)
|
60
60
|
multi_xml (0.5.5)
|
61
61
|
multipart-post (2.0.0)
|
62
62
|
nokogiri (1.6.3.1)
|
@@ -100,7 +100,7 @@ PLATFORMS
|
|
100
100
|
ruby
|
101
101
|
|
102
102
|
DEPENDENCIES
|
103
|
-
activesupport (~> 3.2)
|
103
|
+
activesupport (~> 3.2.21)
|
104
104
|
bundler (~> 1.6)
|
105
105
|
guard (~> 2.6)
|
106
106
|
guard-rspec (~> 4.3)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/rails-ogone/form.rb
CHANGED
@@ -8,27 +8,38 @@ module RailsOgone
|
|
8
8
|
@hash = RailsOgone::Hash.new
|
9
9
|
end
|
10
10
|
|
11
|
-
def action_url
|
12
|
-
|
11
|
+
def action_url(options = {})
|
12
|
+
options.reverse_merge!(utf8: false)
|
13
|
+
page = options[:utf8] ? 'orderstandard_utf8' : 'orderstandard'
|
14
|
+
"https://secure.ogone.com/ncol/#{@environment}/#{page}.asp"
|
13
15
|
end
|
14
16
|
|
15
|
-
def input(name, value)
|
17
|
+
def input(type, name, value)
|
16
18
|
value = (value.to_f * 100).to_i if name.downcase == 'amount'
|
17
19
|
@form_fields[name] = value
|
18
20
|
@hash.add_parameter name, value
|
19
|
-
html_string = "<input type=\"
|
21
|
+
html_string = "<input type=\"%s\" name=\"%s\" value=\"%s\" />" % [type, name.upcase, value]
|
20
22
|
ActiveSupport::SafeBuffer.new html_string
|
21
23
|
end
|
22
24
|
|
25
|
+
def radio_button(name, value)
|
26
|
+
input 'radio', name, value
|
27
|
+
end
|
28
|
+
|
23
29
|
def tag(options = {})
|
24
|
-
options
|
30
|
+
options.reverse_merge!(utf8: false)
|
31
|
+
options[:action] = action_url(utf8: options[:utf8])
|
25
32
|
|
26
|
-
form_attributes = options.inject('') do |attributes, pair|
|
33
|
+
form_attributes = options.except(:utf8).inject('') do |attributes, pair|
|
27
34
|
attributes << " #{pair[0]}=\"#{pair[1]}\""
|
28
35
|
end
|
29
36
|
|
30
37
|
output = "<form method=\"post\"#{form_attributes}>"
|
31
38
|
ActiveSupport::SafeBuffer.new output
|
32
39
|
end
|
40
|
+
|
41
|
+
def hidden_field(name, value)
|
42
|
+
input 'hidden', name, value
|
43
|
+
end
|
33
44
|
end
|
34
45
|
end
|
data/lib/rails-ogone/helper.rb
CHANGED
@@ -3,9 +3,9 @@ module RailsOgone
|
|
3
3
|
def ogone_form_tag(options = {}, &block)
|
4
4
|
@ogone_form = RailsOgone::Form.new Rails.env
|
5
5
|
output = @ogone_form.tag options
|
6
|
-
output << @ogone_form.
|
6
|
+
output << @ogone_form.hidden_field('PSPID', RailsOgone.pspid)
|
7
7
|
output << capture(@ogone_form, &block)
|
8
|
-
output << @ogone_form.
|
8
|
+
output << @ogone_form.hidden_field('SHASIGN', @ogone_form.hash.generate)
|
9
9
|
output << "\n</form>".html_safe
|
10
10
|
output.html_safe
|
11
11
|
end
|
data/rails-ogone.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: rails-ogone 0.1.
|
5
|
+
# stub: rails-ogone 0.1.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "rails-ogone"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Dave Lens"]
|
14
|
-
s.date = "2015-
|
14
|
+
s.date = "2015-10-20"
|
15
15
|
s.description = "Rails gem to facilitate simple payments with Ogone."
|
16
16
|
s.email = "github@davelens.be"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -40,15 +40,14 @@ Gem::Specification.new do |s|
|
|
40
40
|
]
|
41
41
|
s.homepage = "https://github.com/davelens/rails-ogone"
|
42
42
|
s.licenses = ["MIT"]
|
43
|
-
s.rubygems_version = "2.
|
43
|
+
s.rubygems_version = "2.4.5"
|
44
44
|
s.summary = "Ogone functionality for Rails."
|
45
45
|
|
46
46
|
if s.respond_to? :specification_version then
|
47
47
|
s.specification_version = 4
|
48
48
|
|
49
49
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
|
-
s.add_runtime_dependency(%q<activesupport>, ["~>
|
51
|
-
s.add_runtime_dependency(%q<actionview>, ["~> 4.1"])
|
50
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 3.2.21"])
|
52
51
|
s.add_development_dependency(%q<rspec>, ["~> 3.1"])
|
53
52
|
s.add_development_dependency(%q<rspec-mocks>, ["~> 3.1"])
|
54
53
|
s.add_development_dependency(%q<guard>, ["~> 2.6"])
|
@@ -57,8 +56,7 @@ Gem::Specification.new do |s|
|
|
57
56
|
s.add_development_dependency(%q<bundler>, ["~> 1.6"])
|
58
57
|
s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
|
59
58
|
else
|
60
|
-
s.add_dependency(%q<activesupport>, ["~>
|
61
|
-
s.add_dependency(%q<actionview>, ["~> 4.1"])
|
59
|
+
s.add_dependency(%q<activesupport>, ["~> 3.2.21"])
|
62
60
|
s.add_dependency(%q<rspec>, ["~> 3.1"])
|
63
61
|
s.add_dependency(%q<rspec-mocks>, ["~> 3.1"])
|
64
62
|
s.add_dependency(%q<guard>, ["~> 2.6"])
|
@@ -68,8 +66,7 @@ Gem::Specification.new do |s|
|
|
68
66
|
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
69
67
|
end
|
70
68
|
else
|
71
|
-
s.add_dependency(%q<activesupport>, ["~>
|
72
|
-
s.add_dependency(%q<actionview>, ["~> 4.1"])
|
69
|
+
s.add_dependency(%q<activesupport>, ["~> 3.2.21"])
|
73
70
|
s.add_dependency(%q<rspec>, ["~> 3.1"])
|
74
71
|
s.add_dependency(%q<rspec-mocks>, ["~> 3.1"])
|
75
72
|
s.add_dependency(%q<guard>, ["~> 2.6"])
|
@@ -4,17 +4,30 @@ describe RailsOgone::Form do
|
|
4
4
|
let(:instance) { described_class.new }
|
5
5
|
|
6
6
|
it '#input' do
|
7
|
-
expect(instance.input('foo', 'bar')).to eq '<input type="hidden" name="FOO" value="bar" />'
|
7
|
+
expect(instance.input('hidden', 'foo', 'bar')).to eq '<input type="hidden" name="FOO" value="bar" />'
|
8
8
|
end
|
9
9
|
|
10
10
|
describe '#action_url' do
|
11
|
-
|
12
|
-
instance
|
13
|
-
|
11
|
+
describe 'prod' do
|
12
|
+
let(:instance) { described_class.new 'production' }
|
13
|
+
|
14
|
+
it 'iso' do
|
15
|
+
expect(instance.action_url).to eq 'https://secure.ogone.com/ncol/prod/orderstandard.asp'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'utf8' do
|
19
|
+
expect(instance.action_url(utf8: true)).to eq 'https://secure.ogone.com/ncol/prod/orderstandard_utf8.asp'
|
20
|
+
end
|
14
21
|
end
|
15
22
|
|
16
|
-
|
17
|
-
|
23
|
+
describe 'test' do
|
24
|
+
it 'iso' do
|
25
|
+
expect(instance.action_url).to eq 'https://secure.ogone.com/ncol/test/orderstandard.asp'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'utf8' do
|
29
|
+
expect(instance.action_url(utf8: true)).to eq 'https://secure.ogone.com/ncol/test/orderstandard_utf8.asp'
|
30
|
+
end
|
18
31
|
end
|
19
32
|
end
|
20
33
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-ogone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Lens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.2.21
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.2.21
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|