saucy 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/README.md +6 -3
- data/lib/saucy/fake_braintree.rb +14 -8
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -19,12 +19,11 @@ Installation
|
|
19
19
|
|
20
20
|
In your Gemfile:
|
21
21
|
|
22
|
-
gem "saucy"
|
22
|
+
gem "saucy"
|
23
23
|
|
24
|
-
After you bundle, run the
|
24
|
+
After you bundle, run the generator:
|
25
25
|
|
26
26
|
rails generate saucy:install
|
27
|
-
rails generate saucy:views
|
28
27
|
|
29
28
|
You will want to include the `ensure_active_account` `before_filter` in any controller actions that you want to protect if the user is using an past due paid account.
|
30
29
|
|
@@ -99,6 +98,10 @@ partials:
|
|
99
98
|
|
100
99
|
app/views/limits/_#{limitname}_meter.html.erb
|
101
100
|
|
101
|
+
You can override all the views by generating them into your app and customizing them there:
|
102
|
+
|
103
|
+
rails g saucy:views
|
104
|
+
|
102
105
|
## Gotchas
|
103
106
|
|
104
107
|
Make sure you don't do this in ApplicationController:
|
data/lib/saucy/fake_braintree.rb
CHANGED
@@ -49,10 +49,13 @@ ShamRack.at("www.braintreegateway.com", 443).sinatra do
|
|
49
49
|
customer["id"] ||= Digest::MD5.hexdigest("#{params[:merchant_id]}#{Time.now.to_f}")
|
50
50
|
customer["merchant-id"] = params[:merchant_id]
|
51
51
|
if customer["credit_card"] && customer["credit_card"].is_a?(Hash)
|
52
|
-
customer["credit_card"]
|
53
|
-
customer["credit_card"]
|
54
|
-
|
55
|
-
|
52
|
+
customer["credit_card"].delete("__content__")
|
53
|
+
if !customer["credit_card"].empty?
|
54
|
+
customer["credit_card"]["last_4"] = customer["credit_card"].delete("number")[-4..-1]
|
55
|
+
customer["credit_card"]["token"] = Digest::MD5.hexdigest("#{customer['merchant_id']}#{customer['id']}#{Time.now.to_f}")
|
56
|
+
credit_card = customer.delete("credit_card")
|
57
|
+
customer["credit_cards"] = [credit_card]
|
58
|
+
end
|
56
59
|
end
|
57
60
|
FakeBraintree.customers[customer["id"]] = customer
|
58
61
|
[201, { "Content-Encoding" => "gzip" }, ActiveSupport::Gzip.compress(customer.to_xml(:root => 'customer'))]
|
@@ -72,10 +75,13 @@ ShamRack.at("www.braintreegateway.com", 443).sinatra do
|
|
72
75
|
customer["id"] = params[:id]
|
73
76
|
customer["merchant-id"] = params[:merchant_id]
|
74
77
|
if customer["credit_card"] && customer["credit_card"].is_a?(Hash)
|
75
|
-
customer["credit_card"]
|
76
|
-
customer["credit_card"]
|
77
|
-
|
78
|
-
|
78
|
+
customer["credit_card"].delete("__content__")
|
79
|
+
if !customer["credit_card"].empty?
|
80
|
+
customer["credit_card"]["last_4"] = customer["credit_card"].delete("number")[-4..-1]
|
81
|
+
customer["credit_card"]["token"] = Digest::MD5.hexdigest("#{customer['merchant_id']}#{customer['id']}#{Time.now.to_f}")
|
82
|
+
credit_card = customer.delete("credit_card")
|
83
|
+
customer["credit_cards"] = [credit_card]
|
84
|
+
end
|
79
85
|
end
|
80
86
|
FakeBraintree.customers[params["id"]] = customer
|
81
87
|
[200, { "Content-Encoding" => "gzip" }, ActiveSupport::Gzip.compress(customer.to_xml(:root => 'customer'))]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saucy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 1
|
10
|
+
version: 0.6.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- thoughtbot, inc.
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-05-
|
21
|
+
date: 2011-05-03 00:00:00 -04:00
|
22
22
|
default_executable:
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|