payoneer 0.1.6 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Gemfile.lock +3 -3
  2. data/lib/payoneer/request.rb +22 -13
  3. metadata +1 -1
@@ -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.5.3)
21
+ mini_portile (0.6.0)
22
22
  multi_xml (0.5.5)
23
- nokogiri (1.6.1)
24
- mini_portile (~> 0.5.0)
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)
@@ -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
- def execute(method_name, response_klass, params = {})
9
- HTTParty.pkcs12(Payoneer::Configuration.client_cert, Payoneer::Configuration.client_cert_passwd) if Payoneer::Configuration.client_cert
6
+ include HTTParty
10
7
 
11
- response = HTTParty.get(full_url, :query => { :mname => method_name }.merge(params))
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
- def full_url
16
- api_url + API_PATH
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 api_url
20
- if Payoneer::Configuration.environment == :production
21
- "https://api.payoneer.com"
22
- else
23
- "https://api.sandbox.payoneer.com"
24
- end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payoneer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: