gateway-sdk 0.2.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gateway/client.rb +5 -3
- data/lib/gateway/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b25271297180dec30786b1777c6704c52b0a9324
|
4
|
+
data.tar.gz: 3f5e7d14b4bf32804e3f2e58ba8eebe81cb0bec3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d61df966c5585c8d6abaf197b8be0b6155544ab34b8e6b7c44e9b35e414f5df2cbb65877796f928aaac73fff2e33c6d67f6e1405504830e2cd44e670fbef9c7e
|
7
|
+
data.tar.gz: f50d5b71243e75e1f24b2dc464d07fd384d67fcd2a587826fd55b4c85855fa7661521a75e49b999fc7b45886729906194a866108a0a91cfb26cf343e2fa7e9cc
|
data/lib/gateway/client.rb
CHANGED
@@ -23,13 +23,15 @@ module Gateway
|
|
23
23
|
# Initialize
|
24
24
|
#
|
25
25
|
# @param [Gateway::Requests::CommonRequest] request
|
26
|
+
# @param [String] token access token
|
26
27
|
# @param [TrueClass|FalseClass] test test or production modes
|
27
28
|
#
|
28
|
-
def initialize(request, test = false)
|
29
|
+
def initialize(request, token, test = false)
|
29
30
|
Gateway.config = JSON.parse(YAML.load_file("#{Gateway.root}/gateway/config.yml").to_json, object_class: OpenStruct)
|
30
31
|
@request = request
|
32
|
+
@token = token
|
31
33
|
@test = test
|
32
|
-
request_name
|
34
|
+
request_name = request.class.name.split('::').last
|
33
35
|
@config_data = Gateway.config.api_methods[request_name]
|
34
36
|
raise Gateway::StandardError.new("fill data in config.yml for method: #{request_name}") unless @config_data
|
35
37
|
end
|
@@ -47,7 +49,7 @@ module Gateway
|
|
47
49
|
query_params.merge! request.attributes
|
48
50
|
response = RestClient.get(url(query_params))
|
49
51
|
when METHOD_POST
|
50
|
-
response = RestClient.post(url(query_params), request.attributes)
|
52
|
+
response = RestClient.post(url(query_params), request.attributes, Authorization: @token)
|
51
53
|
else
|
52
54
|
raise Gateway::ArgumentError.new("http method #{config_data.http_method} is not supported")
|
53
55
|
end
|
data/lib/gateway/version.rb
CHANGED