payoneer 0.1.6 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -3
- data/lib/payoneer/request.rb +22 -13
- metadata +1 -1
data/Gemfile.lock
CHANGED
@@ -18,10 +18,10 @@ GEM
|
|
18
18
|
json (~> 1.8)
|
19
19
|
multi_xml (>= 0.5.2)
|
20
20
|
json (1.8.1)
|
21
|
-
mini_portile (0.
|
21
|
+
mini_portile (0.6.0)
|
22
22
|
multi_xml (0.5.5)
|
23
|
-
nokogiri (1.6.1)
|
24
|
-
mini_portile (
|
23
|
+
nokogiri (1.6.3.1)
|
24
|
+
mini_portile (= 0.6.0)
|
25
25
|
parallel (1.0.0)
|
26
26
|
rake (10.3.1)
|
27
27
|
rspec (3.0.0.beta2)
|
data/lib/payoneer/request.rb
CHANGED
@@ -2,26 +2,35 @@ require 'payoneer/configuration'
|
|
2
2
|
require 'httparty'
|
3
3
|
|
4
4
|
module Payoneer
|
5
|
-
API_PATH = "/payouts/HttpApi/Api.aspx"
|
6
|
-
|
7
5
|
class Request
|
8
|
-
|
9
|
-
HTTParty.pkcs12(Payoneer::Configuration.client_cert, Payoneer::Configuration.client_cert_passwd) if Payoneer::Configuration.client_cert
|
6
|
+
include HTTParty
|
10
7
|
|
11
|
-
|
8
|
+
def execute(method_name, response_klass, params = {})
|
9
|
+
configure_security
|
10
|
+
response = self.class.get(api_url, :query => {:mname => method_name}.merge(params))
|
12
11
|
response_klass.new(response.body)
|
13
12
|
end
|
14
13
|
|
15
|
-
|
16
|
-
|
14
|
+
private
|
15
|
+
def api_url
|
16
|
+
protocol = "https://"
|
17
|
+
path = "/payouts/HttpApi/Api.aspx"
|
18
|
+
|
19
|
+
[protocol, host, path].join
|
17
20
|
end
|
18
21
|
|
19
|
-
def
|
20
|
-
if
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
def host
|
23
|
+
return "api.payoneer.com" if config.environment.eql?(:production)
|
24
|
+
|
25
|
+
config.client_cert ? "apicert.sandbox.payoneer.com" : "api.sandbox.payoneer.com"
|
26
|
+
end
|
27
|
+
|
28
|
+
def configure_security
|
29
|
+
self.class.pkcs12(File.read(config.client_cert), config.client_cert_passwd) if config.client_cert
|
30
|
+
end
|
31
|
+
|
32
|
+
def config
|
33
|
+
Payoneer::Configuration
|
25
34
|
end
|
26
35
|
end
|
27
36
|
end
|