cheddargetter_client_rails 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -7,32 +7,48 @@ Much of the heavy lifting with the api itself is done through the cheddargetter_
7
7
 
8
8
  === In the model
9
9
 
10
- class User < ActiveRecord::Base
11
- cheddargetter_billable_on :customer_code, :shared_columns => {
12
- :email => :email,
13
- :firstName => :first_name,
14
- :lastName => :last_name,
15
- :planCode => :plan_code
16
- }
17
- end
18
-
19
- The first argument is the unique identifier column that CheddarGetter uses for the customers' customerCode.
20
- It can be any column as long as it is unique.
10
+ It can be very simple if you go with the default columns, ie:
21
11
 
22
- The shared columns hash are other attributes that appear both in your records for the user and CheddarGetter's records. When the save is called on the subscription object it grabs these attributes from your ActiveRecord
23
- record. This is to prevent duplicate form inputs asking the user more than once for the same information.
12
+ :customerCode => :id
13
+ :email => :email,
14
+ :firstName => :first_name,
15
+ :lastName => :last_name,
16
+ :planCode => :plan_code
24
17
 
25
- The planCode shared attribute may also be set as string, as sometimes you want everyone on the same plan.
18
+ Then the declaration in the model is simply:
26
19
 
27
20
  class User < ActiveRecord::Base
28
- cheddargetter_billable_on :customer_code, :shared_columns => {
29
- :email => :email,
30
- :firstName => :first_name,
31
- :lastName => :last_name,
32
- :planCode => 'PAID_PLAN'
33
- }
21
+ has_subscription
22
+ end
23
+
24
+ These are the only required columns however you can change their names locally very easily.
25
+
26
+ class User < ActiveRecord::Base
27
+ has_subscription :customerCode => :customer_code,
28
+ :firstName => :name
29
+ :lastName => :l_name
30
+ :email => :business_email
31
+ :planCode => "FREE_PLAN"
32
+
34
33
  end
35
34
 
35
+ Note that the plan code can also take a string.
36
+
37
+ The has_subscription will also takes additional key/values of items that appear both in your records for the user and CheddarGetter's records. For instance zip code is a common one. Here are others:
38
+
39
+ :ccFirstName,
40
+ :ccLastName,
41
+ :ccExpiration,
42
+ :ccNumber,
43
+ :ccCountry,
44
+ :ccAddress,
45
+ :ccCity,
46
+ :ccState,
47
+ :company,
48
+ :zip
49
+
50
+ When the save is called on the subscription object or create is called on the user it grabs all shared attributes from your ActiveRecord record.
51
+
36
52
  === In the controller
37
53
 
38
54
  Make sure the subscription is always set on the user as some data may only exist there.
@@ -121,6 +137,7 @@ Do something like this, if it is a user form use fields_for @user.subscription i
121
137
  <dd>
122
138
  <%= subscription.text_field :ccCountry, :autocomplete => 'off' %>
123
139
  </dd>
140
+ </dt
124
141
  </fieldset>
125
142
  <% end %>
126
143
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.14
1
+ 0.1.15
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cheddargetter_client_rails}
8
- s.version = "0.1.14"
8
+ s.version = "0.1.15"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brent Wooden"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cheddargetter_client_rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 14
10
- version: 0.1.14
9
+ - 15
10
+ version: 0.1.15
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brent Wooden