koudoku 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +51 -4
  3. data/Rakefile +40 -1
  4. data/app/assets/javascripts/koudoku/application.js +15 -0
  5. data/app/assets/stylesheets/koudoku/application.css +13 -0
  6. data/app/assets/stylesheets/koudoku/pricing-table.scss +77 -0
  7. data/app/concerns/koudoku/plan.rb +20 -0
  8. data/{lib → app/concerns}/koudoku/subscription.rb +26 -6
  9. data/app/controllers/koudoku/application_controller.rb +5 -0
  10. data/app/controllers/koudoku/subscriptions_controller.rb +63 -0
  11. data/app/controllers/koudoku/webhooks_controller.rb +38 -0
  12. data/app/helpers/koudoku/application_helper.rb +4 -0
  13. data/app/views/koudoku/subscriptions/_pricing_table.html.erb +53 -0
  14. data/app/views/koudoku/subscriptions/edit.html.erb +3 -0
  15. data/app/views/koudoku/subscriptions/index.html.erb +2 -0
  16. data/app/views/koudoku/subscriptions/new.html.erb +99 -0
  17. data/app/views/koudoku/subscriptions/show.html.erb +8 -0
  18. data/app/views/layouts/koudoku/application.html.erb +14 -0
  19. data/config/routes.rb +11 -0
  20. data/lib/generators/koudoku/install_generator.rb +7 -3
  21. data/lib/generators/koudoku/views_generator.rb +28 -0
  22. data/lib/koudoku.rb +43 -6
  23. data/lib/koudoku/engine.rb +6 -0
  24. data/lib/koudoku/version.rb +1 -1
  25. data/lib/tasks/koudoku_tasks.rake +12 -0
  26. data/test/dummy/README.rdoc +261 -0
  27. data/test/dummy/Rakefile +7 -0
  28. data/test/dummy/app/assets/javascripts/application.js +15 -0
  29. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  30. data/test/dummy/app/controllers/application_controller.rb +3 -0
  31. data/test/dummy/app/helpers/application_helper.rb +2 -0
  32. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  33. data/test/dummy/config.ru +4 -0
  34. data/test/dummy/config/application.rb +59 -0
  35. data/test/dummy/config/boot.rb +10 -0
  36. data/test/dummy/config/database.yml +25 -0
  37. data/test/dummy/config/environment.rb +5 -0
  38. data/test/dummy/config/environments/development.rb +37 -0
  39. data/test/dummy/config/environments/production.rb +67 -0
  40. data/test/dummy/config/environments/test.rb +37 -0
  41. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  42. data/test/dummy/config/initializers/inflections.rb +15 -0
  43. data/test/dummy/config/initializers/mime_types.rb +5 -0
  44. data/test/dummy/config/initializers/secret_token.rb +7 -0
  45. data/test/dummy/config/initializers/session_store.rb +8 -0
  46. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  47. data/test/dummy/config/locales/en.yml +5 -0
  48. data/test/dummy/config/routes.rb +4 -0
  49. data/test/dummy/public/404.html +26 -0
  50. data/test/dummy/public/422.html +26 -0
  51. data/test/dummy/public/500.html +25 -0
  52. data/{docs/INSTALLATION.md → test/dummy/public/favicon.ico} +0 -0
  53. data/test/dummy/script/rails +6 -0
  54. data/test/integration/navigation_test.rb +10 -0
  55. data/test/koudoku_test.rb +7 -0
  56. data/test/test_helper.rb +15 -0
  57. metadata +113 -17
  58. data/.gitignore +0 -4
  59. data/Gemfile +0 -4
  60. data/koudoku.gemspec +0 -24
  61. data/lib/generators/koudoku/templates/insert_default_plans.rb +0 -0
  62. data/lib/koudoku/webhooks_controller.rb +0 -37
  63. data/lib/tasks/koudoku.rake +0 -8
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActionDispatch::IntegrationTest
4
+ fixtures :all
5
+
6
+ # test "the truth" do
7
+ # assert true
8
+ # end
9
+ end
10
+
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class KoudokuTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Koudoku
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: koudoku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,10 +9,26 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-28 00:00:00.000000000 Z
12
+ date: 2013-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.10
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.10
30
+ - !ruby/object:Gem::Dependency
31
+ name: stripe
16
32
  requirement: !ruby/object:Gem::Requirement
17
33
  none: false
18
34
  requirements:
@@ -28,14 +44,14 @@ dependencies:
28
44
  - !ruby/object:Gem::Version
29
45
  version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
- name: stripe
47
+ name: sqlite3
32
48
  requirement: !ruby/object:Gem::Requirement
