pp-adaptive 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +237 -37
- data/lib/pp-adaptive/abstract_request.rb +11 -0
- data/lib/pp-adaptive/client.rb +102 -11
- data/lib/pp-adaptive/exception.rb +4 -0
- data/lib/pp-adaptive/support/json_model.rb +7 -6
- data/lib/pp-adaptive/version.rb +1 -1
- data/lib/pp-adaptive.rb +2 -0
- data/pp-adaptive.gemspec +3 -3
- data/spec/public/client_spec.rb +14 -2
- metadata +35 -15
data/README.md
CHANGED
@@ -1,17 +1,7 @@
|
|
1
1
|
# A Ruby API for PayPal Adaptive Payments
|
2
2
|
|
3
|
-
- Current Status: Work-in-progress (don't use, API subject to major change)
|
4
|
-
- Working:
|
5
|
-
- setting up an explicit preapproval
|
6
|
-
- processing payments (for an explicit preapproval)
|
7
|
-
- Not working:
|
8
|
-
- executing pre-created payments
|
9
|
-
- changing options on a created payment
|
10
|
-
- refunds/cancellations
|
11
|
-
- minor things like currency conversion requests
|
12
|
-
|
13
3
|
This gem provides access to PayPal's Adaptive Payments API using easy-to-use
|
14
|
-
ruby classes.
|
4
|
+
ruby classes. The internals are largely backed by
|
15
5
|
[Virtus](https://github.com/solnic/virtus) and
|
16
6
|
[RestClient](https://github.com/archiloque/rest-client), and so are easy to
|
17
7
|
work with.
|
@@ -22,33 +12,243 @@ Via rubygems:
|
|
22
12
|
|
23
13
|
gem install pp-adaptive
|
24
14
|
|
25
|
-
|
15
|
+
All API calls are made by calling `#execute` on the client, with the relevant
|
16
|
+
request type. Naming conventions have been ruby-ized, but you should just
|
17
|
+
follow along with the PayPal documentation to understand the inputs and outputs.
|
18
|
+
|
19
|
+
Some aliases have been added, to make things simpler. Some example scenarios
|
20
|
+
are outlined below, but due to the size of the API, this README does not aim
|
21
|
+
in any way to be an exhaustive reproduction of the official Adaptive Payments
|
22
|
+
documentation. Given the declarative, model-style, nature of the classes in
|
23
|
+
this gem, it probably makes sense to just browse the source to know what
|
24
|
+
fields are available.
|
25
|
+
|
26
|
+
## Example API calls
|
27
|
+
|
28
|
+
The following example should give you enough of an idea to be able to
|
29
|
+
follow your senses and use this gem in your own applications.
|
30
|
+
|
31
|
+
### Taking a regular payment
|
32
|
+
|
33
|
+
A typical checkout payment request starts like this.
|
26
34
|
|
27
35
|
``` ruby
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
36
|
+
require "pp-adaptive"
|
37
|
+
|
38
|
+
client = AdaptivePayments::Client.new(
|
39
|
+
:user_id => "your-api-user-id",
|
40
|
+
:password => "your-api-password",
|
41
|
+
:signature => "your-api-signature",
|
42
|
+
:app_id => "your-app-id",
|
43
|
+
:sandbox => true
|
44
|
+
)
|
45
|
+
|
46
|
+
client.execute(:Pay,
|
47
|
+
:action_type => "PAY",
|
48
|
+
:receiver_email => "your@email.com",
|
49
|
+
:receiver_amount => 50,
|
50
|
+
:currency_code => "USD",
|
51
|
+
:cancel_url => "https://your-site.com/cancel",
|
52
|
+
:return_url => "https://your-site.com/return"
|
53
|
+
) do |response|
|
54
|
+
|
55
|
+
if response.success?
|
56
|
+
puts "Pay key: #{response.pay_key}"
|
57
|
+
|
58
|
+
# send the user to PayPal to make the payment
|
59
|
+
# e.g. https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=abc
|
60
|
+
redirect_to client.payment_url(response)
|
61
|
+
else
|
62
|
+
puts "#{response.ack_code}: #{response.error_message}"
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
52
66
|
```
|
53
67
|
|
54
|
-
|
68
|
+
### Checking the payment status on return
|
69
|
+
|
70
|
+
When the customer is sent back from PayPal to your `return_url`, you need to
|
71
|
+
check if the payment was successful or not.
|
72
|
+
|
73
|
+
``` ruby
|
74
|
+
require "pp-adaptive"
|
75
|
+
|
76
|
+
client = AdaptivePayments::Client.new(
|
77
|
+
:user_id => "your-api-user-id",
|
78
|
+
:password => "your-api-password",
|
79
|
+
:signature => "your-api-signature",
|
80
|
+
:app_id => "your-app-id",
|
81
|
+
:sandbox => true
|
82
|
+
)
|
83
|
+
|
84
|
+
client.execute(:PaymentDetails, :pay_key => "pay-key-from-pay-request") do |response|
|
85
|
+
if response.success?
|
86
|
+
puts "Payment status: #{response.payment_exec_status}"
|
87
|
+
else
|
88
|
+
puts "#{response.ack_code}: #{response.error_message}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
```
|
92
|
+
|
93
|
+
### Initiating a chained payment
|
94
|
+
|
95
|
+
If you need to take a cut of a payment and forward the remainder onto one
|
96
|
+
or more other recipients, you use a chained payment. This is just a regular
|
97
|
+
PayRequest, except it includes multiple receivers, one of which is marked as
|
98
|
+
'primary'.
|
99
|
+
|
100
|
+
``` ruby
|
101
|
+
require "pp-adaptive"
|
102
|
+
|
103
|
+
client = AdaptivePayments::Client.new(
|
104
|
+
:user_id => "your-api-user-id",
|
105
|
+
:password => "your-api-password",
|
106
|
+
:signature => "your-api-signature",
|
107
|
+
:app_id => "your-app-id",
|
108
|
+
:sandbox => true
|
109
|
+
)
|
110
|
+
|
111
|
+
client.execute(:Pay,
|
112
|
+
:action_type => "PAY",
|
113
|
+
:currency_code => "USD",
|
114
|
+
:cancel_url => "https://your-site.com/cancel",
|
115
|
+
:return_url => "https://your-site.com/return",
|
116
|
+
:receivers => [
|
117
|
+
{ :email => "your@email.com", :amount => 50, :primary => true },
|
118
|
+
{ :email => "other@site.tld", :amount => 45 }
|
119
|
+
]
|
120
|
+
) do |response|
|
121
|
+
|
122
|
+
if response.success?
|
123
|
+
puts "Pay key: #{response.pay_key}"
|
124
|
+
|
125
|
+
# send the user to PayPal to make the payment
|
126
|
+
# e.g. https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=abc
|
127
|
+
redirect_to client.payment_url(response)
|
128
|
+
else
|
129
|
+
puts "#{response.ack_code}: #{response.error_message}"
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
```
|
134
|
+
|
135
|
+
In the above example, you get $5 from the $50 payment, with the remaining $45
|
136
|
+
going to other@site.tld.
|
137
|
+
|
138
|
+
### Setting up a Preapproval Agreement
|
139
|
+
|
140
|
+
If you need to be able to take payments from a user's account on-demand, you
|
141
|
+
get the user to authorize you for preapproved payments.
|
142
|
+
|
143
|
+
``` ruby
|
144
|
+
require "pp-adaptive"
|
145
|
+
|
146
|
+
client = AdaptivePayments::Client.new(
|
147
|
+
:user_id => "your-api-user-id",
|
148
|
+
:password => "your-api-password",
|
149
|
+
:signature => "your-api-signature",
|
150
|
+
:app_id => "your-app-id",
|
151
|
+
:sandbox => false
|
152
|
+
)
|
153
|
+
|
154
|
+
client.execute(:Preapproval,
|
155
|
+
:ending_date => DateTime.now.next_year,
|
156
|
+
:starting_date => DateTime.now,
|
157
|
+
:max_total_amount => BigDecimal("950.00"),
|
158
|
+
:currency_code => "USD",
|
159
|
+
:cancel_url => "http://site.com/cancelled",
|
160
|
+
:return_url => "http://site.com/completed"
|
161
|
+
) do |response|
|
162
|
+
# you may alternatively pass a PreapprovalRequest instance
|
163
|
+
|
164
|
+
if response.success?
|
165
|
+
puts "Preapproval key: #{response.preapproval_key}"
|
166
|
+
|
167
|
+
# send the user to PayPal to give their approval
|
168
|
+
# e.g. https://www.paypal.com/webscr?cmd=_ap-preapproval&preapprovalkey=abc
|
169
|
+
redirect_to client.preapproval_url(response)
|
170
|
+
else
|
171
|
+
puts "#{response.ack_code}: #{response.error_message}"
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
```
|
176
|
+
|
177
|
+
### Taking a payment using an existing Preapproval
|
178
|
+
|
179
|
+
To take a payment from a user who has previously authorized you for preapproved
|
180
|
+
payments, just pass the `pay_key` in the usual PayRequest.
|
181
|
+
|
182
|
+
``` ruby
|
183
|
+
require "pp-adaptive"
|
184
|
+
|
185
|
+
client = AdaptivePayments::Client.new(
|
186
|
+
:user_id => "your-api-user-id",
|
187
|
+
:password => "your-api-password",
|
188
|
+
:signature => "your-api-signature",
|
189
|
+
:app_id => "your-app-id",
|
190
|
+
:sandbox => false
|
191
|
+
)
|
192
|
+
|
193
|
+
client.execute(:Pay,
|
194
|
+
:preapproval_key => "existing-preapproval-key",
|
195
|
+
:action_type => "PAY",
|
196
|
+
:receiver_email => "your@email.com",
|
197
|
+
:receiver_amount => 50,
|
198
|
+
:currency_code => "USD",
|
199
|
+
:cancel_url => "https://your-site.com/cancel",
|
200
|
+
:return_url => "https://your-site.com/return"
|
201
|
+
) do |response|
|
202
|
+
|
203
|
+
if response.success?
|
204
|
+
puts "Pay key: #{response.pay_key}"
|
205
|
+
puts "Status: #{response.payment_exec_status}"
|
206
|
+
else
|
207
|
+
puts "#{response.ack_code}: #{response.error_message}"
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
211
|
+
```
|
212
|
+
|
213
|
+
### Issuing a refund
|
214
|
+
|
215
|
+
If you have the pay_key from a previously made payment (up to 60 days), you
|
216
|
+
can send a RefundRequest.
|
217
|
+
|
218
|
+
``` ruby
|
219
|
+
require "pp-adaptive"
|
220
|
+
|
221
|
+
client = AdaptivePayments::Client.new(
|
222
|
+
:user_id => "your-api-user-id",
|
223
|
+
:password => "your-api-password",
|
224
|
+
:signature => "your-api-signature",
|
225
|
+
:app_id => "your-app-id",
|
226
|
+
:sandbox => false
|
227
|
+
)
|
228
|
+
|
229
|
+
client.execute(:Refund, :pay_key => "the-pay-key") do |response|
|
230
|
+
if response.success?
|
231
|
+
puts "Refund sent"
|
232
|
+
else
|
233
|
+
puts "#{response.ack_code}: #{response.error_message}"
|
234
|
+
end
|
235
|
+
end
|
236
|
+
```
|
237
|
+
|
238
|
+
You can also do partial refunds by passing an `amount` field in the request.
|
239
|
+
|
240
|
+
### Other API calls
|
241
|
+
|
242
|
+
Adaptive Payments is a very extensive API with a lot of endpoints and a lot
|
243
|
+
of fields within each request. It wouldn't be wise to attempt to document them
|
244
|
+
all here, but the official API documentation covers everything in detail.
|
245
|
+
|
246
|
+
https://cms.paypal.com/cms_content/US/en_US/files/developer/PP_AdaptivePayments.pdf
|
247
|
+
|
248
|
+
Just ruby-ize the fields (i.e. underscores, not camel case) and open up the
|
249
|
+
request/response classes in this repository to get a feel for how this all works.
|
250
|
+
|
251
|
+
## License & Copyright
|
252
|
+
|
253
|
+
Copyright © Flippa.com Pty Ltd. Licensed under the MIT license. See the
|
254
|
+
LICENSE file for details.
|
@@ -28,6 +28,17 @@ module AdaptivePayments
|
|
28
28
|
@operation
|
29
29
|
end
|
30
30
|
|
31
|
+
# Get the request class for the given operation.
|
32
|
+
#
|
33
|
+
# @param [Symbol] operation
|
34
|
+
# the name of the operation
|
35
|
+
#
|
36
|
+
# @return [AbstractRequest]
|
37
|
+
# the request subclass
|
38
|
+
def for_operation(name)
|
39
|
+
AdaptivePayments.const_get(name.to_s + "Request")
|
40
|
+
end
|
41
|
+
|
31
42
|
# Given a JSON string, return the corresponding response.
|
32
43
|
#
|
33
44
|
# @param [String] json
|
data/lib/pp-adaptive/client.rb
CHANGED
@@ -2,6 +2,7 @@ require "rest-client"
|
|
2
2
|
require "virtus"
|
3
3
|
|
4
4
|
module AdaptivePayments
|
5
|
+
# The principle hub through which all requests and responses are passed.
|
5
6
|
class Client
|
6
7
|
include Virtus
|
7
8
|
|
@@ -11,45 +12,135 @@ module AdaptivePayments
|
|
11
12
|
attribute :app_id, String, :header => "X-PAYPAL-APPLICATION-ID"
|
12
13
|
attribute :device_ip, String, :header => "X-PAYPAL-DEVICE-IPADDRESS"
|
13
14
|
|
15
|
+
# Initialize the client with the given options.
|
16
|
+
#
|
17
|
+
# Options can also be passed via the accessors, if prefered.
|
18
|
+
#
|
19
|
+
# @option [String] user_id
|
20
|
+
# the adaptive payments API user id
|
21
|
+
#
|
22
|
+
# @option [String] password
|
23
|
+
# the adaptive payments API password
|
24
|
+
#
|
25
|
+
# @option [String] signature
|
26
|
+
# the adaptive payments API signature
|
27
|
+
#
|
28
|
+
# @option [String] app_id
|
29
|
+
# the app ID given to use adaptive payments
|
30
|
+
#
|
31
|
+
# @option [String] device_ip
|
32
|
+
# the IP address of the user, optional
|
33
|
+
#
|
34
|
+
# @option [Boolean] sandbox
|
35
|
+
# true if using the sandbox, not production
|
14
36
|
def initialize(options = {})
|
15
37
|
super
|
16
38
|
self.sandbox = options[:sandbox]
|
17
39
|
end
|
18
40
|
|
41
|
+
# Turn on/off sandbox mode.
|
19
42
|
def sandbox=(flag)
|
20
43
|
@sandbox = !!flag
|
21
44
|
end
|
22
45
|
|
46
|
+
# Test if the client is using the sandbox.
|
47
|
+
#
|
48
|
+
# @return [Boolean]
|
49
|
+
# true if using the sandbox
|
23
50
|
def sandbox?
|
24
51
|
!!@sandbox
|
25
52
|
end
|
26
53
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
54
|
+
# Execute a Request.
|
55
|
+
#
|
56
|
+
# @example
|
57
|
+
# response = client.execute(:Refund, pay_key: "abc", amount: 42)
|
58
|
+
# puts response.ack_code
|
59
|
+
#
|
60
|
+
# @params [Symbol] operation_name
|
61
|
+
# The name of the operation to perform.
|
62
|
+
# This maps with the name of the Request class.
|
63
|
+
#
|
64
|
+
# @params [Hash] attributes
|
65
|
+
# attributes used to build the request
|
66
|
+
#
|
67
|
+
# @return [AbstractResponse]
|
68
|
+
# a response object for the given operation
|
69
|
+
#
|
70
|
+
# @yield [AbstractResponse]
|
71
|
+
# optional way to receive the return value
|
72
|
+
def execute(*args)
|
73
|
+
request =
|
74
|
+
case args.size
|
75
|
+
when 1 then args[0]
|
76
|
+
when 2 then AbstractRequest.for_operation(args[0]).new(args[1])
|
77
|
+
else
|
78
|
+
raise ArgumentError, "Invalid arguments: #{args.size} for (1..2)"
|
79
|
+
end
|
33
80
|
|
34
|
-
resource = RestClient::Resource.new(
|
81
|
+
resource = RestClient::Resource.new(api_url, :headers => headers)
|
35
82
|
response = resource[request.class.operation.to_s].post(
|
36
83
|
request.to_json,
|
37
84
|
:content_type => :json,
|
38
85
|
:accept => :json
|
39
86
|
)
|
40
|
-
request.class.build_response(response)
|
87
|
+
request.class.build_response(response).tap do |res|
|
88
|
+
yield res if block_given?
|
89
|
+
end
|
90
|
+
rescue RestClient::Exception => e
|
91
|
+
raise AdaptivePayments::Exception, e
|
92
|
+
end
|
93
|
+
|
94
|
+
# When initiating a preapproval, get the URL on paypal.com to send the user to.
|
95
|
+
#
|
96
|
+
# @param [PreapprovalResponse] response
|
97
|
+
# the response when setting up the preapproval
|
98
|
+
#
|
99
|
+
# @return [String]
|
100
|
+
# the URL on paypal.com to send the user to
|
101
|
+
def preapproval_url(response)
|
102
|
+
[
|
103
|
+
"https://www.",
|
104
|
+
("sandbox." if sandbox?),
|
105
|
+
"paypal.com/webscr?cmd=_ap-preapproval&preapprovalkey=",
|
106
|
+
response.preapproval_key
|
107
|
+
].join
|
108
|
+
end
|
109
|
+
|
110
|
+
# When initiating a payment, get the URL on paypal.com to send the user to.
|
111
|
+
#
|
112
|
+
# @param [PayResponse] response
|
113
|
+
# the response when setting up the payment
|
114
|
+
#
|
115
|
+
# @return [String]
|
116
|
+
# the URL on paypal.com to send the user to
|
117
|
+
def payment_url(response)
|
118
|
+
[
|
119
|
+
"https://www.",
|
120
|
+
("sandbox." if sandbox?),
|
121
|
+
"paypal.com/webscr?cmd=_ap-payment&paykey=",
|
122
|
+
response.preapproval_key
|
123
|
+
].join
|
41
124
|
end
|
42
125
|
|
43
126
|
private
|
44
127
|
|
128
|
+
def api_url
|
129
|
+
[
|
130
|
+
"https://svcs.",
|
131
|
+
("sandbox." if sandbox?),
|
132
|
+
"paypal.com/AdaptivePayments"
|
133
|
+
].join
|
134
|
+
end
|
135
|
+
|
45
136
|
def headers
|
46
137
|
base_headers = {
|
47
138
|
"X-PAYPAL-RESPONSE-DATA-FORMAT" => "JSON",
|
48
139
|
"X-PAYPAL-REQUEST-DATA-FORMAT" => "JSON"
|
49
140
|
}
|
50
|
-
|
51
|
-
next hash if
|
52
|
-
hash.merge(
|
141
|
+
attribute_set.inject(base_headers) do |hash, attr|
|
142
|
+
next hash if self[attr.name].nil?
|
143
|
+
hash.merge(attr.options[:header] => self[attr.name])
|
53
144
|
end
|
54
145
|
end
|
55
146
|
end
|
@@ -74,11 +74,11 @@ module AdaptivePayments
|
|
74
74
|
private
|
75
75
|
|
76
76
|
def attribute_key(key)
|
77
|
-
Hash[
|
77
|
+
Hash[attribute_set.map { |attr| [attr.options.fetch(:param, attr.name).to_s, attr.name.to_sym] }][key] || key.to_sym
|
78
78
|
end
|
79
79
|
|
80
80
|
def attribute_value(key, value)
|
81
|
-
return unless attribute =
|
81
|
+
return unless attribute = attribute_set[attribute_key(key)]
|
82
82
|
|
83
83
|
case attribute
|
84
84
|
when Node
|
@@ -98,8 +98,9 @@ module AdaptivePayments
|
|
98
98
|
# @return [Hash]
|
99
99
|
# the JSON representation in ruby Hash form
|
100
100
|
def to_hash
|
101
|
-
|
102
|
-
|
101
|
+
Hash[attribute_set.map{ |a| [a.name, self[a.name]] }].
|
102
|
+
inject({}) { |hash, (key, value)| value.nil? ? hash : hash.merge(json_key(key) => json_value(value)) }.
|
103
|
+
reject { |key, value| value.kind_of?(Enumerable) && value.none? }
|
103
104
|
end
|
104
105
|
|
105
106
|
# Convert this JsonModel into a JSON string for transport to the PayPal API
|
@@ -113,8 +114,8 @@ module AdaptivePayments
|
|
113
114
|
private
|
114
115
|
|
115
116
|
def json_key(key)
|
116
|
-
if self.class.
|
117
|
-
self.class.
|
117
|
+
if self.class.attribute_set[key]
|
118
|
+
self.class.attribute_set[key].options.fetch(:param, key).to_s
|
118
119
|
else
|
119
120
|
key.to_s
|
120
121
|
end
|
data/lib/pp-adaptive/version.rb
CHANGED
data/lib/pp-adaptive.rb
CHANGED
data/pp-adaptive.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.email = ["chris@w3style.co.uk"]
|
10
10
|
s.homepage = "https://github.com/"
|
11
11
|
s.summary = %q{Rubygem for working with PayPal's Adaptive Payments API}
|
12
|
-
s.description = %q{
|
12
|
+
s.description = %q{Provides complete access to PayPal's Adaptive Payments API}
|
13
13
|
|
14
14
|
s.rubyforge_project = "pp-adaptive"
|
15
15
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
21
|
s.add_runtime_dependency "rest-client"
|
22
|
-
s.add_runtime_dependency "virtus", ">= 0.
|
22
|
+
s.add_runtime_dependency "virtus", ">= 0.5.1"
|
23
23
|
s.add_runtime_dependency "json"
|
24
|
-
s.add_development_dependency "rspec", ">= 2.
|
24
|
+
s.add_development_dependency "rspec", ">= 2.10"
|
25
25
|
end
|
data/spec/public/client_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe AdaptivePayments::Client do
|
4
|
-
let(:rest_client) { double(:post =>
|
5
|
-
let(:request_class) { stub(:operation => :
|
4
|
+
let(:rest_client) { double(:post => '{}').tap { |d| d.stub(:[] => d) } }
|
5
|
+
let(:request_class) { stub(:operation => :Refund, :build_response => nil) }
|
6
6
|
let(:request) { stub(:class => request_class, :to_json => '{}') }
|
7
7
|
let(:client) { AdaptivePayments::Client.new }
|
8
8
|
|
@@ -82,4 +82,16 @@ describe AdaptivePayments::Client do
|
|
82
82
|
request_class.should_receive(:build_response).and_return(response)
|
83
83
|
client.execute(request).should == response
|
84
84
|
end
|
85
|
+
|
86
|
+
it "allows passing a Symbol + Hash instead of a full request object" do
|
87
|
+
client.execute(:Refund, {}).should be_a_kind_of(AdaptivePayments::RefundResponse)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "yields the response object" do
|
91
|
+
response = stub(:response)
|
92
|
+
request_class.should_receive(:build_response).and_return(response)
|
93
|
+
ret_val = nil
|
94
|
+
client.execute(request) { |r| ret_val = r }
|
95
|
+
ret_val.should == response
|
96
|
+
end
|
85
97
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pp-adaptive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,31 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: virtus
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
31
36
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
37
|
+
version: 0.5.1
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.5.1
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: json
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,20 +53,29 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: rspec
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
53
68
|
- !ruby/object:Gem::Version
|
54
|
-
version: '2.
|
69
|
+
version: '2.10'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
58
|
-
|
59
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.10'
|
78
|
+
description: Provides complete access to PayPal's Adaptive Payments API
|
60
79
|
email:
|
61
80
|
- chris@w3style.co.uk
|
62
81
|
executables: []
|
@@ -76,6 +95,7 @@ files:
|
|
76
95
|
- lib/pp-adaptive/client.rb
|
77
96
|
- lib/pp-adaptive/convert_currency_request.rb
|
78
97
|
- lib/pp-adaptive/convert_currency_response.rb
|
98
|
+
- lib/pp-adaptive/exception.rb
|
79
99
|
- lib/pp-adaptive/execute_payment_request.rb
|
80
100
|
- lib/pp-adaptive/execute_payment_response.rb
|
81
101
|
- lib/pp-adaptive/get_payment_options_request.rb
|
@@ -189,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
209
|
version: '0'
|
190
210
|
requirements: []
|
191
211
|
rubyforge_project: pp-adaptive
|
192
|
-
rubygems_version: 1.8.
|
212
|
+
rubygems_version: 1.8.23
|
193
213
|
signing_key:
|
194
214
|
specification_version: 3
|
195
215
|
summary: Rubygem for working with PayPal's Adaptive Payments API
|