paypal-recurring 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paypal-recurring (0.1.3)
4
+ paypal-recurring (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -99,7 +99,7 @@ module PayPal
99
99
  # response.completed? && response.approved?
100
100
  #
101
101
  def request_payment
102
- params = collect(:amount, :return_url, :cancel_url, :ipn_url, :currency, :description, :payer_id, :token).merge(:payment_action => "Sale")
102
+ params = collect(:amount, :return_url, :cancel_url, :ipn_url, :currency, :description, :payer_id, :token, :reference).merge(:payment_action => "Sale")
103
103
  request.run(:payment, params)
104
104
  end
105
105
 
@@ -9,8 +9,11 @@ module PayPal
9
9
  class_eval <<-RUBY
10
10
  def #{to}
11
11
  @#{to} ||= begin
12
- value = params[:#{from}]
13
- value = send("build_#{to}", params[:#{from}]) if respond_to?("build_#{to}", true)
12
+ from = [#{from.inspect}].flatten
13
+ name = from.find {|name| params[name]}
14
+ value = nil
15
+ value = params[name] if name
16
+ value = send("build_#{to}", value) if respond_to?("build_#{to}", true)
14
17
  value
15
18
  end
16
19
  end
@@ -6,7 +6,8 @@ module PayPal
6
6
  :status => :PAYMENTINFO_0_PAYMENTSTATUS,
7
7
  :amount => :PAYMENTINFO_0_AMT,
8
8
  :fees => :PAYMENTINFO_0_FEEAMT,
9
- :seller_id => :PAYMENTINFO_0_SECUREMERCHANTACCOUNTID
9
+ :seller_id => :PAYMENTINFO_0_SECUREMERCHANTACCOUNTID,
10
+ :reference => [:PROFILEREFERENCE, :PAYMENTREQUEST_0_CUSTOM, :PAYMENTREQUEST_0_INVNUM]
10
11
  )
11
12
 
12
13
  def completed?
@@ -3,7 +3,7 @@ module PayPal
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- PATCH = 3
6
+ PATCH = 4
7
7
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
8
8
  end
9
9
  end
@@ -0,0 +1,19 @@
1
+ require "spec_helper"
2
+
3
+ describe PayPal::Recurring::Response do
4
+ let(:response_class) { Class.new(PayPal::Recurring::Response::Base) }
5
+
6
+ describe ".mapping" do
7
+ it "returns single item mapping" do
8
+ response_class.mapping :foo => :bar
9
+ response = response_class.new(stub(:body => "bar=foo"))
10
+ response.foo.should == "foo"
11
+ end
12
+
13
+ it "returns item from array mapping" do
14
+ response_class.mapping :foo => [:bar, :zaz]
15
+ response = response_class.new(stub(:body => "zaz=foo"))
16
+ response.foo.should == "foo"
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: paypal-recurring
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.3
5
+ version: 0.1.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nando Vieira
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-04 00:00:00 Z
13
+ date: 2011-07-05 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -122,6 +122,7 @@ files:
122
122
  - spec/paypal/notification_spec.rb
123
123
  - spec/paypal/recurring_spec.rb
124
124
  - spec/paypal/request_spec.rb
125
+ - spec/paypal/response/base_spec.rb
125
126
  - spec/paypal/response/checkout_details_spec.rb
126
127
  - spec/paypal/response/checkout_spec.rb
127
128
  - spec/paypal/response/create_recurring_profile_spec.rb
@@ -142,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
143
  requirements:
143
144
  - - ">="
144
145
  - !ruby/object:Gem::Version
145
- hash: 507875766264394818
146
+ hash: 4517482826422449883
146
147
  segments:
147
148
  - 0
148
149
  version: "0"
@@ -151,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
152
  requirements:
152
153
  - - ">="
153
154
  - !ruby/object:Gem::Version
154
- hash: 507875766264394818
155
+ hash: 4517482826422449883
155
156
  segments:
156
157
  - 0
157
158
  version: "0"
@@ -185,6 +186,7 @@ test_files:
185
186
  - spec/paypal/notification_spec.rb
186
187
  - spec/paypal/recurring_spec.rb
187
188
  - spec/paypal/request_spec.rb
189
+ - spec/paypal/response/base_spec.rb
188
190
  - spec/paypal/response/checkout_details_spec.rb
189
191
  - spec/paypal/response/checkout_spec.rb
190
192
  - spec/paypal/response/create_recurring_profile_spec.rb