selligent 0.1.1
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 +7 -0
- data/.circleci/config.yml +104 -0
- data/.gitignore +10 -0
- data/.rubocop.yml +6 -0
- data/Gemfile +15 -0
- data/LICENSE +21 -0
- data/README.md +255 -0
- data/lib/selligent.rb +24 -0
- data/lib/selligent/client.rb +57 -0
- data/lib/selligent/client/content.rb +180 -0
- data/lib/selligent/client/cumulio.rb +64 -0
- data/lib/selligent/client/data.rb +145 -0
- data/lib/selligent/client/journeys.rb +15 -0
- data/lib/selligent/client/lists.rb +264 -0
- data/lib/selligent/client/organizations.rb +20 -0
- data/lib/selligent/client/single_batch.rb +250 -0
- data/lib/selligent/client/status.rb +15 -0
- data/lib/selligent/client/stored_procedures.rb +26 -0
- data/lib/selligent/client/tasks.rb +56 -0
- data/lib/selligent/client/transactional_bulk.rb +17 -0
- data/lib/selligent/client/transactionals.rb +115 -0
- data/lib/selligent/configuration.rb +23 -0
- data/lib/selligent/connection.rb +38 -0
- data/lib/selligent/middlewares/authorization.rb +27 -0
- data/lib/selligent/version.rb +5 -0
- data/selligent.gemspec +25 -0
- metadata +111 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Selligent
|
4
|
+
class Client
|
5
|
+
# Implements the journeys base endpoint
|
6
|
+
#
|
7
|
+
# /organizations/:organization/journeys
|
8
|
+
module Journeys
|
9
|
+
# Get an overview of all journeys set up in the organization
|
10
|
+
def journeys
|
11
|
+
get "#{base_url}/journeys"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,264 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Selligent
|
4
|
+
class Client
|
5
|
+
# Implements the list endpoints
|
6
|
+
#
|
7
|
+
# In this module, `list_name` is the list name as it appears in the API urls.
|
8
|
+
#
|
9
|
+
# /organizations/:organization/lists/*
|
10
|
+
module Lists
|
11
|
+
# Returns an overview of all of the lists in this organization
|
12
|
+
#
|
13
|
+
# @param options [Hash] Options for filtering, searching, etc.
|
14
|
+
# @option options [String] :filter Filter list by type
|
15
|
+
# @option options [String] :search Search a list by name, description or tags
|
16
|
+
# @option options [Integer] :skip Specify index to start picking list items from
|
17
|
+
# @option options [Integer] :take Specify count for the number of items to be taken
|
18
|
+
def lists(options = {})
|
19
|
+
get "#{base_url}/lists", options
|
20
|
+
end
|
21
|
+
|
22
|
+
# Create a new list
|
23
|
+
#
|
24
|
+
# The model has the following shape:
|
25
|
+
#
|
26
|
+
# {
|
27
|
+
# "api_name": "list_name_in_api",
|
28
|
+
# "name": "list_name",
|
29
|
+
# "type": "Userlist",
|
30
|
+
# "description": "description",
|
31
|
+
# "tags": [
|
32
|
+
# "tag1",
|
33
|
+
# "tag2"
|
34
|
+
# ]
|
35
|
+
# }
|
36
|
+
#
|
37
|
+
# @param model [Hash] The model containing the data that should be sent
|
38
|
+
def create_list(model)
|
39
|
+
post "#{base_url}/lists", model
|
40
|
+
end
|
41
|
+
|
42
|
+
# Delete a list
|
43
|
+
#
|
44
|
+
# @param list_name [String] The list API name
|
45
|
+
# @param options [Hash] Additional options
|
46
|
+
# @option options [Boolean] :dropTable delete the associated table
|
47
|
+
def delete_list(list_name, options = {})
|
48
|
+
delete "#{base_url}/lists/#{list_name}", options
|
49
|
+
end
|
50
|
+
|
51
|
+
# Get details for the list with the given name
|
52
|
+
#
|
53
|
+
# @param list_name [String] The list API name
|
54
|
+
def list(list_name)
|
55
|
+
get "#{base_url}/lists/#{list_name}"
|
56
|
+
end
|
57
|
+
|
58
|
+
# Update a list
|
59
|
+
#
|
60
|
+
# The model has the following shape:
|
61
|
+
#
|
62
|
+
# {
|
63
|
+
# "api_name": "list_name_in_api",
|
64
|
+
# "name": "list_name",
|
65
|
+
# "description": "description",
|
66
|
+
# "tags": [
|
67
|
+
# "tag1",
|
68
|
+
# "tag2"
|
69
|
+
# ],
|
70
|
+
# "email_quality_configuration": {
|
71
|
+
# "type": "Normal",
|
72
|
+
# "bounce_scope": "MASTER",
|
73
|
+
# "actions": [
|
74
|
+
# {
|
75
|
+
# "name": "OPTOUT",
|
76
|
+
# "value": "10"
|
77
|
+
# }
|
78
|
+
# ],
|
79
|
+
# "bouncestoredprocedures": [
|
80
|
+
# "ST_Bounce_Sp1",
|
81
|
+
# "ST_Bounce_Sp2"
|
82
|
+
# ]
|
83
|
+
# }
|
84
|
+
# }
|
85
|
+
#
|
86
|
+
# @param list_name [String] The list API name
|
87
|
+
# @param model [Hash] The model containing the data that should be sent
|
88
|
+
def update_list(list_name, model)
|
89
|
+
put "#{base_url}/lists/#{list_name}", model
|
90
|
+
end
|
91
|
+
|
92
|
+
# Get list fields for the given list
|
93
|
+
#
|
94
|
+
# @param list_name [String] The list API name
|
95
|
+
def fields(list_name)
|
96
|
+
get "#{base_url}/lists/#{list_name}/fields"
|
97
|
+
end
|
98
|
+
|
99
|
+
# Create list fields
|
100
|
+
#
|
101
|
+
# The model has the following shape:
|
102
|
+
#
|
103
|
+
# {
|
104
|
+
# "fields": [
|
105
|
+
# {
|
106
|
+
# "name": "string",
|
107
|
+
# "data_type": "Boolean",
|
108
|
+
# "length": 0,
|
109
|
+
# "description": "string",
|
110
|
+
# "allow_null": true
|
111
|
+
# }
|
112
|
+
# ]
|
113
|
+
# }
|
114
|
+
#
|
115
|
+
# @param list_name [String] The list API name
|
116
|
+
# @param model [Hash] The model containing the data that should be sent
|
117
|
+
def create_fields(list_name, model)
|
118
|
+
post "#{base_url}/lists/#{list_name}/fields", model
|
119
|
+
end
|
120
|
+
|
121
|
+
# Delete a list field
|
122
|
+
#
|
123
|
+
# @param list_name [String] The list API name
|
124
|
+
# @param field_name [String] The field name
|
125
|
+
def delete_field(list_name, field_name)
|
126
|
+
delete "#{base_url}/lists/#{list_name}/fields/#{field_name}"
|
127
|
+
end
|
128
|
+
|
129
|
+
# Update a list field
|
130
|
+
#
|
131
|
+
# The model has the following shape:
|
132
|
+
#
|
133
|
+
# {
|
134
|
+
# "field_name": "FIELD",
|
135
|
+
# "field_description": "This is FIELD."
|
136
|
+
# }
|
137
|
+
#
|
138
|
+
# @param list_name [String] The list API name
|
139
|
+
# @param field_name [String] The field name
|
140
|
+
# @param model [Hash] The model containing the data that should be sent
|
141
|
+
def update_field(list_name, field_name, model)
|
142
|
+
put "#{base_url}/lists/#{list_name}/fields/#{field_name}", model
|
143
|
+
end
|
144
|
+
|
145
|
+
# Get the number of records for the given list
|
146
|
+
#
|
147
|
+
# @param list_name [String] The list API name
|
148
|
+
def records_count(list_name)
|
149
|
+
get "#{base_url}/lists/#{list_name}/records"
|
150
|
+
end
|
151
|
+
|
152
|
+
# Delete a single record by id
|
153
|
+
#
|
154
|
+
# @param list_name [String] The list API name
|
155
|
+
# @param record_id [Integer] The record id
|
156
|
+
def delete_record(list_name, record_id)
|
157
|
+
delete "#{base_url}/lists/#{list_name}/records/#{record_id}"
|
158
|
+
end
|
159
|
+
|
160
|
+
# Get all relations associated with a list
|
161
|
+
#
|
162
|
+
# @param list_name [String] The list API name
|
163
|
+
def relations(list_name)
|
164
|
+
get "#{base_url}/lists/#{list_name}/relations"
|
165
|
+
end
|
166
|
+
|
167
|
+
# Create a relation between two lists
|
168
|
+
#
|
169
|
+
# The model has the following shape:
|
170
|
+
#
|
171
|
+
# {
|
172
|
+
# "relations": [
|
173
|
+
# {
|
174
|
+
# "scope": "string",
|
175
|
+
# "type": "OneToOne",
|
176
|
+
# "masterlist_field_name": "string",
|
177
|
+
# "slavelist_api_name": "string",
|
178
|
+
# "slavelist_field_name": "string",
|
179
|
+
# "constraints": [
|
180
|
+
# {
|
181
|
+
# "list1": "string",
|
182
|
+
# "field1": "string",
|
183
|
+
# "operator": "Unknown",
|
184
|
+
# "list2": "string",
|
185
|
+
# "field2": "string",
|
186
|
+
# "value": "string"
|
187
|
+
# }
|
188
|
+
# ]
|
189
|
+
# }
|
190
|
+
# ]
|
191
|
+
# }
|
192
|
+
#
|
193
|
+
# @param list_name [String] The list API name
|
194
|
+
# @param model [Hash] The model containing the data that should be sent
|
195
|
+
def create_relation(list_name, model)
|
196
|
+
post "#{base_url}/lists/#{list_name}/relations", model
|
197
|
+
end
|
198
|
+
|
199
|
+
# Delete a relation between two lists
|
200
|
+
#
|
201
|
+
# @param list_name [String] The list API name
|
202
|
+
# @param scope [String] The scope name of the relation
|
203
|
+
def delete_relation(list_name, scope)
|
204
|
+
delete "#{base_url}/lists/#{list_name}/relations/#{scope}"
|
205
|
+
end
|
206
|
+
|
207
|
+
# Get relation details based based on the list name and the relation scope name
|
208
|
+
#
|
209
|
+
# @param list_name [String] The list API name
|
210
|
+
# @param scope [String] The scope name of the relation
|
211
|
+
def relation(list_name, scope)
|
212
|
+
get "#{base_url}/lists/#{list_name}/relations/#{scope}"
|
213
|
+
end
|
214
|
+
|
215
|
+
# Update an existing relation
|
216
|
+
#
|
217
|
+
# The model has the following shape:
|
218
|
+
#
|
219
|
+
# {
|
220
|
+
# "scope_name": "RELATION",
|
221
|
+
# "relation_type": "OneToMany",
|
222
|
+
# "master_list_field_name": "MASTERLISTFIELD",
|
223
|
+
# "slave_list_api_name": "SLAVELIST",
|
224
|
+
# "slave_list_field_name": "SLAVELISTFIELD",
|
225
|
+
# "constraints": [
|
226
|
+
# {
|
227
|
+
# "source_list": "MASTER",
|
228
|
+
# "source_field": "master_field",
|
229
|
+
# "operator": "EqualTo",
|
230
|
+
# "destination_list": "SLAVE",
|
231
|
+
# "destination_field": "slave_field",
|
232
|
+
# "field_value": ""
|
233
|
+
# }
|
234
|
+
# ]
|
235
|
+
# }
|
236
|
+
#
|
237
|
+
# @param list_name [String] The list API name
|
238
|
+
# @param scope [String] The scope name of the relation
|
239
|
+
# @param model [Hash] The model containing the data that should be sent
|
240
|
+
def update_relation(list_name, scope, model)
|
241
|
+
put "#{base_url}/lists/#{list_name}/relations/#{scope}", model
|
242
|
+
end
|
243
|
+
|
244
|
+
# Get an overview of the segments defined on the given list
|
245
|
+
#
|
246
|
+
# @param list_name [String] The list API name
|
247
|
+
# @option options [String] :filter Filter segment by type
|
248
|
+
# @option options [String] :search Search a segment by name, description or tags
|
249
|
+
# @option options [Integer] :skip Specify index to start picking segment items from
|
250
|
+
# @option options [Integer] :take Specify count for the number of segments to be taken
|
251
|
+
def segments(list_name, options = {})
|
252
|
+
get "#{base_url}/lists/#{list_name}/segments", options
|
253
|
+
end
|
254
|
+
|
255
|
+
# Get segment details based on list API name and segment API name
|
256
|
+
#
|
257
|
+
# @param list_name [String] The list API name
|
258
|
+
# @param segment_name [String] The name of the segment
|
259
|
+
def segment(list_name, segment_name)
|
260
|
+
get "#{base_url}/lists/#{list_name}/segments/#{segment_name}"
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Selligent
|
4
|
+
class Client
|
5
|
+
# Implements the organizations endpoints
|
6
|
+
#
|
7
|
+
# /organizations/*
|
8
|
+
module Organizations
|
9
|
+
# Get an overview of all the organizations
|
10
|
+
def organizations
|
11
|
+
get "#{root_url}/organizations"
|
12
|
+
end
|
13
|
+
|
14
|
+
# Get details of the current organization
|
15
|
+
def organization
|
16
|
+
get base_url
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,250 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Selligent
|
4
|
+
class Client
|
5
|
+
# Implenents the Single Batch endpoints
|
6
|
+
#
|
7
|
+
# /organizations/:organization/journeys/singlebatch/*
|
8
|
+
module SingleBatch
|
9
|
+
# Get all journeys of type Single Batch
|
10
|
+
def single_batches
|
11
|
+
get "#{base_url}/journeys/singlebatch"
|
12
|
+
end
|
13
|
+
|
14
|
+
# Create a Single Batch journey
|
15
|
+
#
|
16
|
+
# The model has the following shape:
|
17
|
+
#
|
18
|
+
# {
|
19
|
+
# "message": {
|
20
|
+
# "api_name": "api_name"
|
21
|
+
# },
|
22
|
+
# "journey": {
|
23
|
+
# "name": "journey_name",
|
24
|
+
# "launch_state": "Schedule",
|
25
|
+
# "scheduling": {
|
26
|
+
# "launch_date": "2018-10-26T08:11:32.7469864Z"
|
27
|
+
# },
|
28
|
+
# "campaign_analytics_tag": "cpg_tag",
|
29
|
+
# "message_analytics_tag": "msg_tag",
|
30
|
+
# "api_name": "test_new_api_layout"
|
31
|
+
# }
|
32
|
+
# }
|
33
|
+
#
|
34
|
+
# @param model [Hash] The model
|
35
|
+
def create_single_batch(model)
|
36
|
+
post "#{base_url}/journeys/singlebatch", model
|
37
|
+
end
|
38
|
+
|
39
|
+
# Get information on a Single Batch journey
|
40
|
+
#
|
41
|
+
# @param name [String] The single batch name
|
42
|
+
def single_batch(name)
|
43
|
+
get "#{base_url}/journeys/singlebatch/#{name}"
|
44
|
+
end
|
45
|
+
|
46
|
+
# Cancel launching of a single batch
|
47
|
+
#
|
48
|
+
# @param name [String] The single batch name
|
49
|
+
def cancel_single_batch(name)
|
50
|
+
post "#{base_url}/journeys/singlebatch/#{name}/cancel"
|
51
|
+
end
|
52
|
+
|
53
|
+
# Launch a single batch
|
54
|
+
#
|
55
|
+
# The launch request has the following shape:
|
56
|
+
#
|
57
|
+
# {
|
58
|
+
# "launch_state": "schedule",
|
59
|
+
# "scheduling": {
|
60
|
+
# "launch_date": "2018-10-26T08:11:32.7938595Z"
|
61
|
+
# }
|
62
|
+
# }
|
63
|
+
#
|
64
|
+
# @param name [String] The single batch name
|
65
|
+
# @param request [Hash] The launch request
|
66
|
+
def launch_single_batch(name, request)
|
67
|
+
post "#{base_url}/journeys/singlebatch/#{name}/launch", request
|
68
|
+
end
|
69
|
+
|
70
|
+
# Trigger execution of a single batch journey
|
71
|
+
#
|
72
|
+
# The model has the following shape:
|
73
|
+
#
|
74
|
+
# {
|
75
|
+
# "journey": {
|
76
|
+
# "launch_state": "Schedule",
|
77
|
+
# "scheduling": {
|
78
|
+
# "launch_date": "2018-10-26T08:11:32.7626108Z"
|
79
|
+
# }
|
80
|
+
# }
|
81
|
+
# }
|
82
|
+
#
|
83
|
+
# @param name [String] The single batch name
|
84
|
+
# @param model [Hash] The model
|
85
|
+
def trigger_single_batch(name, model)
|
86
|
+
post "#{base_url}/journeys/singlebatch/#{name}/trigger", model
|
87
|
+
end
|
88
|
+
|
89
|
+
# Send single batch with email message
|
90
|
+
#
|
91
|
+
# The model has the following shape:
|
92
|
+
#
|
93
|
+
# {
|
94
|
+
# "message_model": {
|
95
|
+
# "properties": {
|
96
|
+
# "name": "Message name",
|
97
|
+
# "description": "description",
|
98
|
+
# "api_name": "message_name",
|
99
|
+
# "tags": [
|
100
|
+
# "tag1",
|
101
|
+
# "tag2"
|
102
|
+
# ],
|
103
|
+
# "languages": [
|
104
|
+
# "en"
|
105
|
+
# ],
|
106
|
+
# "default_language": "en",
|
107
|
+
# "empty_language": "en",
|
108
|
+
# "audience_api_name": "my_audience"
|
109
|
+
# },
|
110
|
+
# "headers": {
|
111
|
+
# "en": [
|
112
|
+
# {
|
113
|
+
# "from_domain": "example.net",
|
114
|
+
# "from_alias": "info",
|
115
|
+
# "reply_email": "reply@example.net",
|
116
|
+
# "reply_alias": "Your reply alias",
|
117
|
+
# "to_alias": "John Doe",
|
118
|
+
# "preheader": "Put your preheader text here",
|
119
|
+
# "subject": "Put your subject here"
|
120
|
+
# }
|
121
|
+
# ]
|
122
|
+
# },
|
123
|
+
# "content": {
|
124
|
+
# "text": "Hello World!",
|
125
|
+
# "html": "<html><body><h1>Hello World!</h1></body></html>"
|
126
|
+
# }
|
127
|
+
# },
|
128
|
+
# "journey_model": {
|
129
|
+
# "name": "journey_name",
|
130
|
+
# "launch_state": "Schedule",
|
131
|
+
# "scheduling": {
|
132
|
+
# "launch_date": "2018-10-26T08:11:32.8094853Z"
|
133
|
+
# },
|
134
|
+
# "campaign_analytics_tag": "cpg_tag",
|
135
|
+
# "message_analytics_tag": "msg_tag",
|
136
|
+
# "api_name": "test_new_api_layout"
|
137
|
+
# }
|
138
|
+
# }
|
139
|
+
#
|
140
|
+
# @param model [Hash] The request model
|
141
|
+
def send_single_batch_email(model)
|
142
|
+
post "#{base_url}/journeys/singlebatch/message", model
|
143
|
+
end
|
144
|
+
|
145
|
+
# Send single batch mobile push message
|
146
|
+
#
|
147
|
+
# The model has the following shape:
|
148
|
+
#
|
149
|
+
# {
|
150
|
+
# "journey_model": {
|
151
|
+
# "name": "journey_name",
|
152
|
+
# "launch_state": "Schedule",
|
153
|
+
# "scheduling": {
|
154
|
+
# "launch_date": "2018-10-26T08:11:32.8407333Z"
|
155
|
+
# },
|
156
|
+
# "campaign_analytics_tag": "cpg_tag",
|
157
|
+
# "message_analytics_tag": "msg_tag",
|
158
|
+
# "api_name": "test_new_api_layout"
|
159
|
+
# },
|
160
|
+
# "mobile_message_model": {
|
161
|
+
# "properties": {
|
162
|
+
# "name": "Message name",
|
163
|
+
# "description": "description",
|
164
|
+
# "api_name": "message_name",
|
165
|
+
# "tags": [
|
166
|
+
# "tag1",
|
167
|
+
# "tag2"
|
168
|
+
# ],
|
169
|
+
# "languages": [
|
170
|
+
# "en"
|
171
|
+
# ],
|
172
|
+
# "default_language": "en",
|
173
|
+
# "empty_language": "en",
|
174
|
+
# "audience_api_name": "my_audience"
|
175
|
+
# },
|
176
|
+
# "mobile_properties": {
|
177
|
+
# "distribution_type": "MobilePush",
|
178
|
+
# "custom_in_app_content": true,
|
179
|
+
# "in_app_content_type": "Text",
|
180
|
+
# "expiration_date": "2018-10-26T10:11:32.8407333+02:00"
|
181
|
+
# },
|
182
|
+
# "content": {
|
183
|
+
# "en": {
|
184
|
+
# "mobile_push": {
|
185
|
+
# "title": "MP Title en",
|
186
|
+
# "content": "MP Content en"
|
187
|
+
# },
|
188
|
+
# "in_app": {
|
189
|
+
# "title": "IA Title en",
|
190
|
+
# "content": {
|
191
|
+
# "text": "IA Content en",
|
192
|
+
# "url": "http://example.com"
|
193
|
+
# }
|
194
|
+
# }
|
195
|
+
# }
|
196
|
+
# }
|
197
|
+
# }
|
198
|
+
# }
|
199
|
+
#
|
200
|
+
# @param model [Hash] The request model
|
201
|
+
def send_single_batch_push(model)
|
202
|
+
post "#{base_url}/journeys/singlebatch/mobile", model
|
203
|
+
end
|
204
|
+
|
205
|
+
# Send single batch sms
|
206
|
+
#
|
207
|
+
# The model has the following shape:
|
208
|
+
#
|
209
|
+
# {
|
210
|
+
# "sms_model": {
|
211
|
+
# "properties": {
|
212
|
+
# "name": "Message name",
|
213
|
+
# "description": "description",
|
214
|
+
# "api_name": "message_name",
|
215
|
+
# "tags": [
|
216
|
+
# "tag1",
|
217
|
+
# "tag2"
|
218
|
+
# ],
|
219
|
+
# "languages": [
|
220
|
+
# "en"
|
221
|
+
# ],
|
222
|
+
# "default_language": "en",
|
223
|
+
# "empty_language": "en",
|
224
|
+
# "audience_api_name": "my_audience"
|
225
|
+
# },
|
226
|
+
# "content": {
|
227
|
+
# "en": {
|
228
|
+
# "text": "Text"
|
229
|
+
# }
|
230
|
+
# }
|
231
|
+
# },
|
232
|
+
# "journey_model": {
|
233
|
+
# "name": "journey_name",
|
234
|
+
# "launch_state": "Schedule",
|
235
|
+
# "scheduling": {
|
236
|
+
# "launch_date": "2018-10-26T08:11:32.8719844Z"
|
237
|
+
# },
|
238
|
+
# "campaign_analytics_tag": "cpg_tag",
|
239
|
+
# "message_analytics_tag": "msg_tag",
|
240
|
+
# "api_name": "test_new_api_layout"
|
241
|
+
# }
|
242
|
+
# }
|
243
|
+
#
|
244
|
+
# @param model [Hash] The request model
|
245
|
+
def send_single_batch_sms(model)
|
246
|
+
post "#{base_url}/journeys/singlebatch/sms", model
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|