33
49
  none: false
34
50
  requirements:
35
51
  - - ! '>='
36
52
  - !ruby/object:Gem::Version
37
53
  version: '0'
38
- type: :runtime
54
+ type: :development
39
55
  prerelease: false
40
56
  version_requirements: !ruby/object:Gem::Requirement
41
57
  none: false
@@ -51,19 +67,62 @@ executables: []
51
67
  extensions: []
52
68
  extra_rdoc_files: []
53
69
  files:
54
- - .gitignore
55
- - Gemfile
56
- - README.md
57
- - Rakefile
58
- - docs/INSTALLATION.md
59
- - koudoku.gemspec
70
+ - app/assets/javascripts/koudoku/application.js
71
+ - app/assets/stylesheets/koudoku/application.css
72
+ - app/assets/stylesheets/koudoku/pricing-table.scss
73
+ - app/concerns/koudoku/plan.rb
74
+ - app/concerns/koudoku/subscription.rb
75
+ - app/controllers/koudoku/application_controller.rb
76
+ - app/controllers/koudoku/subscriptions_controller.rb
77
+ - app/controllers/koudoku/webhooks_controller.rb
78
+ - app/helpers/koudoku/application_helper.rb
79
+ - app/views/koudoku/subscriptions/_pricing_table.html.erb
80
+ - app/views/koudoku/subscriptions/edit.html.erb
81
+ - app/views/koudoku/subscriptions/index.html.erb
82
+ - app/views/koudoku/subscriptions/new.html.erb
83
+ - app/views/koudoku/subscriptions/show.html.erb
84
+ - app/views/layouts/koudoku/application.html.erb
85
+ - config/routes.rb
60
86
  - lib/generators/koudoku/install_generator.rb
61
- - lib/generators/koudoku/templates/insert_default_plans.rb
62
- - lib/koudoku.rb
63
- - lib/koudoku/subscription.rb
87
+ - lib/generators/koudoku/views_generator.rb
88
+ - lib/koudoku/engine.rb
64
89
  - lib/koudoku/version.rb
65
- - lib/koudoku/webhooks_controller.rb
66
- - lib/tasks/koudoku.rake
90
+ - lib/koudoku.rb
91
+ - lib/tasks/koudoku_tasks.rake
92
+ - MIT-LICENSE
93
+ - Rakefile
94
+ - README.md
95
+ - test/dummy/app/assets/javascripts/application.js
96
+ - test/dummy/app/assets/stylesheets/application.css
97
+ - test/dummy/app/controllers/application_controller.rb
98
+ - test/dummy/app/helpers/application_helper.rb
99
+ - test/dummy/app/views/layouts/application.html.erb
100
+ - test/dummy/config/application.rb
101
+ - test/dummy/config/boot.rb
102
+ - test/dummy/config/database.yml
103
+ - test/dummy/config/environment.rb
104
+ - test/dummy/config/environments/development.rb
105
+ - test/dummy/config/environments/production.rb
106
+ - test/dummy/config/environments/test.rb
107
+ - test/dummy/config/initializers/backtrace_silencers.rb
108
+ - test/dummy/config/initializers/inflections.rb
109
+ - test/dummy/config/initializers/mime_types.rb
110
+ - test/dummy/config/initializers/secret_token.rb
111
+ - test/dummy/config/initializers/session_store.rb
112
+ - test/dummy/config/initializers/wrap_parameters.rb
113
+ - test/dummy/config/locales/en.yml
114
+ - test/dummy/config/routes.rb
115
+ - test/dummy/config.ru
116
+ - test/dummy/public/404.html
117
+ - test/dummy/public/422.html
118
+ - test/dummy/public/500.html
119
+ - test/dummy/public/favicon.ico
120
+ - test/dummy/Rakefile
121
+ - test/dummy/README.rdoc
122
+ - test/dummy/script/rails
123
+ - test/integration/navigation_test.rb
124
+ - test/koudoku_test.rb
125
+ - test/test_helper.rb
67
126
  homepage: http://github.com/andrewculver/koudoku
68
127
  licenses: []
69
128
  post_install_message:
@@ -76,16 +135,53 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
135
  - - ! '>='
77
136
  - !ruby/object:Gem::Version
78
137
  version: '0'
138
+ segments:
139
+ - 0
140
+ hash: -3376003182273526818
79
141
  required_rubygems_version: !ruby/object:Gem::Requirement
80
142
  none: false
81
143
  requirements:
82
144
  - - ! '>='
83
145
  - !ruby/object:Gem::Version
84
146
  version: '0'
147
+ segments:
148
+ - 0
149
+ hash: -3376003182273526818
85
150
  requirements: []
