freemium-ajb 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.coveralls.yml +1 -0
- data/.gitignore +27 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -0
- data/LICENSE.md +20 -0
- data/README.md +1 -0
- data/app/mailers/freemium_mailer.rb +36 -0
- data/app/views/subscription_mailer/admin_report.text.erb +4 -0
- data/app/views/subscription_mailer/expiration_notice.text.erb +1 -0
- data/app/views/subscription_mailer/expiration_warning.text.erb +1 -0
- data/app/views/subscription_mailer/invoice.text.erb +5 -0
- data/freemium.gemspec +29 -0
- data/lib/freemium.rb +25 -0
- data/lib/freemium/configuration.rb +27 -0
- data/lib/freemium/coupon.rb +37 -0
- data/lib/freemium/coupon_redemption.rb +59 -0
- data/lib/freemium/credit_card.rb +222 -0
- data/lib/freemium/engine.rb +7 -0
- data/lib/freemium/gateways/base.rb +65 -0
- data/lib/freemium/gateways/brain_tree.rb +175 -0
- data/lib/freemium/gateways/test.rb +36 -0
- data/lib/freemium/rates.rb +33 -0
- data/lib/freemium/response.rb +24 -0
- data/lib/freemium/subscription.rb +384 -0
- data/lib/freemium/subscription_change.rb +20 -0
- data/lib/freemium/subscription_plan.rb +26 -0
- data/lib/freemium/testing/app/controllers/application_controller.rb +7 -0
- data/lib/freemium/testing/application.rb +46 -0
- data/lib/freemium/testing/config/database.yml +11 -0
- data/lib/freemium/testing/config/routes.rb +3 -0
- data/lib/freemium/transaction.rb +15 -0
- data/lib/freemium/version.rb +3 -0
- data/lib/generators/freemium/install/install_generator.rb +58 -0
- data/lib/generators/freemium/install/templates/db/migrate/create_coupon_redemptions.rb +18 -0
- data/lib/generators/freemium/install/templates/db/migrate/create_coupons.rb +28 -0
- data/lib/generators/freemium/install/templates/db/migrate/create_credit_cards.rb +14 -0
- data/lib/generators/freemium/install/templates/db/migrate/create_subscription_changes.rb +21 -0
- data/lib/generators/freemium/install/templates/db/migrate/create_subscription_plans.rb +14 -0
- data/lib/generators/freemium/install/templates/db/migrate/create_subscriptions.rb +31 -0
- data/lib/generators/freemium/install/templates/db/migrate/create_transactions.rb +17 -0
- data/lib/generators/freemium/install/templates/freemium.rb +16 -0
- data/lib/generators/freemium/install/templates/models/coupon.rb +3 -0
- data/lib/generators/freemium/install/templates/models/coupon_redemption.rb +3 -0
- data/lib/generators/freemium/install/templates/models/credit_card.rb +3 -0
- data/lib/generators/freemium/install/templates/models/subscription.rb +3 -0
- data/lib/generators/freemium/install/templates/models/subscription_change.rb +3 -0
- data/lib/generators/freemium/install/templates/models/subscription_plan.rb +3 -0
- data/lib/generators/freemium/install/templates/models/transaction.rb +3 -0
- data/lib/generators/views/USAGE +3 -0
- data/lib/generators/views/views_generator.rb +39 -0
- data/lib/tasks/freemium.rake +17 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/mailers.rb +1 -0
- data/spec/dummy/app/models/models.rb +31 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +45 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +21 -0
- data/spec/dummy/config/environment.rb +6 -0
- data/spec/dummy/config/environments/development.rb +26 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/freemium.rb +16 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mem_db.rb +12 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/db/schema.rb +90 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/fixtures/credit_cards.yml +11 -0
- data/spec/fixtures/subscription_plans.yml +15 -0
- data/spec/fixtures/subscriptions.yml +28 -0
- data/spec/fixtures/users.yml +16 -0
- data/spec/lib/tasks/run_billing_rake_spec.rb +14 -0
- data/spec/models/coupon_redemption_spec.rb +287 -0
- data/spec/models/credit_card_spec.rb +124 -0
- data/spec/models/manual_billing_spec.rb +165 -0
- data/spec/models/subscription_plan_spec.rb +46 -0
- data/spec/models/subscription_spec.rb +386 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/support/helpers.rb +18 -0
- data/spec/support/shared_contexts/rake.rb +19 -0
- metadata +270 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
4
|
+
ENV['RAILS_ENV'] = 'test'
|
5
|
+
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
6
|
+
require 'rspec/rails'
|
7
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
8
|
+
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.fixture_path = File.join(File.dirname(__FILE__), 'fixtures')
|
11
|
+
config.use_transactional_fixtures = true
|
12
|
+
config.mock_with :rspec
|
13
|
+
config.before(:suite) do
|
14
|
+
ActiveRecord::Schema.verbose = false
|
15
|
+
load 'dummy/db/schema.rb'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# some test credit_card params
|
2
|
+
class CreditCard
|
3
|
+
|
4
|
+
def self.sample_params
|
5
|
+
{
|
6
|
+
:name => "Santa Claus",
|
7
|
+
:card_type => "visa",
|
8
|
+
:number => "4111111111111111",
|
9
|
+
:month => 10,
|
10
|
+
:year => (Time.now + 3.years).year,
|
11
|
+
:verification_value => 999
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.sample
|
16
|
+
CreditCard.new(CreditCard.sample_params)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
shared_context "rake" do
|
4
|
+
let(:rake) { Rake::Application.new }
|
5
|
+
let(:task_name) { self.class.top_level_description }
|
6
|
+
let(:task_path) { "../../lib/tasks/#{task_name.split(":").first}" }
|
7
|
+
subject { rake[task_name] }
|
8
|
+
|
9
|
+
def loaded_files_excluding_current_rake_file
|
10
|
+
$".reject {|file| file == Rails.root.join("#{task_path}.rake").to_s }
|
11
|
+
end
|
12
|
+
|
13
|
+
before do
|
14
|
+
Rake.application = rake
|
15
|
+
Rake.application.rake_require(task_path, [Rails.root.to_s], loaded_files_excluding_current_rake_file)
|
16
|
+
|
17
|
+
Rake::Task.define_task(:environment)
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,270 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: freemium-ajb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Lance Ivy
|
9
|
+
- Anton Oryol
|
10
|
+
- Christian Trosclair
|
11
|
+
- Adam Becker
|
12
|
+
autorequire:
|
13
|
+
bindir: bin
|
14
|
+
cert_chain: []
|
15
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: rails
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '3.0'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: money
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rspec-rails
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: bundler
|
67
|
+
requirement: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
type: :development
|
74
|
+
prerelease: false
|
75
|
+
version_requirements: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ! '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rspec-rails
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: sqlite3
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: bundler
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: coveralls
|
131
|
+
requirement: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
type: :development
|
138
|
+
prerelease: false
|
139
|
+
version_requirements: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
description:
|
146
|
+
email: adam@dobt.co
|
147
|
+
executables: []
|
148
|
+
extensions: []
|
149
|
+
extra_rdoc_files:
|
150
|
+
- LICENSE.md
|
151
|
+
- README.md
|
152
|
+
files:
|
153
|
+
- .coveralls.yml
|
154
|
+
- .gitignore
|
155
|
+
- .rspec
|
156
|
+
- .ruby-gemset
|
157
|
+
- .ruby-version
|
158
|
+
- .travis.yml
|
159
|
+
- Gemfile
|
160
|
+
- LICENSE.md
|
161
|
+
- README.md
|
162
|
+
- app/mailers/freemium_mailer.rb
|
163
|
+
- app/views/subscription_mailer/admin_report.text.erb
|
164
|
+
- app/views/subscription_mailer/expiration_notice.text.erb
|
165
|
+
- app/views/subscription_mailer/expiration_warning.text.erb
|
166
|
+
- app/views/subscription_mailer/invoice.text.erb
|
167
|
+
- freemium.gemspec
|
168
|
+
- lib/freemium.rb
|
169
|
+
- lib/freemium/configuration.rb
|
170
|
+
- lib/freemium/coupon.rb
|
171
|
+
- lib/freemium/coupon_redemption.rb
|
172
|
+
- lib/freemium/credit_card.rb
|
173
|
+
- lib/freemium/engine.rb
|
174
|
+
- lib/freemium/gateways/base.rb
|
175
|
+
- lib/freemium/gateways/brain_tree.rb
|
176
|
+
- lib/freemium/gateways/test.rb
|
177
|
+
- lib/freemium/rates.rb
|
178
|
+
- lib/freemium/response.rb
|
179
|
+
- lib/freemium/subscription.rb
|
180
|
+
- lib/freemium/subscription_change.rb
|
181
|
+
- lib/freemium/subscription_plan.rb
|
182
|
+
- lib/freemium/testing/app/controllers/application_controller.rb
|
183
|
+
- lib/freemium/testing/application.rb
|
184
|
+
- lib/freemium/testing/config/database.yml
|
185
|
+
- lib/freemium/testing/config/routes.rb
|
186
|
+
- lib/freemium/transaction.rb
|
187
|
+
- lib/freemium/version.rb
|
188
|
+
- lib/generators/freemium/install/install_generator.rb
|
189
|
+
- lib/generators/freemium/install/templates/db/migrate/create_coupon_redemptions.rb
|
190
|
+
- lib/generators/freemium/install/templates/db/migrate/create_coupons.rb
|
191
|
+
- lib/generators/freemium/install/templates/db/migrate/create_credit_cards.rb
|
192
|
+
- lib/generators/freemium/install/templates/db/migrate/create_subscription_changes.rb
|
193
|
+
- lib/generators/freemium/install/templates/db/migrate/create_subscription_plans.rb
|
194
|
+
- lib/generators/freemium/install/templates/db/migrate/create_subscriptions.rb
|
195
|
+
- lib/generators/freemium/install/templates/db/migrate/create_transactions.rb
|
196
|
+
- lib/generators/freemium/install/templates/freemium.rb
|
197
|
+
- lib/generators/freemium/install/templates/models/coupon.rb
|
198
|
+
- lib/generators/freemium/install/templates/models/coupon_redemption.rb
|
199
|
+
- lib/generators/freemium/install/templates/models/credit_card.rb
|
200
|
+
- lib/generators/freemium/install/templates/models/subscription.rb
|
201
|
+
- lib/generators/freemium/install/templates/models/subscription_change.rb
|
202
|
+
- lib/generators/freemium/install/templates/models/subscription_plan.rb
|
203
|
+
- lib/generators/freemium/install/templates/models/transaction.rb
|
204
|
+
- lib/generators/views/USAGE
|
205
|
+
- lib/generators/views/views_generator.rb
|
206
|
+
- lib/tasks/freemium.rake
|
207
|
+
- spec/dummy/Rakefile
|
208
|
+
- spec/dummy/app/controllers/application_controller.rb
|
209
|
+
- spec/dummy/app/helpers/application_helper.rb
|
210
|
+
- spec/dummy/app/mailers/mailers.rb
|
211
|
+
- spec/dummy/app/models/models.rb
|
212
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
213
|
+
- spec/dummy/config.ru
|
214
|
+
- spec/dummy/config/application.rb
|
215
|
+
- spec/dummy/config/boot.rb
|
216
|
+
- spec/dummy/config/database.yml
|
217
|
+
- spec/dummy/config/environment.rb
|
218
|
+
- spec/dummy/config/environments/development.rb
|
219
|
+
- spec/dummy/config/environments/production.rb
|
220
|
+
- spec/dummy/config/environments/test.rb
|
221
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
222
|
+
- spec/dummy/config/initializers/freemium.rb
|
223
|
+
- spec/dummy/config/initializers/inflections.rb
|
224
|
+
- spec/dummy/config/initializers/mem_db.rb
|
225
|
+
- spec/dummy/config/initializers/mime_types.rb
|
226
|
+
- spec/dummy/config/initializers/secret_token.rb
|
227
|
+
- spec/dummy/config/initializers/session_store.rb
|
228
|
+
- spec/dummy/config/locales/en.yml
|
229
|
+
- spec/dummy/config/routes.rb
|
230
|
+
- spec/dummy/db/schema.rb
|
231
|
+
- spec/dummy/script/rails
|
232
|
+
- spec/fixtures/credit_cards.yml
|
233
|
+
- spec/fixtures/subscription_plans.yml
|
234
|
+
- spec/fixtures/subscriptions.yml
|
235
|
+
- spec/fixtures/users.yml
|
236
|
+
- spec/lib/tasks/run_billing_rake_spec.rb
|
237
|
+
- spec/models/coupon_redemption_spec.rb
|
238
|
+
- spec/models/credit_card_spec.rb
|
239
|
+
- spec/models/manual_billing_spec.rb
|
240
|
+
- spec/models/subscription_plan_spec.rb
|
241
|
+
- spec/models/subscription_spec.rb
|
242
|
+
- spec/spec_helper.rb
|
243
|
+
- spec/support/helpers.rb
|
244
|
+
- spec/support/shared_contexts/rake.rb
|
245
|
+
homepage: http://github.com/adamjacobbecker/freemium
|
246
|
+
licenses: []
|
247
|
+
post_install_message:
|
248
|
+
rdoc_options:
|
249
|
+
- --charset=UTF-8
|
250
|
+
require_paths:
|
251
|
+
- lib
|
252
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
253
|
+
none: false
|
254
|
+
requirements:
|
255
|
+
- - ! '>='
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: 1.9.2
|
258
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
259
|
+
none: false
|
260
|
+
requirements:
|
261
|
+
- - ! '>='
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
version: '0'
|
264
|
+
requirements: []
|
265
|
+
rubyforge_project:
|
266
|
+
rubygems_version: 1.8.24
|
267
|
+
signing_key:
|
268
|
+
specification_version: 3
|
269
|
+
summary: ''
|
270
|
+
test_files: []
|