ipizza-rails 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ pkg/*
2
+ .DS_Store
3
+ *.gem
4
+ .bundle
5
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in ipizza-rails.gemspec
4
+ gemspec
data/README.markdown ADDED
@@ -0,0 +1,23 @@
1
+ Adds iPizza support to Rails 3 applications. Provides rails generators and easy configuration loading.
2
+
3
+ Installation
4
+ ------------
5
+
6
+ In your Gemfile add ipizza-rails gem:
7
+
8
+ gem ipizza-rails
9
+
10
+ Usage
11
+ -----
12
+
13
+ To start using iPizza in your rails application, you need to run the **init** generator first:
14
+
15
+ rails generate ipizza:init
16
+
17
+ This will create an example configuration file to `config/ipizza.yml` and create `config/certificates` directory and
18
+ puts some test certificates into it.
19
+
20
+ TODO:
21
+ -----
22
+
23
+ * Implement form helpers
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'ipizza-rails/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'ipizza-rails'
7
+ s.version = Ipizza::Rails::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Priit Haamer']
10
+ s.email = ['priit@fraktal.ee']
11
+ s.homepage = "http://rubygems.org/gems/ipizza-rails"
12
+ s.summary = %q{Adds iPizza support to Rails 3 applications}
13
+ s.description = %q{Helpers to use iPizza inside Rails 3 applications}
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ['lib']
19
+
20
+ s.add_dependency(%q<ipizza>, ['= 0.5.1'])
21
+
22
+ s.add_development_dependency('rspec', ['= 2.5.0'])
23
+ end
@@ -0,0 +1,6 @@
1
+ module Ipizza
2
+ module Rails
3
+ end
4
+ end
5
+
6
+ require 'ipizza-rails/railtie' if defined?(::Rails) && ::Rails::VERSION::MAJOR >= 3
@@ -0,0 +1,16 @@
1
+ require 'rails/generators'
2
+
3
+ class Ipizza::InitGenerator < Rails::Generators::Base
4
+
5
+ def self.source_root
6
+ @source_root ||= File.join(File.dirname(__FILE__), 'templates')
7
+ end
8
+
9
+ def create_configuration_file
10
+ template 'ipizza.yml', 'config/ipizza.yml'
11
+ end
12
+
13
+ def copy_test_certificates
14
+ %w(nordea_test_priv seb_test_priv.pem seb_test_pub.pem).each { |f| copy_file "certificates/#{f}", "config/certificates/#{f}" }
15
+ end
16
+ end
@@ -0,0 +1,29 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ class Ipizza::NotificationGenerator < Rails::Generators::Base
5
+ include Rails::Generators::Migration
6
+
7
+ def self.source_root
8
+ @source_root ||= File.join(File.dirname(__FILE__), 'templates')
9
+ end
10
+
11
+ # Implement the required interface for Rails::Generators::Migration.
12
+ # taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
13
+ def self.next_migration_number(dirname)
14
+ if ActiveRecord::Base.timestamped_migrations
15
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
16
+ else
17
+ "%.3d" % (current_migration_number(dirname) + 1)
18
+ end
19
+ end
20
+
21
+ # Create a migration file for the adyen_notifications table
22
+ def create_migration_file
23
+ migration_template 'notification_migration.rb', 'db/migrate/create_ipizza_notifications.rb'
24
+ end
25
+
26
+ def create_model_file
27
+ template 'notification_model.rb', 'app/models/ipizza_notification.rb'
28
+ end
29
+ end
@@ -0,0 +1 @@
1
+ --PUT YOUR NORDEA SECRET HERE--
@@ -0,0 +1,16 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
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uR/wUZJDw9kj+R1O46/byG8yA+S9FVw==
20
+ -----END CERTIFICATE-----
@@ -0,0 +1,98 @@
1
+ development:
2
+ swedbank:
3
+ service_url: https://www.swedbank.ee/banklink
4
+ return_url: http://localhost:3000/swedbank/return
5
+ cancel_url: http://localhost:3000/swedbank/cancel
6
+ login: dealer
7
+ file_cert: seb_test_pub.pem
8
+ file_key: seb_test_priv.pem
9
+ key_secret: foobar
10
+ encoding: UTF-8
11
+ snd_id: sender
12
+
13
+ seb:
14
+ service_url: https://www.seb.ee/cgi-bin/dv.sh/un3min.r
15
+ return_url: http://localhost:3000/seb/return
16
+ cancel_url: http://localhost:3000/seb/cancel
17
+ login: dealer
18
+ file_cert: seb_test_pub.pem
19
+ file_key: seb_test_priv.pem
20
+ encoding: UTF-8
21
+ snd_id: sender
22
+
23
+ nordea:
24
+ auth_service_url: https://netbank.nordea.com/pnbeidtest/eidn.jsp
25
+ auth_return_url: http://localhost:3000/nordea/return
26
+ auth_reject_url: http://localhost:3000/nordea/reject
27
+ auth_cancel_url: http://localhost:3000/nordea/cancel
28
+ auth_language: 'ET'
29
+ auth_rcv_id: '12345678'
30
+ confirm: 'YES'
31
+ keyvers: '0001'
32
+ file_key: nordea_test_priv
33
+
34
+ test:
35
+ swedbank:
36
+ service_url: https://www.swedbank.ee/banklink
37
+ return_url: http://test.host/swedbank/return
38
+ cancel_url: http://test.host/swedbank/cancel
39
+ login: dealer
40
+ file_cert: seb_test_pub.pem
41
+ file_key: seb_test_priv.pem
42
+ key_secret: foobar
43
+ encoding: UTF-8
44
+ snd_id: sender
45
+
46
+ seb:
47
+ service_url: https://www.seb.ee/cgi-bin/dv.sh/un3min.r
48
+ return_url: http://test.host/seb/return
49
+ cancel_url: http://test.host/seb/cancel
50
+ login: dealer
51
+ file_cert: seb_test_pub.pem
52
+ file_key: seb_test_priv.pem
53
+ encoding: UTF-8
54
+ snd_id: sender
55
+
56
+ nordea:
57
+ auth_service_url: https://netbank.nordea.com/pnbeidtest/eidn.jsp
58
+ auth_return_url: http://test.host/nordea/return
59
+ auth_reject_url: http://test.host/nordea/reject
60
+ auth_cancel_url: http://test.host/nordea/cancel
61
+ auth_language: 'ET'
62
+ auth_rcv_id: '12345678'
63
+ confirm: 'YES'
64
+ keyvers: '0001'
65
+ file_key: nordea_test_priv
66
+
67
+ production:
68
+ swedbank:
69
+ service_url: https://www.swedbank.ee/banklink
70
+ return_url: http://myapp.host/swedbank/return
71
+ cancel_url: http://myapp.host/swedbank/cancel
72
+ login: dealer
73
+ file_cert: seb_test_pub.pem
74
+ file_key: seb_test_priv.pem
75
+ key_secret: foobar
76
+ encoding: UTF-8
77
+ snd_id: sender
78
+
79
+ seb:
80
+ service_url: https://www.seb.ee/cgi-bin/unet3.sh/un3min.r
81
+ return_url: http://myapp.host/seb/return
82
+ cancel_url: http://myapp.host/seb/cancel
83
+ login: dealer
84
+ file_cert: seb_test_pub.pem
85
+ file_key: seb_test_priv.pem
86
+ encoding: UTF-8
87
+ snd_id: sender
88
+
89
+ nordea:
90
+ auth_service_url: https://netbank.nordea.com/pnbeid/eidn.jsp
91
+ auth_return_url: http://myapp.host/nordea/return
92
+ auth_reject_url: http://myapp.host/nordea/reject
93
+ auth_cancel_url: http://myapp.host/nordea/cancel
94
+ auth_language: 'ET'
95
+ auth_rcv_id: '12345678'
96
+ confirm: 'YES'
97
+ keyvers: '0001'
98
+ file_key: nordea_test_priv
@@ -0,0 +1,14 @@
1
+ class CreateIpizzaNotifications < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :ipizza_notifications do |t|
5
+ t.timestamps
6
+ end
7
+
8
+ # add_index :ipizza_notifications, [:vk_date]
9
+ end
10
+
11
+ def self.down
12
+ drop_table :ipizza_notifications
13
+ end
14
+ end
@@ -0,0 +1,2 @@
1
+ class IpizzaNotification < ActiveRecord::Base
2
+ end
@@ -0,0 +1,19 @@
1
+ require 'ipizza'
2
+ require 'rails'
3
+
4
+ class Ipizza::Rails::Railtie < ::Rails::Railtie
5
+
6
+ generators do
7
+ require 'ipizza-rails/generator/notification'
8
+ require 'ipizza-rails/generator/init'
9
+ end
10
+
11
+ config.before_configuration do
12
+ if File.exist?(Rails.root.join('config', 'ipizza.yml'))
13
+ Ipizza::Config.configure do |c|
14
+ c.certs_root = Rails.root.join('config', 'certificates')
15
+ c.load_from_hash(YAML::load_file(Rails.root.join('config', 'ipizza.yml')).fetch(Rails.env))
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ module Ipizza
2
+ module Rails
3
+ VERSION = '0.0.3'
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require 'rspec'
2
+
3
+ # Requires supporting files with custom matchers and macros, etc,
4
+ # in ./support/ and its subdirectories.
5
+ Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
6
+
7
+ Rspec.configure do |c|
8
+ c.mock_with :rspec
9
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ipizza-rails
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
11
+ platform: ruby
12
+ authors:
13
+ - Priit Haamer
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-06 00:00:00 +03:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: ipizza
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - "="
28
+ - !ruby/object:Gem::Version
29
+ hash: 9
30
+ segments:
31
+ - 0
32
+ - 5
33
+ - 1
34
+ version: 0.5.1
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: rspec
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - "="
44
+ - !ruby/object:Gem::Version
45
+ hash: 27
46
+ segments:
47
+ - 2
48
+ - 5
49
+ - 0
50
+ version: 2.5.0
51
+ type: :development
52
+ version_requirements: *id002
53
+ description: Helpers to use iPizza inside Rails 3 applications
54
+ email:
55
+ - priit@fraktal.ee
56
+ executables: []
57
+
58
+ extensions: []
59
+
60
+ extra_rdoc_files: []
61
+
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - README.markdown
66
+ - Rakefile
67
+ - VERSION
68
+ - ipizza-rails.gemspec
69
+ - lib/ipizza-rails.rb
70
+ - lib/ipizza-rails/generator/init.rb
71
+ - lib/ipizza-rails/generator/notification.rb
72
+ - lib/ipizza-rails/generator/templates/certificates/nordea_test_priv
73
+ - lib/ipizza-rails/generator/templates/certificates/seb_test_priv.pem
74
+ - lib/ipizza-rails/generator/templates/certificates/seb_test_pub.pem
75
+ - lib/ipizza-rails/generator/templates/ipizza.yml
76
+ - lib/ipizza-rails/generator/templates/notification_migration.rb
77
+ - lib/ipizza-rails/generator/templates/notification_model.rb
78
+ - lib/ipizza-rails/railtie.rb
79
+ - lib/ipizza-rails/version.rb
80
+ - spec/spec_helper.rb
81
+ has_rdoc: true
82
+ homepage: http://rubygems.org/gems/ipizza-rails
83
+ licenses: []
84
+
85
+ post_install_message:
86
+ rdoc_options: []
87
+
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ hash: 3
96
+ segments:
97
+ - 0
98
+ version: "0"
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ requirements: []
109
+
110
+ rubyforge_project:
111
+ rubygems_version: 1.3.7
112
+ signing_key:
113
+ specification_version: 3
114
+ summary: Adds iPizza support to Rails 3 applications
115
+ test_files:
116
+ - spec/spec_helper.rb