paypal-express 0.5.0 → 0.5.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/.travis.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  rvm:
2
2
  - 1.8.7
3
3
  - 1.9.2
4
- - 1.9.3
5
- - jruby
4
+ - 1.9.3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paypal-express (0.5.0.alpha)
4
+ paypal-express (0.5.0)
5
5
  activesupport (>= 2.3)
6
6
  attr_required (>= 0.0.5)
7
7
  i18n
@@ -10,12 +10,12 @@ PATH
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- activesupport (3.2.3)
13
+ activesupport (3.2.8)
14
14
  i18n (~> 0.6)
15
15
  multi_json (~> 1.0)
16
16
  attr_required (0.0.5)
17
17
  bouncy-castle-java (1.5.0146.1)
18
- configatron (2.9.0)
18
+ configatron (2.9.1)
19
19
  yamler (>= 0.1.0)
20
20
  cover_me (1.2.0)
21
21
  configatron
@@ -23,24 +23,24 @@ GEM
23
23
  diff-lcs (1.1.3)
24
24
  fakeweb (1.3.0)
25
25
  hashie (1.2.0)
26
- i18n (0.6.0)
27
- jruby-openssl (0.7.6.1)
26
+ i18n (0.6.1)
27
+ jruby-openssl (0.7.7)
28
28
  bouncy-castle-java (>= 1.5.0146.1)
29
- mime-types (1.18)
30
- multi_json (1.3.2)
29
+ mime-types (1.19)
30
+ multi_json (1.3.6)
31
31
  rake (0.9.2.2)
32
32
  rest-client (1.6.7)
33
33
  mime-types (>= 1.16)
34
34
  restclient_with_cert (0.0.8)
35
35
  rest-client (>= 1.6)
36
- rspec (2.9.0)
37
- rspec-core (~> 2.9.0)
38
- rspec-expectations (~> 2.9.0)
39
- rspec-mocks (~> 2.9.0)
40
- rspec-core (2.9.0)
41
- rspec-expectations (2.9.0)
36
+ rspec (2.11.0)
37
+ rspec-core (~> 2.11.0)
38
+ rspec-expectations (~> 2.11.0)
39
+ rspec-mocks (~> 2.11.0)
40
+ rspec-core (2.11.1)
41
+ rspec-expectations (2.11.2)
42
42
  diff-lcs (~> 1.1.3)
43
- rspec-mocks (2.9.0)
43
+ rspec-mocks (2.11.2)
44
44
  yamler (0.1.0)
45
45
 
46
46
  PLATFORMS
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -2,6 +2,7 @@ module Paypal
2
2
  module NVP
3
3
  class Request < Base
4
4
  attr_required :username, :password, :signature
5
+ attr_optional :subject
5
6
  attr_accessor :version
6
7
 
7
8
  ENDPOINT = {
@@ -27,6 +28,7 @@ module Paypal
27
28
  :USER => self.username,
28
29
  :PWD => self.password,
29
30
  :SIGNATURE => self.signature,
31
+ :SUBJECT => self.subject,
30
32
  :VERSION => self.version
31
33
  }
32
34
  end
@@ -88,7 +88,7 @@ describe Paypal::Express::Request do
88
88
  end
89
89
  expect do
90
90
  Paypal::Express::Request.new insufficient_attributes
91
- end.should raise_error AttrRequired::AttrMissing
91
+ end.to raise_error AttrRequired::AttrMissing
92
92
  end
93
93
  end
94
94
  end
@@ -97,7 +97,7 @@ describe Paypal::Express::Request do
97
97
  it 'should succeed' do
98
98
  expect do
99
99
  Paypal::Express::Request.new attributes
100
- end.should_not raise_error AttrRequired::AttrMissing
100
+ end.not_to raise_error AttrRequired::AttrMissing
101
101
  end
102
102
  end
103
103
  end
@@ -112,7 +112,7 @@ describe Paypal::Express::Request do
112
112
  it 'should support no_shipping option' do
113
113
  expect do
114
114
  instance.setup instant_payment_request, return_url, cancel_url, :no_shipping => true
115
- end.should request_to nvp_endpoint, :post
115
+ end.to request_to nvp_endpoint, :post
116
116
  instance._method_.should == :SetExpressCheckout
