emarsys-api 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -5
- data/Rakefile +1 -1
- data/emarsys-api.gemspec +1 -1
- data/lib/emarsys/api/base.rb +0 -7
- data/lib/emarsys/api/internal.rb +10 -2
- data/lib/emarsys/api/services.rb +0 -2
- data/lib/emarsys/api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7a3c6324b51118157f1675c5f970be0d94d923f
|
4
|
+
data.tar.gz: 21526b3a0d8399a87aada11e6a712ba5effc4489
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec92c0d7dd66f3413db35c90eb07f21906209d3666ae346bbb4d4f2e3204035edc583ff51109cbeb56a380df8da27bdbb7d7e1d77b151af275a43a7b387dcd60
|
7
|
+
data.tar.gz: 296f12b7cf94151cfcc6636d9b901b6a19cf945f1685c7e98b12f4cda4e375cd6e4ee1b4e37cee9c5954888dc650658daa114b271694531c213ce86202f337c0
|
data/.rubocop.yml
CHANGED
@@ -12,22 +12,22 @@ Metrics/ParameterLists:
|
|
12
12
|
Max: 3
|
13
13
|
CountKeywordArgs: false
|
14
14
|
|
15
|
-
|
15
|
+
Layout/IndentHash:
|
16
16
|
EnforcedStyle: consistent
|
17
17
|
|
18
|
-
|
18
|
+
Layout/IndentArray:
|
19
19
|
EnforcedStyle: consistent
|
20
20
|
|
21
21
|
Style/FrozenStringLiteralComment:
|
22
22
|
Enabled: false
|
23
23
|
|
24
|
-
|
24
|
+
Layout/EmptyLines:
|
25
25
|
Enabled: false
|
26
26
|
|
27
|
-
|
27
|
+
Layout/EmptyLinesAroundClassBody:
|
28
28
|
Enabled: false
|
29
29
|
|
30
|
-
|
30
|
+
Layout/MultilineOperationIndentation:
|
31
31
|
EnforcedStyle: indented
|
32
32
|
|
33
33
|
Style/Documentation:
|
data/Rakefile
CHANGED
data/emarsys-api.gemspec
CHANGED
data/lib/emarsys/api/base.rb
CHANGED
@@ -24,22 +24,18 @@ module Emarsys
|
|
24
24
|
URI.join(Emarsys::Api.base_url, module_path)
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
27
|
def module_path
|
29
28
|
''
|
30
29
|
end
|
31
30
|
|
32
|
-
|
33
31
|
def base_url
|
34
32
|
uri.to_s
|
35
33
|
end
|
36
34
|
|
37
|
-
|
38
35
|
def hostname
|
39
36
|
uri.hostname
|
40
37
|
end
|
41
38
|
|
42
|
-
|
43
39
|
def escher_config
|
44
40
|
{
|
45
41
|
credential_scope: 'eu/suite/ems_request',
|
@@ -49,13 +45,11 @@ module Emarsys
|
|
49
45
|
}
|
50
46
|
end
|
51
47
|
|
52
|
-
|
53
48
|
def validate_response!(response)
|
54
49
|
error_class = error_class_by_status response.status
|
55
50
|
raise error_class.new(*parse_for_error(response)) if error_class
|
56
51
|
end
|
57
52
|
|
58
|
-
|
59
53
|
def error_class_by_status(status)
|
60
54
|
case status
|
61
55
|
when 200 then nil
|
@@ -67,7 +61,6 @@ module Emarsys
|
|
67
61
|
end
|
68
62
|
end
|
69
63
|
|
70
|
-
|
71
64
|
def parse_for_error(response)
|
72
65
|
[response.body, response.status, nil]
|
73
66
|
end
|
data/lib/emarsys/api/internal.rb
CHANGED
@@ -8,11 +8,20 @@ module Emarsys
|
|
8
8
|
@customer_id = customer_id
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
11
|
def campaign_get(campaign_id)
|
13
12
|
client.get("email/#{campaign_id}").tap { |response| validate_response! response }.body['data']
|
14
13
|
end
|
15
14
|
|
15
|
+
def fields_get
|
16
|
+
client.get('field/translate/en').tap { |response| validate_response!(response) }.body['data']
|
17
|
+
end
|
18
|
+
|
19
|
+
def voucher_field_create(name)
|
20
|
+
params = { name: name, application_type: 'voucher' }
|
21
|
+
headers = { 'Content-Type' => 'application/json' }
|
22
|
+
client.post('field', params.to_json, headers).tap { |response| validate_response!(response) }.body['data']
|
23
|
+
end
|
24
|
+
|
16
25
|
|
17
26
|
private
|
18
27
|
|
@@ -20,7 +29,6 @@ module Emarsys
|
|
20
29
|
"/api/v2/internal/#{customer_id}"
|
21
30
|
end
|
22
31
|
|
23
|
-
|
24
32
|
def parse_for_error(response)
|
25
33
|
if response.body.is_a? Hash
|
26
34
|
[response.body['replyText'], response.status, response.body['replyCode']]
|
data/lib/emarsys/api/services.rb
CHANGED
@@ -11,7 +11,6 @@ module Emarsys
|
|
11
11
|
response.body['contact_ids']
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
14
|
def email_queue(customer_id, params)
|
16
15
|
response = client.post "customers/#{customer_id}/email_queue/", JSON.generate(params)
|
17
16
|
validate_response! response
|
@@ -26,7 +25,6 @@ module Emarsys
|
|
26
25
|
'/api/services'
|
27
26
|
end
|
28
27
|
|
29
|
-
|
30
28
|
def parse_for_error(response)
|
31
29
|
errors = response.body['errors']
|
32
30
|
if response.body.is_a?(Hash) && errors.is_a?(Array) && errors.first.is_a?(Hash)
|
data/lib/emarsys/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emarsys-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Istvan Demeter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: escher-keypool
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
183
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.6.
|
184
|
+
rubygems_version: 2.6.11
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: Ruby client to make it easier to use the API of emarsys B2C MC
|