redline 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,41 +1,50 @@
1
- = RedLine
1
+ !http://www.jamesdaniels.net/b/redline-logo.png!
2
2
 
3
- Braintree via Redline: riding the rails
3
+ h1. RedLine
4
+
5
+ h2. Braintree via Redline: riding the rails
4
6
 
5
7
  Redline helps you with Braintree on Rails, it automatically makes customer creation/deletion/update scripts for your model, translating and syncing them with a Braintree customer profile.
6
8
  Redline also includes a lightweight manual subscription billing system, if you desire that functionality.
7
9
 
8
- === Please note: this repository may be a prerelease version, please read the README of the version you have installed.
10
+ *Please note:* this repository may be a prerelease version, please read the README of the version you have installed.
9
11
 
10
- == Heads up
12
+ h2. Heads up
11
13
 
12
- === This software is delivered "as is" without warranty. As with any piece of code, please study it if you include it in your project, especially for such a critical component of your application.
14
+ *This software is delivered "as is" without warranty. As with any piece of code, please study it if you include it in your project, especially for such a critical component of your application.*
13
15
 
14
16
  While I believe the tests cover the code well, there may be certain cases that I have not experienced or predicted. This is a manual billing script, so dreadful things may occur; please help out and add to the tests if you see, or god forbid experience, any problems.
15
17
 
16
18
  It is my intention to convert to gateway handled subscriptions, once Braintree adds this functionality to their gem.
17
19
 
18
- == Getting started
20
+ h2. Getting started
19
21
 
20
22
  Set up the gem dependancies in environment.rb:
21
23
 
24
+ <pre>
22
25
  config.gem 'braintree'
23
26
  config.gem 'redline'
27
+ </pre>
24
28
 
25
29
  Run your install task:
26
30
 
31
+ <pre>
27
32
  $ rake gems:install
33
+ </pre>
28
34
 
29
35
  Configure Braintree normally in an initializer and add the following magic columns to a model of your choice (e.g, User):
30
36
 
37
+ <pre>
31
38
  add_column :users, :customer_id, :integer # Required
32
39
 
33
40
  add_column :users, :subscription_key, :string # Required if User has_a_subscription
34
41
  add_column :users, :paid_until, :date # Required if User has_a_subscription
35
42
  add_column :users, :trial_until, :date # Required if User has_a_subscription and trial length is greater than 0.days
43
+ </pre>
36
44
 
37
45
  And the following definition calls:
38
46
 
47
+ <pre>
39
48
  class User < ActiveRecord::Base
40
49
 
41
50
  has_a_braintree_customer
@@ -45,15 +54,19 @@ And the following definition calls:
45
54
  end
46
55
 
47
56
  end
57
+ </pre>
48
58
 
49
59
  And then run this daily:
50
60
 
61
+ <pre>
51
62
  User.run_billing!
63
+ </pre>
52
64
 
53
- == More advanced configuration
65
+ h2. More advanced configuration
54
66
 
55
67
  If you don't like the default settings or your user needs a field mapping, you can override many assumptions RedLine makes:
56
68
 
69
+ <pre>
57
70
  class User < ActiveRecord::Base
58
71
  has_a_braintree_customer do
59
72
  attribute_map :first_name => :firstname, :last_name => :lastname
@@ -67,8 +80,9 @@ If you don't like the default settings or your user needs a field mapping, you c
67
80
  free_trial 30.days, :reminder => 7.days
68
81
  end
69
82
  end
83
+ </pre>
70
84
 
71
- == Note on Patches/Pull Requests
85
+ h2. Note on Patches/Pull Requests
72
86
 
73
87
  * Fork the project.
74
88
  * Make your feature addition or bug fix.
@@ -76,6 +90,6 @@ If you don't like the default settings or your user needs a field mapping, you c
76
90
  * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
77
91
  * Send me a pull request. Bonus points for topic branches.
78
92
 
79
- == Copyright
93
+ h2. Copyright
80
94
 
81
95
  Copyright (c) 2010 MarginLeft, LLC. See LICENSE for details.
data/Rakefile CHANGED
@@ -10,8 +10,10 @@ begin
10
10
  gem.email = "james@marginleft.com"
11
11
  gem.homepage = "http://github.com/jamesdaniels/redline"
12
12
  gem.authors = ["James Daniels"]
13
- gem.add_development_dependency "rspec", ">= 1.2.9"
14
- gem.add_development_dependency "braintree"
13
+ gem.add_development_dependency "rspec", "~> 1.2.9"
14
+ gem.add_development_dependency "metric_fu", "~> 2.0.1"
15
+ gem.add_development_dependency 'sqlite3-ruby', '~> 1.3.1'
16
+ gem.add_dependency 'braintree', '~> 1.2.1'
15
17
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
18
  end
