ipizza 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,5 +1,2 @@
1
1
  source "http://rubygems.org"
2
-
3
- group :development, :test do
4
- gem 'rspec', '2.2.0'
5
- end
2
+ gemspec
@@ -1,18 +1,24 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ipizza (0.5.0)
5
+
1
6
  GEM
2
7
  remote: http://rubygems.org/
3
8
  specs:
4
9
  diff-lcs (1.1.2)
5
- rspec (2.2.0)
6
- rspec-core (~> 2.2)
7
- rspec-expectations (~> 2.2)
8
- rspec-mocks (~> 2.2)
9
- rspec-core (2.2.1)
10
- rspec-expectations (2.2.0)
10
+ rspec (2.5.0)
11
+ rspec-core (~> 2.5.0)
12
+ rspec-expectations (~> 2.5.0)
13
+ rspec-mocks (~> 2.5.0)
14
+ rspec-core (2.5.1)
15
+ rspec-expectations (2.5.0)
11
16
  diff-lcs (~> 1.1.2)
12
- rspec-mocks (2.2.0)
17
+ rspec-mocks (2.5.0)
13
18
 
14
19
  PLATFORMS
15
20
  ruby
16
21
 
17
22
  DEPENDENCIES
18
- rspec (= 2.2.0)
23
+ ipizza!
24
+ rspec (= 2.5.0)
@@ -21,7 +21,8 @@ Configuration values should be set in YAML file in **provider.attribute_value**
21
21
  At any time, configuration can be modified with `Ipizza::Config.configure` block:
22
22
 
23
23
  Ipizza::Config.configure do |c|
24
- c.swedbank_service_url = 'http://foo.bar/swedbank'
24
+ c.certs_root = '/path/to/certificates'
25
+ c.swedbank_service_url = 'http://foo.bar/swedbank'
25
26
  end
26
27
 
27
28
  Configuration parameters
data/Rakefile CHANGED
@@ -1,25 +1,10 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
  require 'rspec/core/rake_task'
4
+ require 'bundler'
4
5
 
5
- RSpec::Core::RakeTask.new(:spec)
6
+ Bundler::GemHelper.install_tasks
6
7
 
7
- begin
8
- require 'jeweler'
9
- Jeweler::Tasks.new do |gemspec|
10
- gemspec.name = 'ipizza'
11
-
12
- gemspec.summary = 'Implements iPizza protocol to communicate with Estonian Banks'
13
- gemspec.description = <<-DESC
14
- Simplifies generating payment requests and parsing responses from banks when using iPizza protocol.
15
- DESC
16
-
17
- gemspec.email = 'priit@fraktal.ee'
18
- gemspec.homepage = 'http://github.com/priithaamer/ipizza'
19
- gemspec.authors = ['Priit Haamer']
20
- end
21
- rescue LoadError
22
- puts 'Jeweler not available. Install it with: gem install jeweler'
23
- end
8
+ RSpec::Core::RakeTask.new(:spec)
24
9
 
25
10
  task :default => :spec
