solisoft-paypal_nvp 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +0 -0
- data/Rakefile +14 -0
- data/init.rb +1 -0
- data/lib/paypal_nvp.rb +45 -0
- data/paypal_nvp.gemspec +31 -0
- metadata +64 -0
data/README.rdoc
ADDED
File without changes
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('paypal_nvp', '0.1.0') do |p|
|
6
|
+
p.description = "Paypal NVP API Class."
|
7
|
+
p.url = "http://github.com/solisoft/paypal_nvp"
|
8
|
+
p.author = "Olivier BONNAURE - Direct Interactive LLC"
|
9
|
+
p.email = "o.bonnaure@directinteractive.com"
|
10
|
+
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
|
+
p.development_dependencies = []
|
12
|
+
end
|
13
|
+
|
14
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'paypal_nvp'
|
data/lib/paypal_nvp.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
class PaypalNVP
|
2
|
+
def self.included(base)
|
3
|
+
base.extend ClassMethods
|
4
|
+
end
|
5
|
+
|
6
|
+
def initialize(sandbox = false)
|
7
|
+
config = YAML.load_file("#{RAILS_ROOT}/config/paypal.yml")
|
8
|
+
type = sandbox ? "sandbox" : "live"
|
9
|
+
@url = config[type]["url"]
|
10
|
+
@user = config[type]["user"]
|
11
|
+
@pass = config[type]["pass"]
|
12
|
+
@cert = config[type]["cert"]
|
13
|
+
reset
|
14
|
+
end
|
15
|
+
|
16
|
+
def call_paypal(data)
|
17
|
+
data.merge!({ "USER" => @user, "PWD" => @pass, "SIGNATURE" => @cert, "VERSION" => "50.0" })
|
18
|
+
qs = []
|
19
|
+
data.each do |key, value|
|
20
|
+
qs << "#{key.to_s.upcase}=#{url_encode(value)}"
|
21
|
+
end
|
22
|
+
qs = "?#{qs * "&"}"
|
23
|
+
|
24
|
+
uri = URI.parse(@url)
|
25
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
26
|
+
http.use_ssl = true
|
27
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
28
|
+
|
29
|
+
response = http.start {
|
30
|
+
http.request_get(uri.path) {|res|
|
31
|
+
res
|
32
|
+
}
|
33
|
+
}
|
34
|
+
data = {}
|
35
|
+
if response.kind_of? Net::HTTPSuccess
|
36
|
+
response.body.split("&").each do |element|
|
37
|
+
a = element.split("=")
|
38
|
+
data[a[0]] = a[1] if a.size == 2
|
39
|
+
end
|
40
|
+
end
|
41
|
+
data
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
data/paypal_nvp.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{paypal_nvp}
|
5
|
+
s.version = "0.1.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Olivier BONNAURE - Direct Interactive LLC"]
|
9
|
+
s.date = %q{2009-03-31}
|
10
|
+
s.description = %q{Paypal NVP API Class.}
|
11
|
+
s.email = %q{o.bonnaure@directinteractive.com}
|
12
|
+
s.extra_rdoc_files = ["lib/paypal_nvp.rb", "README.rdoc"]
|
13
|
+
s.files = ["init.rb", "lib/paypal_nvp.rb", "Manifest", "paypal_nvp.gemspec", "Rakefile", "README.rdoc"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://github.com/solisoft/paypal_nvp}
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Paypal_nvp", "--main", "README.rdoc"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{paypal_nvp}
|
19
|
+
s.rubygems_version = %q{1.3.1}
|
20
|
+
s.summary = %q{Paypal NVP API Class.}
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
+
s.specification_version = 2
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
+
else
|
28
|
+
end
|
29
|
+
else
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: solisoft-paypal_nvp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Olivier BONNAURE - Direct Interactive LLC
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-03-31 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Paypal NVP API Class.
|
17
|
+
email: o.bonnaure@directinteractive.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- lib/paypal_nvp.rb
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- init.rb
|
27
|
+
- lib/paypal_nvp.rb
|
28
|
+
- Manifest
|
29
|
+
- paypal_nvp.gemspec
|
30
|
+
- Rakefile
|
31
|
+
- README.rdoc
|
32
|
+
has_rdoc: true
|
33
|
+
homepage: http://github.com/solisoft/paypal_nvp
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options:
|
36
|
+
- --line-numbers
|
37
|
+
- --inline-source
|
38
|
+
- --title
|
39
|
+
- Paypal_nvp
|
40
|
+
- --main
|
41
|
+
- README.rdoc
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: "0"
|
49
|
+
version:
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "1.2"
|
55
|
+
version:
|
56
|
+
requirements: []
|
57
|
+
|
58
|
+
rubyforge_project: paypal_nvp
|
59
|
+
rubygems_version: 1.2.0
|
60
|
+
signing_key:
|
61
|
+
specification_version: 2
|
62
|
+
summary: Paypal NVP API Class.
|
63
|
+
test_files: []
|
64
|
+
|