17
19
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.3.4
@@ -1,76 +1,80 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{redline}
8
- s.version = "0.3.3"
8
+ s.version = "0.3.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Daniels"]
12
- s.date = %q{2010-04-13}
12
+ s.date = %q{2010-11-23}
13
13
  s.description = %q{Syncs your AR models with Braintree (Payment Gateway) and offers a lightweight reoccurring billing script}
14
14
  s.email = %q{james@marginleft.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc"
17
+ "README.textile"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "lib/redline.rb",
27
- "lib/redline/billing/base.rb",
28
- "lib/redline/customer/base.rb",
29
- "lib/redline/customer/instance.rb",
30
- "lib/redline/customer/settings.rb",
31
- "lib/redline/subscription/base.rb",
32
- "lib/redline/subscription/instance.rb",
33
- "lib/redline/subscription/settings.rb",
34
- "redline.gemspec",
35
- "spec/billing_spec.rb",
36
- "spec/customer_spec.rb",
37
- "spec/db/database.yml",
38
- "spec/db/models.rb",
39
- "spec/db/schema.rb",
40
- "spec/redline_spec.rb",
41
- "spec/spec.opts",
42
- "spec/spec_helper.rb",
43
- "spec/subscription_spec.rb"
21
+ "LICENSE",
22
+ "README.textile",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "lib/redline.rb",
26
+ "lib/redline/billing/base.rb",
27
+ "lib/redline/customer/base.rb",
28
+ "lib/redline/customer/instance.rb",
29
+ "lib/redline/customer/settings.rb",
30
+ "lib/redline/subscription/base.rb",
31
+ "lib/redline/subscription/instance.rb",
32
+ "lib/redline/subscription/settings.rb",
33
+ "redline.gemspec",
34
+ "spec/billing_spec.rb",
35
+ "spec/customer_spec.rb",
36
+ "spec/db/database.yml",
37
+ "spec/db/models.rb",
38
+ "spec/db/schema.rb",
39
+ "spec/redline_spec.rb",
40
+ "spec/spec.opts",
41
+ "spec/spec_helper.rb",
42
+ "spec/subscription_spec.rb"
44
43
  ]
