paypal-express 0.0.1
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.
- data/.document +5 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/Gemfile +2 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +20 -0
- data/VERSION +1 -0
- data/lib/cert +3509 -0
- data/lib/paypal.rb +56 -0
- data/lib/paypal/base.rb +19 -0
- data/lib/paypal/exceptions.rb +21 -0
- data/lib/paypal/express.rb +1 -0
- data/lib/paypal/express/request.rb +64 -0
- data/lib/paypal/express/response.rb +19 -0
- data/lib/paypal/nvp/request.rb +59 -0
- data/lib/paypal/nvp/response.rb +145 -0
- data/lib/paypal/payment/recurring.rb +43 -0
- data/lib/paypal/payment/recurring/activation.rb +14 -0
- data/lib/paypal/payment/recurring/billing.rb +37 -0
- data/lib/paypal/payment/recurring/summary.rb +11 -0
- data/lib/paypal/payment/request.rb +24 -0
- data/lib/paypal/payment/response.rb +36 -0
- data/lib/paypal/payment/response/amount.rb +11 -0
- data/lib/paypal/payment/response/info.rb +40 -0
- data/lib/paypal/payment/response/payer.rb +7 -0
- data/lib/paypal/payment/response/ship_to.rb +7 -0
- data/lib/paypal/util.rb +28 -0
- data/lib/restclient_with_ssl_support.rb +16 -0
- data/paypal-express.gemspec +24 -0
- data/spec/fake_response/CreateRecurringPaymentsProfile/failure.txt +1 -0
- data/spec/fake_response/CreateRecurringPaymentsProfile/success.txt +1 -0
- data/spec/fake_response/DoExpressCheckoutPayment/failure.txt +1 -0
- data/spec/fake_response/DoExpressCheckoutPayment/success.txt +1 -0
- data/spec/fake_response/GetExpressCheckoutDetails/failure.txt +1 -0
- data/spec/fake_response/GetExpressCheckoutDetails/success.txt +1 -0
- data/spec/fake_response/GetRecurringPaymentsProfileDetails/failure.txt +1 -0
- data/spec/fake_response/GetRecurringPaymentsProfileDetails/success.txt +1 -0
- data/spec/fake_response/ManageRecurringPaymentsProfileStatus/failure.txt +1 -0
- data/spec/fake_response/ManageRecurringPaymentsProfileStatus/success.txt +1 -0
- data/spec/fake_response/SetExpressCheckout/failure.txt +1 -0
- data/spec/fake_response/SetExpressCheckout/success.txt +1 -0
- data/spec/helpers/fake_response_helper.rb +27 -0
- data/spec/paypal/exception_spec.rb +17 -0
- data/spec/paypal/express/request_spec.rb +223 -0
- data/spec/paypal/express/response_spec.rb +33 -0
- data/spec/paypal/nvp/request_spec.rb +88 -0
- data/spec/paypal/payment/recurring_spec.rb +114 -0
- data/spec/paypal/payment/request_spec.rb +55 -0
- data/spec/paypal/payment/response/amount_spec.rb +36 -0
- data/spec/paypal/payment/response/info_spec.rb +88 -0
- data/spec/paypal/payment/response/payer_spec.rb +26 -0
- data/spec/paypal/payment/response/ship_to_spec.rb +26 -0
- data/spec/paypal/util_spec.rb +32 -0
- data/spec/spec_helper.rb +22 -0
- metadata +267 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
describe Paypal::Payment::Response::ShipTo do
|
4
|
+
let :keys do
|
5
|
+
Paypal::Payment::Response::ShipTo.optional_attributes
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '.new' do
|
9
|
+
it 'should allow nil for attributes' do
|
10
|
+
payer = Paypal::Payment::Response::ShipTo.new
|
11
|
+
keys.each do |key|
|
12
|
+
payer.send(key).should be_nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should treat all attributes as String' do
|
17
|
+
attributes = keys.inject({}) do |attributes, key|
|
18
|
+
attributes.merge!(key => "xyz")
|
19
|
+
end
|
20
|
+
payer = Paypal::Payment::Response::ShipTo.new attributes
|
21
|
+
keys.each do |key|
|
22
|
+
payer.send(key).should == "xyz"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
describe Paypal::Util do
|
4
|
+
describe '.formatted_amount' do
|
5
|
+
it 'should return String in "xx.yy" format' do
|
6
|
+
Paypal::Util.formatted_amount(nil).should == '0.00'
|
7
|
+
Paypal::Util.formatted_amount(10).should == '10.00'
|
8
|
+
Paypal::Util.formatted_amount(10.02).should == '10.02'
|
9
|
+
Paypal::Util.formatted_amount(10.2).should == '10.20'
|
10
|
+
Paypal::Util.formatted_amount(10.24).should == '10.24'
|
11
|
+
Paypal::Util.formatted_amount(10.255).should == '10.25'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '.to_numeric' do
|
16
|
+
it 'should return Numeric' do
|
17
|
+
Paypal::Util.to_numeric('10').should be_kind_of(Integer)
|
18
|
+
Paypal::Util.to_numeric('10.5').should be_kind_of(Float)
|
19
|
+
Paypal::Util.to_numeric('-1.5').should == -1.5
|
20
|
+
Paypal::Util.to_numeric('-1').should == -1
|
21
|
+
Paypal::Util.to_numeric('0').should == 0
|
22
|
+
Paypal::Util.to_numeric('0.00').should == 0
|
23
|
+
Paypal::Util.to_numeric('10').should == 10
|
24
|
+
Paypal::Util.to_numeric('10.00').should == 10
|
25
|
+
Paypal::Util.to_numeric('10.02').should == 10.02
|
26
|
+
Paypal::Util.to_numeric('10.2').should == 10.2
|
27
|
+
Paypal::Util.to_numeric('10.20').should == 10.2
|
28
|
+
Paypal::Util.to_numeric('10.24').should == 10.24
|
29
|
+
Paypal::Util.to_numeric('10.25').should == 10.25
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
|
4
|
+
require 'paypal'
|
5
|
+
require 'rspec'
|
6
|
+
require 'helpers/fake_response_helper'
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.before do
|
10
|
+
Paypal.logger = double("logger")
|
11
|
+
end
|
12
|
+
config.after do
|
13
|
+
FakeWeb.clean_registry
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def sandbox_mode(&block)
|
18
|
+
Paypal.sandbox!
|
19
|
+
yield
|
20
|
+
ensure
|
21
|
+
Paypal.sandbox = false
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,267 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: paypal-express
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- nov matake
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-02-08 00:00:00 +09:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: activesupport
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 5
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 3
|
33
|
+
version: "2.3"
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: i18n
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rest-client
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 7
|
59
|
+
segments:
|
60
|
+
- 1
|
61
|
+
- 4
|
62
|
+
version: "1.4"
|
63
|
+
type: :runtime
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: attr_required
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 25
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
- 0
|
77
|
+
- 3
|
78
|
+
version: 0.0.3
|
79
|
+
type: :runtime
|
80
|
+
version_requirements: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rake
|
83
|
+
prerelease: false
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 27
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
- 8
|
93
|
+
version: "0.8"
|
94
|
+
type: :development
|
95
|
+
version_requirements: *id005
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: rcov
|
98
|
+
prerelease: false
|
99
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
hash: 25
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
- 9
|
108
|
+
version: "0.9"
|
109
|
+
type: :development
|
110
|
+
version_requirements: *id006
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
prerelease: false
|
114
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
hash: 7
|
120
|
+
segments:
|
121
|
+
- 2
|
122
|
+
version: "2"
|
123
|
+
type: :development
|
124
|
+
version_requirements: *id007
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: fakeweb
|
127
|
+
prerelease: false
|
128
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
hash: 27
|
134
|
+
segments:
|
135
|
+
- 1
|
136
|
+
- 3
|
137
|
+
- 0
|
138
|
+
version: 1.3.0
|
139
|
+
type: :development
|
140
|
+
version_requirements: *id008
|
141
|
+
description: Rugy Gem for PayPal Express Checkout API
|
142
|
+
email: nov@matake.jp
|
143
|
+
executables: []
|
144
|
+
|
145
|
+
extensions: []
|
146
|
+
|
147
|
+
extra_rdoc_files:
|
148
|
+
- LICENSE
|
149
|
+
- README.rdoc
|
150
|
+
files:
|
151
|
+
- .document
|
152
|
+
- .gitignore
|
153
|
+
- .rspec
|
154
|
+
- Gemfile
|
155
|
+
- LICENSE
|
156
|
+
- README.rdoc
|
157
|
+
- Rakefile
|
158
|
+
- VERSION
|
159
|
+
- lib/cert
|
160
|
+
- lib/paypal.rb
|
161
|
+
- lib/paypal/base.rb
|
162
|
+
- lib/paypal/exceptions.rb
|
163
|
+
- lib/paypal/express.rb
|
164
|
+
- lib/paypal/express/request.rb
|
165
|
+
- lib/paypal/express/response.rb
|
166
|
+
- lib/paypal/nvp/request.rb
|
167
|
+
- lib/paypal/nvp/response.rb
|
168
|
+
- lib/paypal/payment/recurring.rb
|
169
|
+
- lib/paypal/payment/recurring/activation.rb
|
170
|
+
- lib/paypal/payment/recurring/billing.rb
|
171
|
+
- lib/paypal/payment/recurring/summary.rb
|
172
|
+
- lib/paypal/payment/request.rb
|
173
|
+
- lib/paypal/payment/response.rb
|
174
|
+
- lib/paypal/payment/response/amount.rb
|
175
|
+
- lib/paypal/payment/response/info.rb
|
176
|
+
- lib/paypal/payment/response/payer.rb
|
177
|
+
- lib/paypal/payment/response/ship_to.rb
|
178
|
+
- lib/paypal/util.rb
|
179
|
+
- lib/restclient_with_ssl_support.rb
|
180
|
+
- paypal-express.gemspec
|
181
|
+
- spec/fake_response/CreateRecurringPaymentsProfile/failure.txt
|
182
|
+
- spec/fake_response/CreateRecurringPaymentsProfile/success.txt
|
183
|
+
- spec/fake_response/DoExpressCheckoutPayment/failure.txt
|
184
|
+
- spec/fake_response/DoExpressCheckoutPayment/success.txt
|
185
|
+
- spec/fake_response/GetExpressCheckoutDetails/failure.txt
|
186
|
+
- spec/fake_response/GetExpressCheckoutDetails/success.txt
|
187
|
+
- spec/fake_response/GetRecurringPaymentsProfileDetails/failure.txt
|
188
|
+
- spec/fake_response/GetRecurringPaymentsProfileDetails/success.txt
|
189
|
+
- spec/fake_response/ManageRecurringPaymentsProfileStatus/failure.txt
|
190
|
+
- spec/fake_response/ManageRecurringPaymentsProfileStatus/success.txt
|
191
|
+
- spec/fake_response/SetExpressCheckout/failure.txt
|
192
|
+
- spec/fake_response/SetExpressCheckout/success.txt
|
193
|
+
- spec/helpers/fake_response_helper.rb
|
194
|
+
- spec/paypal/exception_spec.rb
|
195
|
+
- spec/paypal/express/request_spec.rb
|
196
|
+
- spec/paypal/express/response_spec.rb
|
197
|
+
- spec/paypal/nvp/request_spec.rb
|
198
|
+
- spec/paypal/payment/recurring_spec.rb
|
199
|
+
- spec/paypal/payment/request_spec.rb
|
200
|
+
- spec/paypal/payment/response/amount_spec.rb
|
201
|
+
- spec/paypal/payment/response/info_spec.rb
|
202
|
+
- spec/paypal/payment/response/payer_spec.rb
|
203
|
+
- spec/paypal/payment/response/ship_to_spec.rb
|
204
|
+
- spec/paypal/util_spec.rb
|
205
|
+
- spec/spec_helper.rb
|
206
|
+
has_rdoc: true
|
207
|
+
homepage: http://github.com/nov/paypal-express
|
208
|
+
licenses: []
|
209
|
+
|
210
|
+
post_install_message:
|
211
|
+
rdoc_options:
|
212
|
+
- --charset=UTF-8
|
213
|
+
require_paths:
|
214
|
+
- lib
|
215
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
216
|
+
none: false
|
217
|
+
requirements:
|
218
|
+
- - ">="
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
hash: 3
|
221
|
+
segments:
|
222
|
+
- 0
|
223
|
+
version: "0"
|
224
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
|
+
none: false
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
hash: 23
|
230
|
+
segments:
|
231
|
+
- 1
|
232
|
+
- 3
|
233
|
+
- 6
|
234
|
+
version: 1.3.6
|
235
|
+
requirements: []
|
236
|
+
|
237
|
+
rubyforge_project:
|
238
|
+
rubygems_version: 1.5.0
|
239
|
+
signing_key:
|
240
|
+
specification_version: 3
|
241
|
+
summary: PayPal Express Checkout API Client Supporting Both Instant and Recurring Payment
|
242
|
+
test_files:
|
243
|
+
- spec/fake_response/CreateRecurringPaymentsProfile/failure.txt
|
244
|
+
- spec/fake_response/CreateRecurringPaymentsProfile/success.txt
|
245
|
+
- spec/fake_response/DoExpressCheckoutPayment/failure.txt
|
246
|
+
- spec/fake_response/DoExpressCheckoutPayment/success.txt
|
247
|
+
- spec/fake_response/GetExpressCheckoutDetails/failure.txt
|
248
|
+
- spec/fake_response/GetExpressCheckoutDetails/success.txt
|
249
|
+
- spec/fake_response/GetRecurringPaymentsProfileDetails/failure.txt
|
250
|
+
- spec/fake_response/GetRecurringPaymentsProfileDetails/success.txt
|
251
|
+
- spec/fake_response/ManageRecurringPaymentsProfileStatus/failure.txt
|
252
|
+
- spec/fake_response/ManageRecurringPaymentsProfileStatus/success.txt
|
253
|
+
- spec/fake_response/SetExpressCheckout/failure.txt
|
254
|
+
- spec/fake_response/SetExpressCheckout/success.txt
|
255
|
+
- spec/helpers/fake_response_helper.rb
|
256
|
+
- spec/paypal/exception_spec.rb
|
257
|
+
- spec/paypal/express/request_spec.rb
|
258
|
+
- spec/paypal/express/response_spec.rb
|
259
|
+
- spec/paypal/nvp/request_spec.rb
|
260
|
+
- spec/paypal/payment/recurring_spec.rb
|
261
|
+
- spec/paypal/payment/request_spec.rb
|
262
|
+
- spec/paypal/payment/response/amount_spec.rb
|
263
|
+
- spec/paypal/payment/response/info_spec.rb
|
264
|
+
- spec/paypal/payment/response/payer_spec.rb
|
265
|
+
- spec/paypal/payment/response/ship_to_spec.rb
|
266
|
+
- spec/paypal/util_spec.rb
|
267
|
+
- spec/spec_helper.rb
|