emarsys_suite_services_api_client 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/emarsys_suite_services_api_client.rb +30 -20
- 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: 721b6f9f458f2c556059287f58f5c06cbf49acff
|
4
|
+
data.tar.gz: edd8938345865ec1cbd2bfe52c4df7ef9da30c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 152f1d0ec6af1fa7ffd5fc92a86ace0d04f0b48f2047bee429a61ab1dd067d229994f8cbb0def779f84eaebeddb1821e64b936fe2cfd66d61ee1c2e2543ca190
|
7
|
+
data.tar.gz: 539f37cb584d91ee835970a1265ae014c5ec0f5a92c90e533622222fe9460993e9360b5db446f265bad66c2cc3c4a4dfd74e02dc27f8f0194ce81995b6d161e4
|
@@ -21,37 +21,37 @@ module Emarsys
|
|
21
21
|
|
22
22
|
|
23
23
|
def authenticated_healthcheck
|
24
|
-
method = 'GET'
|
25
24
|
uri = '/api/services/authenticated_healthcheck'
|
26
|
-
|
25
|
+
request = sign_request('GET', uri)
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
send_request(method, request_data, uri, false)
|
27
|
+
send_request(request, false)
|
31
28
|
end
|
32
29
|
|
33
30
|
|
34
31
|
|
35
32
|
def list_integrations(customer_id)
|
36
|
-
method = 'GET'
|
37
33
|
uri = "/api/services/customers/#{customer_id}/integrations"
|
38
|
-
|
39
|
-
|
40
|
-
escher.sign!(request_data, client)
|
34
|
+
request = sign_request('GET', uri)
|
41
35
|
|
42
|
-
send_request(
|
36
|
+
send_request(request)['integrations']
|
43
37
|
end
|
44
38
|
|
45
39
|
|
46
40
|
|
47
41
|
def get_integration(customer_id, integration_id)
|
48
|
-
method = 'GET'
|
49
42
|
uri = "/api/services/customers/#{customer_id}/integrations/#{integration_id}"
|
50
|
-
|
43
|
+
request = sign_request('GET', uri)
|
44
|
+
|
45
|
+
send_request(request)['integration']
|
46
|
+
end
|
47
|
+
|
51
48
|
|
52
|
-
escher.sign!(request_data, client)
|
53
49
|
|
54
|
-
|
50
|
+
def update_integration(customer_id, integration_id, payload)
|
51
|
+
uri = "/api/services/customers/#{customer_id}/integrations/#{integration_id}"
|
52
|
+
request = sign_request('PUT', uri, payload)
|
53
|
+
|
54
|
+
send_request(request)['integration']
|
55
55
|
end
|
56
56
|
|
57
57
|
|
@@ -64,17 +64,27 @@ module Emarsys
|
|
64
64
|
|
65
65
|
|
66
66
|
|
67
|
-
def
|
68
|
-
{ method: method, uri: uri, headers: [['host', @host]]
|
67
|
+
def sign_request(method, uri, payload = nil)
|
68
|
+
request = { method: method, uri: uri, headers: [['host', @host]]}
|
69
|
+
if payload
|
70
|
+
payload = JSON.generate(payload)
|
71
|
+
request[:body] = payload
|
72
|
+
end
|
73
|
+
|
74
|
+
escher.sign!(request, client)
|
75
|
+
|
76
|
+
request
|
69
77
|
end
|
70
78
|
|
71
79
|
|
72
80
|
|
73
|
-
def send_request(
|
81
|
+
def send_request(request, return_json = true)
|
82
|
+
puts request.inspect
|
74
83
|
response = (RestClient::Request.execute(
|
75
|
-
method: method,
|
76
|
-
url: url(uri),
|
77
|
-
headers:
|
84
|
+
method: request[:method],
|
85
|
+
url: url(request[:uri]),
|
86
|
+
headers: request[:headers],
|
87
|
+
payload: request[:body],
|
78
88
|
ssl_version: :TLSv1
|
79
89
|
))
|
80
90
|
|