selligent 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 20173662906a961d5ca1844796ca230884bef6ecfd450ebe21051568047d59ba
4
+ data.tar.gz: 4fd6002eee2db1e3c4d2a154206de818e77183c2a48cc8f4f1dfe5329c8eb12c
5
+ SHA512:
6
+ metadata.gz: 1b5559f4c000b7ef7be7cb593c4a4640caff4c3352bf4d220ab03dc1712d8fdf9fd6f0c91485da8a5fed3d121c3bfbb5e2cd1ae1cc06371fb2f3b095b769c833
7
+ data.tar.gz: 3780bc877fb2401cf8d331fba79fcd8db552528d7728123c7b0230368958eb71ff08a3ed588e9e2af104452b9eeafb4f2d6e03d5e84090303972e552185194eb
@@ -0,0 +1,104 @@
1
+ version: 2.0
2
+
3
+ jobs:
4
+ ruby2.2:
5
+ docker:
6
+ - image: circleci/ruby:2.2
7
+ steps:
8
+ - checkout
9
+ - restore_cache:
10
+ key: gemfile-2-2-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }}
11
+ - run: bundle install -j3 --path vendor/bundle
12
+ - save_cache:
13
+ key: gemfile-2-2-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }}
14
+ paths:
15
+ - vendor/bundle
16
+ - run: bundle check --path vendor/bundle
17
+ - run: bundle exec rubocop
18
+ - run: |
19
+ bundle exec rspec --profile 10 \
20
+ --format RspecJunitFormatter \
21
+ --out tmp/results/rspec.xml \
22
+ --format progress \
23
+ $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
24
+ - store_test_results:
25
+ path: tmp/results
26
+
27
+ ruby2.3:
28
+ docker:
29
+ - image: circleci/ruby:2.3
30
+ steps:
31
+ - checkout
32
+ - restore_cache:
33
+ key: gemfile-2-3-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }}
34
+ - run: bundle install -j3 --path vendor/bundle
35
+ - save_cache:
36
+ key: gemfile-2-3-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }}
37
+ paths:
38
+ - vendor/bundle
39
+ - run: bundle check --path vendor/bundle
40
+ - run: bundle exec rubocop
41
+ - run: |
42
+ bundle exec rspec --profile 10 \
43
+ --format RspecJunitFormatter \
44
+ --out tmp/results/rspec.xml \
45
+ --format progress \
46
+ $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
47
+ - store_test_results:
48
+ path: tmp/results
49
+
50
+ ruby2.4:
51
+ docker:
52
+ - image: circleci/ruby:2.4
53
+ steps:
54
+ - checkout
55
+ - restore_cache:
56
+ key: gemfile-2-4-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }}
57
+ - run: bundle install -j3 --path vendor/bundle
58
+ - save_cache:
59
+ key: gemfile-2-4-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }}
60
+ paths:
61
+ - vendor/bundle
62
+ - run: bundle check --path vendor/bundle
63
+ - run: bundle exec rubocop
64
+ - run: |
65
+ bundle exec rspec --profile 10 \
66
+ --format RspecJunitFormatter \
67
+ --out tmp/results/rspec.xml \
68
+ --format progress \
69
+ $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
70
+ - store_test_results:
71
+ path: tmp/results
72
+
73
+ ruby2.5:
74
+ docker:
75
+ - image: circleci/ruby:2.5
76
+ steps:
77
+ - checkout
78
+ - restore_cache:
79
+ key: gemfile-2-5-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }}
80
+ - run: bundle install -j3 --path vendor/bundle
81
+ - save_cache:
82
+ key: gemfile-2-5-{{ checksum "Gemfile" }}-{{ checksum "selligent.gemspec" }}
83
+ paths:
84
+ - vendor/bundle
85
+ - run: bundle check --path vendor/bundle
86
+ - run: bundle exec rubocop
87
+ - run: |
88
+ bundle exec rspec --profile 10 \
89
+ --format RspecJunitFormatter \
90
+ --out tmp/results/rspec.xml \
91
+ --format progress \
92
+ $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
93
+ - store_test_results:
94
+ path: tmp/results
95
+
96
+
97
+ workflows:
98
+ version: 2
99
+ build:
100
+ jobs:
101
+ - ruby2.2
102
+ - ruby2.3
103
+ - ruby2.4
104
+ - ruby2.5
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ .bundle/
2
+
3
+ Gemfile.lock
4
+
5
+ log/*.log
6
+ pkg/
7
+ .rspec_status
8
+
9
+ /doc
10
+ /.yardoc
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ Metrics/BlockLength:
2
+ Exclude:
3
+ - 'spec/**/*'
4
+
5
+ Metrics/LineLength:
6
+ Max: 100
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'rubocop', '>= 0.49'
5
+ gem 'yard'
6
+ end
7
+
8
+ group :test do
9
+ gem 'rspec', '~> 3.0'
10
+ gem 'rspec_junit_formatter', '~> 0.3'
11
+ gem 'timecop'
12
+ gem 'webmock'
13
+ end
14
+
15
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Catawiki
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,255 @@
1
+ # Selligent Ruby API client
2
+
3
+ ## Configure
4
+
5
+ ```ruby
6
+ Selligent.configure do |c|
7
+ c.host = 'www.selligent.com'
8
+ c.api_key = 'key'
9
+ c.api_secret = 'secret'
10
+ c.organization = 'catawiki'
11
+ end
12
+ ```
13
+
14
+ ## API Documentation
15
+
16
+ To generate API documentation, use yard:
17
+
18
+ ```ruby
19
+ yard
20
+ ```
21
+
22
+ Documentation can be found in /path/to/selligent/doc/index.html
23
+
24
+ ## Endpoints
25
+
26
+ ### Organization
27
+
28
+ ```ruby
29
+ # Get an overview of all organizations
30
+ Selligent.organizations
31
+
32
+ # Get details on the current organization
33
+ Selligent.organization
34
+ ```
35
+
36
+ ### Content
37
+
38
+ ```ruby
39
+ # Create simple (HTML only) single language email message content
40
+ Selligent.create_email(model, params = {})
41
+
42
+ # Create mobile push message content
43
+ Selligent.create_push_message(model, params = {})
44
+
45
+ # Create simple page content
46
+ Selligent.create_page(model, params = {})
47
+
48
+ # Create SMS content
49
+ Selligent.create_sms(model, params = {})
50
+ ```
51
+
52
+ ### Journey
53
+
54
+ ```ruby
55
+ # Get an overview of all journeys
56
+ Selligent.journeys
57
+ ```
58
+
59
+ ### Single Batch
60
+
61
+ ```ruby
62
+ # Get all journeys of type Single Batch
63
+ Selligent.single_batches
64
+
65
+ # Create a Single Batch journey
66
+ Selligent.create_single_batch(model)
67
+
68
+ # Get information on a Single Batch journey
69
+ Selligent.single_batch(name)
70
+
71
+ # Cancel launching of a single batch
72
+ Selligent.cancel_single_batch(name)
73
+
74
+ # Launch a single batch
75
+ Selligent.launch_single_batch(name, request)
76
+
77
+ # Trigger execution of a single batch journey
78
+ Selligent.trigger_single_batch(name, model)
79
+
80
+ # Send single batch with email message
81
+ Selligent.send_single_batch_email(model)
82
+
83
+ # Send single batch mobile push message
84
+ Selligent.send_single_batch_push(model)
85
+
86
+ # Send single batch sms
87
+ Selligent.send_single_batch_sms(model)
88
+ ```
89
+
90
+ ### Transactional
91
+
92
+ ```ruby
93
+ # List all transactional journeys
94
+ Selligent.transactionals
95
+
96
+ # Returns information on the transactional journey with the given name
97
+ Selligent.transactional(name)
98
+
99
+ # Sends transactional messages to the journey with the given name. See rdoc for model
100
+ # definition.
101
+ Selligent.send_transactional(name, model)
102
+
103
+ # Create or update a user profile and trigger a transactional message. See rdoc for model
104
+ # definition.
105
+ Selligent.update_profile_and_send_transactional(api_name, model)
106
+
107
+ # Get a list of status objects for the given message ids
108
+ Selligent.transactionals_status(ids)
109
+
110
+ # Get the status of a given message
111
+ Selligent.transactional_status(id)
112
+ ```
113
+
114
+
115
+ ### Transactional Bulk
116
+
117
+ ```ruby
118
+ # Trigger a bulk journey in a transactional way
119
+ Selligent.send_transactional_bulk(name)
120
+ ```
121
+
122
+ ### Lists
123
+
124
+ ```ruby
125
+ # Get an overview of all of the lists
126
+ Selligent.lists(options = {})
127
+
128
+ # Create a new list
129
+ Selligent.create_list(model)
130
+
131
+ # Delete a list
132
+ Selligent.delete_list(list_name, options = {})
133
+
134
+ # Get details for the list with the given name
135
+ Selligent.list(list_name)
136
+
137
+ # Update a list
138
+ Selligent.update_list(list_name, model)
139
+
140
+ # Get list fields for the given list
141
+ Selligent.fields(list_name)
142
+
143
+ # Create list fields
144
+ Selligent.create_fields(list_name, model)
145
+
146
+ # Delete a list field
147
+ Selligent.delete_field(list_name, field_name)
148
+
149
+ # Update a list field
150
+ Selligent.update_field(list_name, field_name, model)
151
+
152
+ # Get the number of records for the given list
153
+ Selligent.records_count(list_name)
154
+
155
+ # Delete a single record by id
156
+ Selligent.delete_record(list_name, record_id)
157
+
158
+ # Get all relations associated with a list
159
+ Selligent.relations(list_name)
160
+
161
+ # Create a relation between two lists
162
+ Selligent.create_relation(list_name, model)
163
+
164
+ # Delete a relation between two lists
165
+ Selligent.delete_relation(list_name, scope)
166
+
167
+ # Get relation details based on the list name and the relation scope name
168
+ Selligent.relation(list_name, scope)
169
+
170
+ # Update an existing relation
171
+ Selligent.update_relation(list_name, scope, model)
172
+
173
+ # Get an overview of the segments defined on the given list
174
+ Selligent.segments(list_name, options = {})
175
+
176
+ # Get segment details based on list API name and segment API name
177
+ Selligent.segment(list_name, segment_name)
178
+ ```
179
+
180
+ ### Data
181
+
182
+ ```ruby
183
+ # Delete data from the list with the given api-name
184
+ Selligent.delete_data(api_name, data, params = {})
185
+
186
+ # Load data into the list with the given api-name
187
+ Selligent.load_data(api_name, data, params = {})
188
+
189
+ # Search for data records in a specific table
190
+ Selligent.search_data(api_name, request, params = {})
191
+
192
+ # Delete data from the segment with the given segment-api-name
193
+ Selligent.delete_data_from_segment(api_name, segment_api_name, data, params = {})
194
+
195
+ # Load data into the segment using given segment-api-name
196
+ Selligent.load_data_into_segment(api_name, segment_api_name, data, params = {})
197
+
198
+ # Search for data records within a segment of specific table
199
+ Selligent.search_data_within_segment(api_name, segment_api_name, request, params = {})
200
+ ```
201
+
202
+ ### Stored Procedure
203
+
204
+ ```ruby
205
+ # Get list of stored procedures
206
+ Selligent.stored_procedures(options = {})
207
+
208
+ # Get details of stored procedure by name
209
+ Selligent.stored_procedure(name)
210
+ ```
211
+
212
+ ### Task
213
+
214
+ ```ruby
215
+ # Get collection of tasks
216
+ Selligent.tasks(options = {})
217
+
218
+ # Get task details
219
+ Selligent.task(task_name)
220
+
221
+ # Get actions of task
222
+ Selligent.task_actions(task_name)
223
+
224
+ # Disable a task
225
+ Selligent.disable_task(task_name)
226
+
227
+ # Enable a task
228
+ Selligent.enable_task(task_name)
229
+
230
+ # Run a task
231
+ Selligent.run_task(task_name)
232
+ ```
233
+
234
+ ### Cumulio
235
+
236
+ ```ruby
237
+ # Get datasets
238
+ Selligent.cumulio_datasets
239
+
240
+ # Run a cumulio query
241
+ Selligent.cumulio_query(model)
242
+ ```
243
+
244
+ ### Status
245
+
246
+ ```ruby
247
+ # Get the Selligent status
248
+ Selligent.status
249
+ ```
250
+
251
+
252
+ ## Develop
253
+
254
+ Please take a look at https://github.com/catawiki/selligent/pull/9 and use it as a
255
+ blueprint for adding other endpoints. Don't forget to update the readme as well.
data/lib/selligent.rb ADDED
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'selligent/client'
4
+
5
+ # Selligent API client
6
+ module Selligent
7
+ class << self
8
+ def client
9
+ @client ||= Selligent::Client.new
10
+ end
11
+
12
+ private
13
+
14
+ def respond_to_missing?(method_name, include_private = false)
15
+ client.respond_to?(method_name, include_private)
16
+ end
17
+
18
+ def method_missing(method_name, *args, &block)
19
+ return client.send(method_name, *args, &block) if client.respond_to?(method_name)
20
+
21
+ super
22
+ end
23
+ end
24
+ end