117
117
  instance._sent_params_.should == {
118
118
  :PAYMENTREQUEST_0_DESC => 'Instant Payment Request',
@@ -134,7 +134,7 @@ describe Paypal::Express::Request do
134
134
  it "should support #{option_key} option" do
135
135
  expect do
136
136
  instance.setup instant_payment_request, return_url, cancel_url, option_key => 'some value'
137
- end.should request_to nvp_endpoint, :post
137
+ end.to request_to nvp_endpoint, :post
138
138
  instance._method_.should == :SetExpressCheckout
139
139
  instance._sent_params_.should include param_key
140
140
  instance._sent_params_[param_key].should == 'some value'
@@ -145,7 +145,7 @@ describe Paypal::Express::Request do
145
145
  it 'should call SetExpressCheckout' do
146
146
  expect do
147
147
  instance.setup instant_payment_request, return_url, cancel_url
148
- end.should request_to nvp_endpoint, :post
148
+ end.to request_to nvp_endpoint, :post
149
149
  instance._method_.should == :SetExpressCheckout
150
150
  instance._sent_params_.should == {
151
151
  :PAYMENTREQUEST_0_DESC => 'Instant Payment Request',
@@ -162,7 +162,7 @@ describe Paypal::Express::Request do
162
162
  it 'should call SetExpressCheckout' do
163
163
  expect do
164
164
  instance.setup recurring_payment_request, return_url, cancel_url
165
- end.should request_to nvp_endpoint, :post
165
+ end.to request_to nvp_endpoint, :post
166
166
  instance._method_.should == :SetExpressCheckout
167
167
  instance._sent_params_.should == {
168
168
  :L_BILLINGTYPE0 => :RecurringPayments,
@@ -180,7 +180,7 @@ describe Paypal::Express::Request do
180
180
  it 'should call SetExpressCheckout' do
181
181
  expect do
182
182
  instance.setup reference_transaction_request, return_url, cancel_url
183
- end.should request_to nvp_endpoint, :post
183
+ end.to request_to nvp_endpoint, :post
184
184
  instance._method_.should == :SetExpressCheckout
185
185
  instance._sent_params_.should == {
186
186
  :L_BILLINGTYPE0 => :MerchantInitiatedBilling,
@@ -205,7 +205,7 @@ describe Paypal::Express::Request do
205
205
  it 'should call GetExpressCheckoutDetails' do
206
206
  expect do
207
207
  instance.details 'token'
208
- end.should request_to nvp_endpoint, :post
208
+ end.to request_to nvp_endpoint, :post
209
209
  instance._method_.should == :GetExpressCheckoutDetails
210
210
  instance._sent_params_.should == {
211
211
  :TOKEN => 'token'
@@ -223,7 +223,7 @@ describe Paypal::Express::Request do
223
223
  it 'should call GetTransactionDetails' do
224
224
  expect do
225
225
  instance.transaction_details 'transaction_id'
226
- end.should request_to nvp_endpoint, :post
226
+ end.to request_to nvp_endpoint, :post
227
227
  instance._method_.should == :GetTransactionDetails
228
228
  instance._sent_params_.should == {
229
229
  :TRANSACTIONID=> 'transaction_id'
@@ -234,7 +234,7 @@ describe Paypal::Express::Request do
234
234
  expect do
235
235
  fake_response 'GetTransactionDetails/failure'
236
236
  response = instance.transaction_details 'bad_transaction_id'
237
- end.should raise_error(Paypal::Exception::APIError)
237
+ end.to raise_error(Paypal::Exception::APIError)
238
238
  end
239
239
 
240
240
  it 'should handle all attributes' do
@@ -254,7 +254,7 @@ describe Paypal::Express::Request do
254
254
  it 'should call DoExpressCheckoutPayment' do
255
255
  expect do
256
256
  instance.checkout! 'token', 'payer_id', instant_payment_request
257
- end.should request_to nvp_endpoint, :post
257
+ end.to request_to nvp_endpoint, :post
258
258
  instance._method_.should == :DoExpressCheckoutPayment
259
259
  instance._sent_params_.should == {
260
260
  :PAYERID => 'payer_id',
@@ -299,7 +299,7 @@ describe Paypal::Express::Request do
299
299
  it 'should call CreateRecurringPaymentsProfile' do
300
300
  expect do
301
301
  instance.subscribe! 'token', recurring_profile
302
- end.should request_to nvp_endpoint, :post
302
+ end.to request_to nvp_endpoint, :post
303
303
  instance._method_.should == :CreateRecurringPaymentsProfile
304
304
  instance._sent_params_.should == {
305
305
  :DESC => 'Recurring Profile',
@@ -326,7 +326,7 @@ describe Paypal::Express::Request do
326
326
  it 'should call GetRecurringPaymentsProfileDetails' do
327
327
  expect do
328
328
  instance.subscription 'profile_id'
329
- end.should request_to nvp_endpoint, :post
329
+ end.to request_to nvp_endpoint, :post
330
330
  instance._method_.should == :GetRecurringPaymentsProfileDetails
331
331
  instance._sent_params_.should == {
332
332
  :PROFILEID => 'profile_id'
@@ -344,7 +344,7 @@ describe Paypal::Express::Request do
344
344
  it 'should call ManageRecurringPaymentsProfileStatus' do
345
345
  expect do
346
346
  instance.renew! 'profile_id', :Cancel
347
- end.should request_to nvp_endpoint, :post
347
+ end.to request_to nvp_endpoint, :post
348
348
  instance._method_.should == :ManageRecurringPaymentsProfileStatus
349
349
  instance._sent_params_.should == {
350
350
  :ACTION => :Cancel,
@@ -363,7 +363,7 @@ describe Paypal::Express::Request do
363
363
  it 'should call ManageRecurringPaymentsProfileStatus' do
364
364
  expect do
365
365
  instance.cancel! 'profile_id'
366
- end.should request_to nvp_endpoint, :post
366
+ end.to request_to nvp_endpoint, :post
367
367
  instance._method_.should == :ManageRecurringPaymentsProfileStatus
368
368
  instance._sent_params_.should == {
369
369
  :ACTION => :Cancel,
@@ -382,7 +382,7 @@ describe Paypal::Express::Request do
382
382
  it 'should call ManageRecurringPaymentsProfileStatus' do
383
383
  expect do
384
384
  instance.suspend! 'profile_id'
385
- end.should request_to nvp_endpoint, :post
385
+ end.to request_to nvp_endpoint, :post
386
386
  instance._method_.should == :ManageRecurringPaymentsProfileStatus
387
387
  instance._sent_params_.should == {
388
388
  :ACTION => :Suspend,
@@ -401,7 +401,7 @@ describe Paypal::Express::Request do
401
401
  it 'should call ManageRecurringPaymentsProfileStatus' do
402
402
  expect do
403
403
  instance.reactivate! 'profile_id'
404
- end.should request_to nvp_endpoint, :post
404
+ end.to request_to nvp_endpoint, :post
405
405
  instance._method_.should == :ManageRecurringPaymentsProfileStatus
406
406
  instance._sent_params_.should == {
407
407
  :ACTION => :Reactivate,
@@ -420,7 +420,7 @@ describe Paypal::Express::Request do
420
420
  it 'should call CreateBillingAgreement' do
421
421
  expect do
422
422
  instance.agree! 'token'
423
- end.should request_to nvp_endpoint, :post
423
+ end.to request_to nvp_endpoint, :post
424
424
  instance._method_.should == :CreateBillingAgreement
425
425
  instance._sent_params_.should == {
426
426
  :TOKEN => 'token'
@@ -438,7 +438,7 @@ describe Paypal::Express::Request do
438
438
  it 'should call BillAgreementUpdate' do
439
439
  expect do
440
440
  instance.agreement 'reference_id'
441
- end.should request_to nvp_endpoint, :post
441
+ end.to request_to nvp_endpoint, :post
442
442
  instance._method_.should == :BillAgreementUpdate
443
443
  instance._sent_params_.should == {
444
444
  :REFERENCEID => 'reference_id'
@@ -456,7 +456,7 @@ describe Paypal::Express::Request do
456
456
  it 'should call DoReferenceTransaction' do
457
457
  expect do
458
458
  instance.charge! 'billing_agreement_id', 1000, :currency_code => :JPY
459
- end.should request_to nvp_endpoint, :post
459
+ end.to request_to nvp_endpoint, :post
460
460
  instance._method_.should == :DoReferenceTransaction
461
461
  instance._sent_params_.should == {
462
462
  :REFERENCEID => 'billing_agreement_id',
@@ -477,7 +477,7 @@ describe Paypal::Express::Request do
477
477
  it 'should call BillAgreementUpdate' do
478
478
  expect do
479
479
  instance.revoke! 'reference_id'
480
- end.should request_to nvp_endpoint, :post
480
+ end.to request_to nvp_endpoint, :post
481
481
  instance._method_.should == :BillAgreementUpdate
482
482
  instance._sent_params_.should == {
483
483
  :REFERENCEID => 'reference_id',
@@ -496,7 +496,7 @@ describe Paypal::Express::Request do
496
496
  it 'should call RefundTransaction' do
497
497
  expect do
498
498
  instance.refund! 'transaction_id'
499
- end.should request_to nvp_endpoint, :post
499
+ end.to request_to nvp_endpoint, :post
500
500
  instance._method_.should == :RefundTransaction
501
501
  instance._sent_params_.should == {
502
502
  :TRANSACTIONID => 'transaction_id',
@@ -12,7 +12,7 @@ describe Paypal::IPN do
12
12
  before { fake_response 'IPN/invalid', :IPN }
13
13
  subject {}
14
14
  it do
15
- expect { Paypal::IPN.verify!('raw-post-body') }.should raise_error(Paypal::Exception::APIError)
15
+ expect { Paypal::IPN.verify!('raw-post-body') }.to raise_error(Paypal::Exception::APIError)
16
16
  end
17
17
  end
18
18
  end
@@ -22,7 +22,7 @@ describe Paypal::NVP::Request do
22
22
  end
23
23
  expect do
24
24
  Paypal::NVP::Request.new insufficient_attributes
25
- end.should raise_error AttrRequired::AttrMissing
25
+ end.to raise_error AttrRequired::AttrMissing
26
26
  end
27
27
  end
28
28
  end
@@ -31,7 +31,7 @@ describe Paypal::NVP::Request do
31
31
  it 'should succeed' do
32
32
  expect do
33
33
  Paypal::NVP::Request.new attributes
34
- end.should_not raise_error AttrRequired::AttrMissing
34
+ end.not_to raise_error AttrRequired::AttrMissing
35
35
  end
36
36
 
37
37
  it 'should setup endpoint and version' do
@@ -47,13 +47,42 @@ describe Paypal::NVP::Request do
47
47
  end
48
48
  end
49
49
  end
50
+
51
+ context 'when optional parameters are given' do
52
+ let(:optional_attributes) do
53
+ { :subject => 'user@example.com' }
54
+ end
55
+
56
+ it 'should setup subject' do
57
+ client = Paypal::NVP::Request.new attributes.merge(optional_attributes)
58
+ client.subject.should == 'user@example.com'
59
+ end
60
+ end
61
+ end
62
+
63
+ describe '#common_params' do
64
+ {
65
+ :username => :USER,
66
+ :password => :PWD,
67
+ :signature => :SIGNATURE,
68
+ :subject => :SUBJECT,
69
+ :version => :VERSION
70
+ }.each do |option_key, param_key|
71
+ it "should include :#{param_key}" do
72
+ instance.common_params.should include(param_key)
73
+ end
74
+
75
+ it "should set :#{param_key} as #{option_key}" do
76
+ instance.common_params[param_key].should == instance.send(option_key)
77
+ end
78
+ end
50
79
  end
51
80
 
52
81
  describe '#request' do
53
82
  it 'should POST to NPV endpoint' do
54
83
  expect do
55
84
  instance.request :RPCMethod
56
- end.should request_to Paypal::NVP::Request::ENDPOINT[:production], :post
85
+ end.to request_to Paypal::NVP::Request::ENDPOINT[:production], :post
57
86
  end
58
87
 
59
88
  context 'when got API error response' do
@@ -64,7 +93,7 @@ describe Paypal::NVP::Request do
64
93
  it 'should raise Paypal::Exception::APIError' do
65
94
  expect do
66
95
  instance.request :SetExpressCheckout
67
- end.should raise_error(Paypal::Exception::APIError)
96
+ end.to raise_error(Paypal::Exception::APIError)
68
97
  end
69
98
  end
70
99
 
@@ -81,7 +110,7 @@ describe Paypal::NVP::Request do
81
110
  it 'should raise Paypal::Exception::APIError' do
82
111
  expect do
83
112
  instance.request :SetExpressCheckout
84
- end.should raise_error(Paypal::Exception::HttpError)
113
+ end.to raise_error(Paypal::Exception::HttpError)
85
114
  end
86
115
  end
87
116
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paypal-express
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
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-05-16 00:00:00.000000000 Z
12
+ date: 2012-09-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70206563624920 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '2.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70206563624920
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '2.3'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: i18n
27
- requirement: &70206563635180 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70206563635180
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: restclient_with_cert
38
- requirement: &70206563633560 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70206563633560
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: attr_required
49
- requirement: &70206563632080 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 0.0.5
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *70206563632080
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.0.5
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: rake
60
- requirement: &70206563630660 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0.8'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70206563630660
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0.8'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: cover_me
71
- requirement: &70206563629260 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: 1.2.0
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *70206563629260
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 1.2.0
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: rspec
82
- requirement: &70206563644380 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,10 +117,15 @@ dependencies:
87
117
  version: '2'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *70206563644380
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '2'
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: fakeweb
93
- requirement: &70206563639720 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
131
  - - ! '>='
@@ -98,7 +133,12 @@ dependencies:
98
133
  version: 1.3.0
99
134
  type: :development
100
135
  prerelease: false
101
- version_requirements: *70206563639720
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: 1.3.0
102
142
  description: PayPal Express Checkout API Client for Instance, Recurring and Digital
103
143
  Goods Payment.
104
144
  email: nov@matake.jp
@@ -211,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
251
  version: 1.3.6
212
252
  requirements: []
213
253
  rubyforge_project:
214
- rubygems_version: 1.8.17
254
+ rubygems_version: 1.8.24
215
255
  signing_key:
216
256
  specification_version: 3
217
257
  summary: PayPal Express Checkout API Client for Instance, Recurring and Digital Goods