45
44
  s.homepage = %q{http://github.com/jamesdaniels/redline}
46
- s.rdoc_options = ["--charset=UTF-8"]
47
45
  s.require_paths = ["lib"]
48
- s.rubygems_version = %q{1.3.6}
46
+ s.rubygems_version = %q{1.3.7}
49
47
  s.summary = %q{Syncs your AR models with Braintree (Payment Gateway) and offers a lightweight reoccurring billing script}
50
48
  s.test_files = [
51
49
  "spec/billing_spec.rb",
52
- "spec/customer_spec.rb",
53
- "spec/db/models.rb",
54
- "spec/db/schema.rb",
55
- "spec/redline_spec.rb",
56
- "spec/spec_helper.rb",
57
- "spec/subscription_spec.rb"
50
+ "spec/customer_spec.rb",
51
+ "spec/db/models.rb",
52
+ "spec/db/schema.rb",
53
+ "spec/redline_spec.rb",
54
+ "spec/spec_helper.rb",
55
+ "spec/subscription_spec.rb"
58
56
  ]
59
57
 
60
58
  if s.respond_to? :specification_version then
61
59
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
62
60
  s.specification_version = 3
63
61
 
64
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
65
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
66
- s.add_development_dependency(%q<braintree>, [">= 0"])
62
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
63
+ s.add_development_dependency(%q<rspec>, ["~> 1.2.9"])
64
+ s.add_development_dependency(%q<metric_fu>, ["~> 2.0.1"])
65
+ s.add_development_dependency(%q<sqlite3-ruby>, ["~> 1.3.1"])
66
+ s.add_runtime_dependency(%q<braintree>, ["~> 1.2.1"])
67
67
  else
68
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
69
- s.add_dependency(%q<braintree>, [">= 0"])
68
+ s.add_dependency(%q<rspec>, ["~> 1.2.9"])
69
+ s.add_dependency(%q<metric_fu>, ["~> 2.0.1"])
70
+ s.add_dependency(%q<sqlite3-ruby>, ["~> 1.3.1"])
71
+ s.add_dependency(%q<braintree>, ["~> 1.2.1"])
70
72
  end
71
73
  else
72
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
73
- s.add_dependency(%q<braintree>, [">= 0"])
74
+ s.add_dependency(%q<rspec>, ["~> 1.2.9"])
75
+ s.add_dependency(%q<metric_fu>, ["~> 2.0.1"])
76
+ s.add_dependency(%q<sqlite3-ruby>, ["~> 1.3.1"])
77
+ s.add_dependency(%q<braintree>, ["~> 1.2.1"])
74
78
  end
75
79
  end
76
80
 
@@ -161,14 +161,14 @@ describe ComplexUser do
161
161
  user.plan = :spicy
162
162
  user.paid_until = Date.today - 6.days
163
163
  user.trial_until = Date.today - 37.days
164
- user.past_due.should eql(6.days)
164
+ user.past_due.should eql(6.days.to_f)
165
165
  end
166
166
  it 'should handle trials' do
167
167
  user = ComplexUser.new
168
168
  user.plan = :spicy
169
169
  user.paid_until = nil
170
170
  user.trial_until = Date.today - 1.days
171
- user.past_due.should eql(1.days)
171
+ user.past_due.should eql(1.days.to_f)
172
172
  end
173
173
  end
174
174
  describe 'not overdue' do
@@ -234,4 +234,4 @@ describe UserWithoutTrial do
234
234
  UserWithoutTrial.trial_settings.should == {:period=>0.days, :reminder=>5.days}
235
235
  end
236
236
 
237
- end
237
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redline
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 27
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 3
9
- version: 0.3.3
9
+ - 4
10
+ version: 0.3.4
10
11
  platform: ruby
11
12
  authors:
12
13
  - James Daniels
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-04-13 00:00:00 -04:00
18
+ date: 2010-11-23 00:00:00 -05:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rspec
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
- - - ">="
27
+ - - ~>
26
28
  - !ruby/object:Gem::Version
29
+ hash: 13
27
30
  segments:
28
31
  - 1
29
32
  - 2
@@ -32,17 +35,53 @@ dependencies:
32
35
  type: :development
33
36
  version_requirements: *id001
34
37
  - !ruby/object:Gem::Dependency
35
- name: braintree
38
+ name: metric_fu
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
- - - ">="
43
+ - - ~>
40
44
  - !ruby/object:Gem::Version
45
+ hash: 13
41
46
  segments:
47
+ - 2
42
48
  - 0
43
- version: "0"
49
+ - 1
50
+ version: 2.0.1
44
51
  type: :development
45
52
  version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: sqlite3-ruby
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 25
62
+ segments:
63
+ - 1
64
+ - 3
65
+ - 1
66
+ version: 1.3.1
67
+ type: :development
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: braintree
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ hash: 29
78
+ segments:
79
+ - 1
80
+ - 2
81
+ - 1
82
+ version: 1.2.1
83
+ type: :runtime
84
+ version_requirements: *id004
46
85
  description: Syncs your AR models with Braintree (Payment Gateway) and offers a lightweight reoccurring billing script
47
86
  email: james@marginleft.com
48
87
  executables: []
@@ -51,12 +90,11 @@ extensions: []
51
90
 
52
91
  extra_rdoc_files:
53
92
  - LICENSE
54
- - README.rdoc
93
+ - README.textile
55
94
  files:
56
95
  - .document
57
- - .gitignore
58
96
  - LICENSE
59
- - README.rdoc
97
+ - README.textile
60
98
  - Rakefile
61
99
  - VERSION
62
100
  - lib/redline.rb
@@ -82,28 +120,32 @@ homepage: http://github.com/jamesdaniels/redline
82
120
  licenses: []
83
121
 
84
122
  post_install_message:
85
- rdoc_options:
86
- - --charset=UTF-8
123
+ rdoc_options: []
124
+
87
125
  require_paths:
88
126
  - lib
89
127
  required_ruby_version: !ruby/object:Gem::Requirement
128
+ none: false
90
129
  requirements:
91
130
  - - ">="
92
131
  - !ruby/object:Gem::Version
132
+ hash: 3
93
133
  segments:
94
134
  - 0
95
135
  version: "0"
96
136
  required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
97
138
  requirements:
98
139
  - - ">="
99
140
  - !ruby/object:Gem::Version
141
+ hash: 3
100
142
  segments:
101
143
  - 0
102
144
  version: "0"
103
145
  requirements: []
104
146
 
105
147
  rubyforge_project:
106
- rubygems_version: 1.3.6
148
+ rubygems_version: 1.3.7
107
149
  signing_key:
108
150
  specification_version: 3
109
151
  summary: Syncs your AR models with Braintree (Payment Gateway) and offers a lightweight reoccurring billing script
data/.gitignore DELETED
@@ -1,24 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
- Icon*
4
-
5
- ## TEXTMATE
6
- *.tmproj
7
- tmtags
8
-
9
- ## EMACS
10
- *~
11
- \#*
12
- .\#*
13
-
14
- ## VIM
15
- *.swp
16
-
17
- ## PROJECT::GENERAL
18
- coverage
19
- rdoc
20
- pkg
21
-
22
- ## PROJECT::SPECIFIC
23
- spec/db/test.sqlite3
24
- tmp/