86
- rubyforge_project: koudoku
151
+ rubyforge_project:
87
152
  rubygems_version: 1.8.24
88
153
  signing_key:
89
154
  specification_version: 3
90
155
  summary: Robust subscription support for Rails with Stripe.
91
- test_files: []
156
+ test_files:
157
+ - test/dummy/app/assets/javascripts/application.js
158
+ - test/dummy/app/assets/stylesheets/application.css
159
+ - test/dummy/app/controllers/application_controller.rb
160
+ - test/dummy/app/helpers/application_helper.rb
161
+ - test/dummy/app/views/layouts/application.html.erb
162
+ - test/dummy/config/application.rb
163
+ - test/dummy/config/boot.rb
164
+ - test/dummy/config/database.yml
165
+ - test/dummy/config/environment.rb
166
+ - test/dummy/config/environments/development.rb
167
+ - test/dummy/config/environments/production.rb
168
+ - test/dummy/config/environments/test.rb
169
+ - test/dummy/config/initializers/backtrace_silencers.rb
170
+ - test/dummy/config/initializers/inflections.rb
171
+ - test/dummy/config/initializers/mime_types.rb
172
+ - test/dummy/config/initializers/secret_token.rb
173
+ - test/dummy/config/initializers/session_store.rb
174
+ - test/dummy/config/initializers/wrap_parameters.rb
175
+ - test/dummy/config/locales/en.yml
176
+ - test/dummy/config/routes.rb
177
+ - test/dummy/config.ru
178
+ - test/dummy/public/404.html
179
+ - test/dummy/public/422.html
180
+ - test/dummy/public/500.html
181
+ - test/dummy/public/favicon.ico
182
+ - test/dummy/Rakefile
183
+ - test/dummy/README.rdoc
184
+ - test/dummy/script/rails
185
+ - test/integration/navigation_test.rb
186
+ - test/koudoku_test.rb
187
+ - test/test_helper.rb
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in koudoku.gemspec
4
- gemspec
data/koudoku.gemspec DELETED
@@ -1,24 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "koudoku/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "koudoku"
7
- s.version = Koudoku::VERSION
8
- s.authors = ["Andrew Culver"]
9
- s.email = ["andrew.culver@gmail.com"]
10
- s.homepage = "http://github.com/andrewculver/koudoku"
11
- s.summary = %q{Robust subscription support for Rails with Stripe.}
12
- s.description = %q{Robust subscription support for Rails with Stripe. Provides package levels, coupons, logging, notifications, etc.}
13
-
14
- s.rubyforge_project = "koudoku"
15
-
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
20
-
21
- s.add_dependency "rails"
22
- s.add_dependency "stripe"
23
-
24
- end
@@ -1,37 +0,0 @@
1
- class Koudoku::WebhooksController < ActionController::Base
2
-
3
- # I have no idea why this parameter is required to be here.
4
- # If we don't do this, we get "wrong number of arguments (1 for 0)"
5
- def process(parameter = nil)
6
-
7
- raise "API key not configured. For security reasons you must configure this in 'config/koudoku.rb'." unless Koudoku.webhooks_api_key.present?
8
- raise "Invalid API key. Be sure the webhooks URL Stripe is configured with includes ?api_key= and the correct key." unless params[:api_key] == Koudoku.webhooks_api_key
9
-
10
- data_json = JSON.parse request.body.read
11
-
12
- if data_json['type'] == "invoice.payment_succeeded"
13
-
14
- stripe_id = data_json['data']['object']['customer']
15
- amount = data_json['data']['object']['total'].to_f / 100.0
16
- subscription = Subscription.find_by_stripe_id(stripe_id)
17
- subscription.payment_succeeded(amount)
18
-
19
- elsif data_json['type'] == "charge.failed"
20
-
21
- stripe_id = data_json['data']['object']['customer']
22
- subscription = Subscription.find_by_stripe_id(stripe_id)
23
- subscription.charge_failed
24
-
25
- elsif data_json['type'] == "charge.dispute.created"
26
-
27
- stripe_id = data_json['data']['object']['customer']
28
-
29
- puts "Finding listing with Stripe ID #{stripe_id}"
30
- subscription = Subscription.find_by_stripe_id(stripe_id)
31
- listing = subscription.listing
32
- subscription.charge_disputed
33
-
34
- end
35
-
36
- end
37
- end
@@ -1,8 +0,0 @@
1
- namespace :koudoku do
2
-
3
- desc "Install koudoku"
4
- task :install do
5
- system 'rails g koudoku:install'
6
- end
7
-
8
- end