redline 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/redline/customer/instance.rb +1 -1
- data/redline.gemspec +1 -1
- data/spec/customer_spec.rb +10 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
@@ -5,7 +5,7 @@ module RedLine
|
|
5
5
|
wanted_attributes = Braintree::Customer._create_signature.reject{|a| a.is_a? Hash}.reject{|a| a == :id}
|
6
6
|
wanted_attributes.inject({}) {|hash, key| hash.merge(key => (self.send(self.class.braintree_customer_attribute_map[key] || key) rescue nil))}.
|
7
7
|
merge(:custom_fields => self.class.braintree_customer_custom_fields.inject({}) {|hash, key| hash.merge(key => (self.send(self.class.braintree_customer_attribute_map[key] || key) rescue nil))}).
|
8
|
-
reject { |key, value| value
|
8
|
+
reject { |key, value| value == {}}
|
9
9
|
end
|
10
10
|
def customer
|
11
11
|
Braintree::Customer.find(customer_id) if customer_id
|
data/redline.gemspec
CHANGED
data/spec/customer_spec.rb
CHANGED
@@ -74,6 +74,16 @@ describe ComplexUser do
|
|
74
74
|
:unused_attribute => 'unused'
|
75
75
|
).braintree_customer_attributes.should eql({:first_name=>"James", :last_name=>"Daniels", :email=>"james@marginleft.com", :custom_fields=>{:unused_attribute=>"unused"}})
|
76
76
|
end
|
77
|
+
|
78
|
+
it "should work with nil attributes" do
|
79
|
+
Braintree::Customer.stub!('_create_signature').and_return([:first_name, :last_name, :email])
|
80
|
+
ComplexUser.new(
|
81
|
+
:firstname => 'James',
|
82
|
+
:lastname => 'Daniels',
|
83
|
+
:email => nil,
|
84
|
+
:unused_attribute => 'unused'
|
85
|
+
).braintree_customer_attributes.should eql({:first_name=>"James", :last_name=>"Daniels", :email=> nil, :custom_fields=>{:unused_attribute=>"unused"}})
|
86
|
+
end
|
77
87
|
|
78
88
|
end
|
79
89
|
|