@@ -1,103 +1,21 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "ipizza/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{ipizza}
8
- s.version = "0.4.4"
6
+ s.name = "ipizza"
7
+ s.version = Ipizza::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Priit Haamer"]
10
+ s.email = ["priit@fraktal.ee"]
11
+ s.homepage = "http://github.com/priithaamer/ipizza"
12
+ s.summary = %q{Implements iPizza protocol to communicate with Estonian Banks}
13
+ s.description = %q{Simplifies generating payment requests and parsing responses from banks when using iPizza protocol.}
14
+
15
+ s.add_development_dependency 'rspec', '= 2.5.0'
9
16
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Priit Haamer"]
12
- s.date = %q{2010-12-07}
13
- s.description = %q{ Simplifies generating payment requests and parsing responses from banks when using iPizza protocol.
14
- }
15
- s.email = %q{priit@fraktal.ee}
16
- s.extra_rdoc_files = [
17
- "README.markdown"
18
- ]
19
- s.files = [
20
- ".gitignore",
21
- ".rspec",
22
- "Gemfile",
23
- "Gemfile.lock",
24
- "README.markdown",
25
- "Rakefile",
26
- "VERSION",
27
- "autotest/discover.rb",
28
- "init.rb",
29
- "ipizza.gemspec",
30
- "lib/ipizza.rb",
31
- "lib/ipizza/authentication_request.rb",
32
- "lib/ipizza/authentication_response.rb",
33
- "lib/ipizza/config.rb",
34
- "lib/ipizza/payment.rb",
35
- "lib/ipizza/payment_request.rb",
36
- "lib/ipizza/payment_response.rb",
37
- "lib/ipizza/provider/nordea.rb",
38
- "lib/ipizza/provider/nordea/authentication_request.rb",
39
- "lib/ipizza/provider/nordea/authentication_response.rb",
40
- "lib/ipizza/provider/nordea/payment_request.rb",
41
- "lib/ipizza/provider/nordea/payment_response.rb",
42
- "lib/ipizza/provider/sampo.rb",
43
- "lib/ipizza/provider/seb.rb",
44
- "lib/ipizza/provider/swedbank.rb",
45
- "lib/ipizza/request.rb",
46
- "lib/ipizza/response.rb",
47
- "lib/ipizza/util.rb",
48
- "spec/certificates/bank.crt",
49
- "spec/certificates/bank.csr",
50
- "spec/certificates/bank.key",
51
- "spec/certificates/bank.pub",
52
- "spec/certificates/dealer.key",
53
- "spec/certificates/dealer.pub",
54
- "spec/certificates/nordea_test_priv",
55
- "spec/certificates/seb_test_priv.pem",
56
- "spec/certificates/seb_test_pub.crt",
57
- "spec/certificates/seb_test_pub.pem",
58
- "spec/config/config.yml",
59
- "spec/config/plain_config.yml",
60
- "spec/ipizza/authentication_response_spec.rb",
61
- "spec/ipizza/config_spec.rb",
62
- "spec/ipizza/provider/nordea/authentication_response_spec.rb",
63
- "spec/ipizza/provider/nordea/payment_request_spec.rb",
64
- "spec/ipizza/provider/nordea/payment_response_spec.rb",
65
- "spec/ipizza/provider/nordea_spec.rb",
66
- "spec/ipizza/provider/sampo_spec.rb",
67
- "spec/ipizza/provider/seb_spec.rb",
68
- "spec/ipizza/provider/swedbank_spec.rb",
69
- "spec/ipizza/util_spec.rb",
70
- "spec/spec_helper.rb",
71
- "spec/support/pizza.rb"
72
- ]
73
- s.homepage = %q{http://github.com/priithaamer/ipizza}
74
- s.rdoc_options = ["--charset=UTF-8"]
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
75
20
  s.require_paths = ["lib"]
76
- s.rubygems_version = %q{1.3.7}
77
- s.summary = %q{Implements iPizza protocol to communicate with Estonian Banks}
78
- s.test_files = [
79
- "spec/ipizza/authentication_response_spec.rb",
80
- "spec/ipizza/config_spec.rb",
81
- "spec/ipizza/provider/nordea/authentication_response_spec.rb",
82
- "spec/ipizza/provider/nordea/payment_request_spec.rb",
83
- "spec/ipizza/provider/nordea/payment_response_spec.rb",
84
- "spec/ipizza/provider/nordea_spec.rb",
85
- "spec/ipizza/provider/sampo_spec.rb",
86
- "spec/ipizza/provider/seb_spec.rb",
87
- "spec/ipizza/provider/swedbank_spec.rb",
88
- "spec/ipizza/util_spec.rb",
89
- "spec/spec_helper.rb",
90
- "spec/support/pizza.rb"
91
- ]
92
-
93
- if s.respond_to? :specification_version then
94
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
95
- s.specification_version = 3
96
-
97
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
98
- else
99
- end
100
- else
101
- end
102
21
  end
103
-
@@ -4,13 +4,17 @@ module Ipizza
4
4
  class Config
5
5
  class << self
6
6
 
7
+ attr_accessor :certs_root
8
+
7
9
  def load_from_file(yaml_path)
8
- config = YAML::load_file(yaml_path)
10
+ @certs_root = File.dirname(yaml_path)
9
11
 
12
+ load_from_hash(YAML::load_file(yaml_path))
13
+ end
14
+
15
+ def load_from_hash(config)
10
16
  config.each do |bank, params|
11
17
  params.each do |param, value|
12
- value = normalize_file_location(yaml_path, value) if /^file_(cert|key)/ =~ param
13
-
14
18
  begin
15
19
  self.send(:"#{bank}_#{param}=", value)
16
20
  rescue NoMethodError; end
@@ -25,8 +29,13 @@ module Ipizza
25
29
  def method_missing(m, *args)
26
30
  if /^(swedbank|seb|sampo|nordea)_(.*)=$/ =~ m.to_s
27
31
  clz = Ipizza::Provider.const_get($1.capitalize)
28
- if clz.respond_to?(:"#{$2}=")
29
- return clz.send(:"#{$2}=", *args)
32
+ key = $2
33
+ value = args.first
34
+
35
+ value = normalize_file_location(value) if /^file_(cert|key)/ =~ key
36
+
37
+ if clz.respond_to?(:"#{key}=")
38
+ return clz.send(:"#{key}=", *[value])
30
39
  end
31
40
  end
32
41
 
@@ -35,11 +44,11 @@ module Ipizza
35
44
 
36
45
  private
37
46
 
38
- def normalize_file_location(yaml_path, file_path)
47
+ def normalize_file_location(file_path)
39
48
  if File.exists?(file_path)
40
49
  file_path
41
50
  else
42
- file_path = File.expand_path(File.join(File.dirname(yaml_path), file_path))
51
+ file_path = File.expand_path(File.join(certs_root, file_path))
43
52
  end
44
53
 
45
54
  if File.exists?(file_path)
@@ -28,9 +28,9 @@ module Ipizza
28
28
 
29
29
  arr.each do |e|
30
30
  m = case m
31
- when 7:
31
+ when 7
32
32
  3
33
- when 3:
33
+ when 3
34
34
  1
35
35
  else
36
36
  7
@@ -0,0 +1,3 @@
1
+ module Ipizza
2
+ VERSION = '0.5.0'
3
+ end
@@ -46,7 +46,7 @@ describe Ipizza::Config do
46
46
  Ipizza::Config.configure do |c|
47
47
  c.swedbank_service_url = 'http://foo.bar/swedbank'
48
48
  end
49
-
49
+
50
50
  Ipizza::Provider::Swedbank.service_url.should == 'http://foo.bar/swedbank'
51
51
  end
52
52
 
@@ -54,5 +54,14 @@ describe Ipizza::Config do
54
54
  lambda { Ipizza::Config.configure { |c| c.swedbank_unknown_attr = 'foo' } }.should raise_error
55
55
  lambda { Ipizza::Config.configure { |c| c.spermbank_service_url = 'foo' } }.should raise_error
56
56
  end
57
+
58
+ it 'loads certificates from directory specified by certs_root' do
59
+ Ipizza::Config.configure do |c|
60
+ c.certs_root = File.expand_path(File.dirname(__FILE__) + '/../certificates')
61
+ c.swedbank_file_cert = 'seb_test_pub.pem'
62
+ end
63
+
64
+ Ipizza::Provider::Swedbank.file_cert.should == File.expand_path(File.dirname(__FILE__) + '/../certificates/seb_test_pub.pem')
65
+ end
57
66
  end
58
67
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ipizza
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 4
10
- version: 0.4.4
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Priit Haamer
@@ -15,18 +15,34 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-07 00:00:00 +02:00
18
+ date: 2011-05-06 00:00:00 +03:00
19
19
  default_executable:
20
- dependencies: []
21
-
22
- description: " Simplifies generating payment requests and parsing responses from banks when using iPizza protocol.\n"
23
- email: priit@fraktal.ee
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - "="
28
+ - !ruby/object:Gem::Version
29
+ hash: 27
30
+ segments:
31
+ - 2
32
+ - 5
33
+ - 0
34
+ version: 2.5.0
35
+ type: :development
36
+ version_requirements: *id001
37
+ description: Simplifies generating payment requests and parsing responses from banks when using iPizza protocol.
38
+ email:
39
+ - priit@fraktal.ee
24
40
  executables: []
25
41
 
26
42
  extensions: []
27
43
 
28
- extra_rdoc_files:
29
- - README.markdown
44
+ extra_rdoc_files: []
45
+
30
46
  files:
31
47
  - .gitignore
32
48
  - .rspec
@@ -34,7 +50,6 @@ files:
34
50
  - Gemfile.lock
35
51
  - README.markdown
36
52
  - Rakefile
37
- - VERSION
38
53
  - autotest/discover.rb
39
54
  - init.rb
40
55
  - ipizza.gemspec
@@ -56,6 +71,7 @@ files:
56
71
  - lib/ipizza/request.rb
57
72
  - lib/ipizza/response.rb
58
73
  - lib/ipizza/util.rb
74
+ - lib/ipizza/version.rb
59
75
  - spec/certificates/bank.crt
60
76
  - spec/certificates/bank.csr
61
77
  - spec/certificates/bank.key
@@ -85,8 +101,8 @@ homepage: http://github.com/priithaamer/ipizza
85
101
  licenses: []
86
102
 
87
103
  post_install_message:
88
- rdoc_options:
89
- - --charset=UTF-8
104
+ rdoc_options: []
105
+
90
106
  require_paths:
91
107
  - lib
92
108
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -115,6 +131,18 @@ signing_key:
115
131
  specification_version: 3
116
132
  summary: Implements iPizza protocol to communicate with Estonian Banks
117
133
  test_files:
134
+ - spec/certificates/bank.crt
135
+ - spec/certificates/bank.csr
136
+ - spec/certificates/bank.key
137
+ - spec/certificates/bank.pub
138
+ - spec/certificates/dealer.key
139
+ - spec/certificates/dealer.pub
140
+ - spec/certificates/nordea_test_priv
141
+ - spec/certificates/seb_test_priv.pem
142
+ - spec/certificates/seb_test_pub.crt
143
+ - spec/certificates/seb_test_pub.pem
144
+ - spec/config/config.yml
145
+ - spec/config/plain_config.yml
118
146
  - spec/ipizza/authentication_response_spec.rb
119
147
  - spec/ipizza/config_spec.rb
120
148
  - spec/ipizza/provider/nordea/authentication_response_spec.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.4.4