paypal_nvp 0.2.8 → 0.2.9
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.
- checksums.yaml +4 -4
- data/README.rdoc +16 -3
- data/Rakefile +1 -1
- data/lib/paypal_nvp.rb +17 -2
- data/paypal_nvp.gemspec +4 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17a96b1afc9add51e85abc215c9e76debf45297b
|
4
|
+
data.tar.gz: 7efb4f20e95bdc3e10cd6ab6f7669d840265a663
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adf896734735e12ed48a8cd16d4aa19dbef2869f9cc9890fefc1e1608370ba132072c0f7388fd3a25491d67f3f54684920af3671e53f8571cf8ee2c4047f5361
|
7
|
+
data.tar.gz: 4b1294de0098f0371e9a79879f0ae90271feeca3aaf05180fd1ee99af9cd40e40b6fab39e911c8a9fe19c624f946ea4598cdfe8084741ca8b797993f1364b8f5
|
data/README.rdoc
CHANGED
@@ -18,18 +18,31 @@ Or you can specify parameter within the constructor
|
|
18
18
|
user: "o.bonn_1237393081_biz_api1.solisoft.net"
|
19
19
|
pass: "1237393093"
|
20
20
|
cert: "AU2Yv5COwWPCfeYLv34Z766F-gfNAzX6LaQE6VZkHMRq35Gmite-bMXu"
|
21
|
+
open_timeout: 3
|
22
|
+
read_timeout: 60
|
21
23
|
|
22
24
|
live:
|
23
25
|
url: "https://api-3t.paypal.com/nvp"
|
24
26
|
user: "o.bonn_1237393081_biz_api1.solisoft.net"
|
25
27
|
pass: "1237393093"
|
26
28
|
cert: "AU2Yv5COwWPCfeYLv34Z766F-gfNAzX6LaQE6VZkHMRq35Gmite-bMXu"
|
27
|
-
|
29
|
+
open_timeout: 3
|
30
|
+
read_timeout: 60
|
31
|
+
|
28
32
|
== Example usage
|
29
33
|
|
30
34
|
p = PaypalNVP.new(true) # true mean "use sandbox"
|
35
|
+
|
31
36
|
# Or you can specify paramaters directly
|
32
|
-
|
37
|
+
p = PaypalNVP.new(true, {
|
38
|
+
:user => "o.bonn_1237393081_biz_api1.solisoft.net",
|
39
|
+
:pass => "1237393093",
|
40
|
+
:cert => "AU2Yv5COwWPCfeYLv34Z766F-gfNAzX6LaQE6VZkHMRq35Gmite-bMXu",
|
41
|
+
:url => "https://api-3t.sandbox.paypal.com/nvp",
|
42
|
+
:open_timeout => 3,
|
43
|
+
:read_timeout => 60,
|
44
|
+
})
|
45
|
+
|
33
46
|
data = {
|
34
47
|
:version => "50.0", # Default is 50.0 as well... but now you can specify it
|
35
48
|
:method => "MyPaypalMethod",
|
@@ -41,4 +54,4 @@ Or you can specify parameter within the constructor
|
|
41
54
|
|
42
55
|
== PAYPAL API Documentation
|
43
56
|
|
44
|
-
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_reference
|
57
|
+
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_api_reference
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('paypal_nvp', '0.2.
|
5
|
+
Echoe.new('paypal_nvp', '0.2.9') do |p|
|
6
6
|
p.description = "Paypal NVP API Class."
|
7
7
|
p.url = "http://github.com/solisoft/paypal_nvp"
|
8
8
|
p.author = "Olivier BONNAURE - Direct Interactive LLC"
|
data/lib/paypal_nvp.rb
CHANGED
@@ -7,6 +7,9 @@ class PaypalNVP
|
|
7
7
|
base.extend ClassMethods
|
8
8
|
end
|
9
9
|
|
10
|
+
DEFAULT_OPEN_TIMEOUT = nil
|
11
|
+
DEFAULT_READ_TIMEOUT = 60
|
12
|
+
|
10
13
|
def initialize(sandbox = false, extras = {})
|
11
14
|
type = sandbox ? "sandbox" : "live"
|
12
15
|
config = YAML.load_file("#{Rails.root}/config/paypal.yml") rescue nil
|
@@ -17,18 +20,27 @@ class PaypalNVP
|
|
17
20
|
extras[:version] ||= "50.0"
|
18
21
|
|
19
22
|
if config
|
20
|
-
@url = config[type]["url"]
|
23
|
+
@url = config[type]["url"]
|
21
24
|
@user = config[type]["user"]
|
22
25
|
@pass = config[type]["pass"]
|
23
26
|
@cert = config[type]["cert"]
|
24
27
|
@rootCA = config[type]["rootca"]
|
28
|
+
@open_timeout = config[type]["open_timeout"]
|
29
|
+
@read_timeout = config[type]["read_timeout"]
|
25
30
|
else
|
26
31
|
@url = extras[:url]
|
27
32
|
@user = extras[:user]
|
28
33
|
@pass = extras[:pass]
|
29
34
|
@cert = extras[:cert]
|
30
35
|
@rootCA = extras[:rootca]
|
36
|
+
@open_timeout = extras.delete(:open_timeout)
|
37
|
+
@read_timeout = extras.delete(:read_timeout)
|
31
38
|
end
|
39
|
+
|
40
|
+
# If network timeout is not set above, we simply default both of them to default values
|
41
|
+
@open_timeout ||= DEFAULT_OPEN_TIMEOUT
|
42
|
+
@read_timeout ||= DEFAULT_READ_TIMEOUT
|
43
|
+
|
32
44
|
@extras = extras
|
33
45
|
@rootCA = @rootCA || '/etc/ssl/certs'
|
34
46
|
end
|
@@ -49,7 +61,7 @@ class PaypalNVP
|
|
49
61
|
http.ca_path = @rootCA
|
50
62
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
51
63
|
http.verify_depth = 5
|
52
|
-
elsif File.
|
64
|
+
elsif File.exist?(@rootCA)
|
53
65
|
http.ca_file = @rootCA
|
54
66
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
55
67
|
http.verify_depth = 5
|
@@ -58,6 +70,9 @@ class PaypalNVP
|
|
58
70
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
59
71
|
end
|
60
72
|
|
73
|
+
http.open_timeout = @open_timeout
|
74
|
+
http.read_timeout = @read_timeout
|
75
|
+
|
61
76
|
response = http.start {
|
62
77
|
http.request_post(uri.path, qs) {|res|
|
63
78
|
res
|
data/paypal_nvp.gemspec
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{paypal_nvp}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.9"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Olivier BONNAURE -
|
9
|
-
s.date = %q{
|
8
|
+
s.authors = ["Olivier BONNAURE - solisoft"]
|
9
|
+
s.date = %q{2016-04-19}
|
10
10
|
s.description = %q{Paypal NVP API Class.}
|
11
|
-
s.email = %q{o.bonnaure@
|
11
|
+
s.email = %q{o.bonnaure@solisoft.net}
|
12
12
|
s.extra_rdoc_files = ["lib/paypal_nvp.rb", "README.rdoc"]
|
13
13
|
s.files = ["init.rb", "lib/paypal_nvp.rb", "Rakefile", "README.rdoc", "paypal_nvp.gemspec"]
|
14
14
|
s.homepage = %q{http://github.com/solisoft/paypal_nvp}
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypal_nvp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Olivier BONNAURE -
|
7
|
+
- Olivier BONNAURE - solisoft
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Paypal NVP API Class.
|
14
|
-
email: o.bonnaure@
|
14
|
+
email: o.bonnaure@solisoft.net
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files:
|
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
version: '1.2'
|
49
49
|
requirements: []
|
50
50
|
rubyforge_project: paypal_nvp
|
51
|
-
rubygems_version: 2.
|
51
|
+
rubygems_version: 2.4.8
|
52
52
|
signing_key:
|
53
53
|
specification_version: 3
|
54
54
|
summary: Paypal NVP API Class.
|