reach-ruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.dockerignore +1 -0
- data/.gitignore +18 -0
- data/.rubocop.yml +58 -0
- data/.rubocop_todo.yml +193 -0
- data/AUTHORS.md +52 -0
- data/CHANGES.md +3 -0
- data/CODE_OF_CONDUCT.md +73 -0
- data/CONTRIBUTING.md +163 -0
- data/Dockerfile +9 -0
- data/Gemfile +3 -0
- data/ISSUE_TEMPLATE.md +30 -0
- data/LICENSE +21 -0
- data/Makefile +34 -0
- data/PULL_REQUEST_TEMPLATE.md +31 -0
- data/README.md +237 -0
- data/Rakefile +10 -0
- data/UPGRADE.md +5 -0
- data/VERSIONS.md +35 -0
- data/advanced-examples/custom-http-client.md +166 -0
- data/examples/examples.rb +23 -0
- data/githooks/pre-commit +1 -0
- data/lib/rack/reach_webhook_authentication.rb +72 -0
- data/lib/reach-ruby/framework/reach_response.rb +19 -0
- data/lib/reach-ruby/framework/request.rb +41 -0
- data/lib/reach-ruby/framework/response.rb +18 -0
- data/lib/reach-ruby/framework/rest/domain.rb +39 -0
- data/lib/reach-ruby/framework/rest/error.rb +51 -0
- data/lib/reach-ruby/framework/rest/helper.rb +11 -0
- data/lib/reach-ruby/framework/rest/page.rb +144 -0
- data/lib/reach-ruby/framework/rest/resource.rb +23 -0
- data/lib/reach-ruby/framework/rest/version.rb +240 -0
- data/lib/reach-ruby/framework/serialize.rb +81 -0
- data/lib/reach-ruby/framework/values.rb +9 -0
- data/lib/reach-ruby/http/http_client.rb +82 -0
- data/lib/reach-ruby/http.rb +5 -0
- data/lib/reach-ruby/rest/api/authentix/.openapi-generator/FILES +10 -0
- data/lib/reach-ruby/rest/api/authentix/.openapi-generator/VERSION +1 -0
- data/lib/reach-ruby/rest/api/authentix/.openapi-generator-ignore +23 -0
- data/lib/reach-ruby/rest/api/authentix/authentication_trial_item.rb +418 -0
- data/lib/reach-ruby/rest/api/authentix/authentication_trial_stat_item.rb +279 -0
- data/lib/reach-ruby/rest/api/authentix/configuration_item/authentication_control_item.rb +214 -0
- data/lib/reach-ruby/rest/api/authentix/configuration_item/authentication_item.rb +449 -0
- data/lib/reach-ruby/rest/api/authentix/configuration_item.rb +583 -0
- data/lib/reach-ruby/rest/api/authentix.rb +72 -0
- data/lib/reach-ruby/rest/api/messaging/.openapi-generator/FILES +2 -0
- data/lib/reach-ruby/rest/api/messaging/.openapi-generator/VERSION +1 -0
- data/lib/reach-ruby/rest/api/messaging/.openapi-generator-ignore +23 -0
- data/lib/reach-ruby/rest/api/messaging/messaging_item.rb +582 -0
- data/lib/reach-ruby/rest/api/messaging.rb +51 -0
- data/lib/reach-ruby/rest/api.rb +50 -0
- data/lib/reach-ruby/rest/client.rb +130 -0
- data/lib/reach-ruby/rest.rb +13 -0
- data/lib/reach-ruby/security/request_validator.rb +149 -0
- data/lib/reach-ruby/util/configuration.rb +25 -0
- data/lib/reach-ruby/version.rb +3 -0
- data/lib/reach-ruby.rb +44 -0
- data/reach-ruby.gemspec +38 -0
- data/sonar-project.properties +13 -0
- metadata +267 -0
@@ -0,0 +1,583 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# ___ ___ _ ___ _ _ _____ _ _ _ ___ ___ _ ___ ___ ___ _ ___ ___ ___ _ _ ___ ___ _ _____ ___ ___
|
4
|
+
# | _ \ __| /_\ / __| || |__|_ _/_\ | | | |/ | \ / / | /_\ | _ ) __|___ / _ \ /_\ |_ _|__ / __| __| \| | __| _ \ /_\_ _/ _ \| _ \
|
5
|
+
# | / _| / _ \ (__| __ |___|| |/ _ \| |__| ' < \ V /| |__ / _ \| _ \__ \___| (_) / _ \ | |___| (_ | _|| .` | _|| / / _ \| || (_) | /
|
6
|
+
# |_|_\___/_/ \_\___|_||_| |_/_/ \_\____|_|\_\ |_| |____/_/ \_\___/___/ \___/_/ \_\___| \___|___|_|\_|___|_|_\/_/ \_\_| \___/|_|_\
|
7
|
+
#
|
8
|
+
# Reach Authentix API
|
9
|
+
# Reach Authentix API helps you easily integrate user authentification in your application. The authentification allows to verify that a user is indeed at the origin of a request from your application. At the moment, the Reach Authentix API supports the following channels: * SMS * Email We are continuously working to add additionnal channels. ## Base URL All endpoints described in this documentation are relative to the following base URL: ``` https://api.reach.talkylabs.com/rest/authentix/v1/ ``` The API is provided over HTTPS protocol to ensure data privacy. ## API Authentication Requests made to the API must be authenticated. You need to provide the `ApiUser` and `ApiKey` associated with your applet. This information could be found in the settings of the applet. ```curl curl -X GET [BASE_URL]/configurations -H \"ApiUser:[Your_Api_User]\" -H \"ApiKey:[Your_Api_Key]\" ``` ## Reach Authentix API Workflow Three steps are needed in order to authenticate a given user using the Reach Authentix API. ### Step 1: Create an Authentix configuration A configuration is a set of settings used to define and send an authentication code to a user. This includes, for example: ``` - the length of the authentication code, - the message template, - and so on... ``` A configuaration could be created via the web application or directly using the Reach Authentix API. This step does not need to be performed every time one wants to use the Reach Authentix API. Indeed, once created, a configuartion could be used to authenticate several users in the future. ### Step 2: Send an authentication code A configuration is used to send an authentication code via a selected channel to a user. For now, the supported channels are `sms`, and `email`. We are working hard to support additional channels. Newly created authentications will have a status of `awaiting`. ### Step 3: Verify the authentication code This step allows to verify that the code submitted by the user matched the one sent previously. If, there is a match, then the status of the authentication changes from `awaiting` to `passed`. Otherwise, the status remains `awaiting` until either it is verified or it expires. In the latter case, the status becomes `expired`.
|
10
|
+
#
|
11
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
12
|
+
# https://openapi-generator.tech
|
13
|
+
# Do not edit the class manually.
|
14
|
+
#
|
15
|
+
|
16
|
+
|
17
|
+
module Reach
|
18
|
+
module REST
|
19
|
+
class Api
|
20
|
+
class Authentix < Version
|
21
|
+
class ConfigurationItemList < ListResource
|
22
|
+
##
|
23
|
+
# Initialize the ConfigurationItemList
|
24
|
+
# @param [Version] version Version that contains the resource
|
25
|
+
# @return [ConfigurationItemList] ConfigurationItemList
|
26
|
+
def initialize(version)
|
27
|
+
super(version)
|
28
|
+
# Path Solution
|
29
|
+
@solution = { }
|
30
|
+
@uri = "/authentix/v1/configurations"
|
31
|
+
|
32
|
+
end
|
33
|
+
##
|
34
|
+
# Create the ConfigurationItemInstance
|
35
|
+
# @param [String] service_name The name of the authentication service attached to this configuration. It can be up to 40 characters long.
|
36
|
+
# @param [String] code_length The length of the code to be generated. It must be a value between 4 and 10, inclusive. If not specified, the default value is 5.
|
37
|
+
# @param [Boolean] allow_custom_code A flag indicating if the configuration should allow sending custom and non-generated code.
|
38
|
+
# @param [Boolean] used_for_digital_payment A flag indicating if the configuration is used to authenticate digital payments. In such a case, additional information such as the amount and the payee of the financial transaction should be sent to when starting the authentication.
|
39
|
+
# @param [String] default_expiry_time It represents how long, in minutes, an authentication process will remained in the `awaiting` status before moving to `expired` in the case no valid matching is performed in between. It also means that the code sent for the autentication remains the same during its validity period until the autentication is successful. In other words, if another authentication request is asked within that period, the same code will be sent. If not specified, the default value is 15 minutes. It must be any value between 1 and 1440 which represents 24 hours.
|
40
|
+
# @param [String] default_max_trials It represents the maximum number of trials per authentication. The default value is 5.
|
41
|
+
# @param [String] default_max_controls It represents the maximum number of code controls per authentication. It must be between 1 and 6 inclusive. The default value is 3.
|
42
|
+
# @param [String] smtp_setting_id This is the ID of the SMTP settings used by this configuration. It is mandatory to provide this parameter in order to send the authentication code via email. An SMTPSetting can be created via the web application in an easy way.
|
43
|
+
# @param [String] email_template_id This is the ID of the default email template to use for sending authenetication codes via email. If not provided, the message used will be: ``` ${SERVICE_NAME}: your authentication code is ${CODE}. ```
|
44
|
+
# @param [String] sms_template_id This is the ID of the default sms template to use for sending authenetication codes via sms. If not provided, the message used will be: ``` ${SERVICE_NAME}: your authentication code is ${CODE}. ```
|
45
|
+
# @return [ConfigurationItemInstance] Created ConfigurationItemInstance
|
46
|
+
def create(
|
47
|
+
service_name: nil,
|
48
|
+
code_length: :unset,
|
49
|
+
allow_custom_code: :unset,
|
50
|
+
used_for_digital_payment: :unset,
|
51
|
+
default_expiry_time: :unset,
|
52
|
+
default_max_trials: :unset,
|
53
|
+
default_max_controls: :unset,
|
54
|
+
smtp_setting_id: :unset,
|
55
|
+
email_template_id: :unset,
|
56
|
+
sms_template_id: :unset
|
57
|
+
)
|
58
|
+
|
59
|
+
baseParams = {
|
60
|
+
}
|
61
|
+
data = Reach::Values.of(baseParams.merge({
|
62
|
+
'serviceName' => service_name,
|
63
|
+
'codeLength' => code_length,
|
64
|
+
'allowCustomCode' => allow_custom_code,
|
65
|
+
'usedForDigitalPayment' => used_for_digital_payment,
|
66
|
+
'defaultExpiryTime' => default_expiry_time,
|
67
|
+
'defaultMaxTrials' => default_max_trials,
|
68
|
+
'defaultMaxControls' => default_max_controls,
|
69
|
+
'smtpSettingId' => smtp_setting_id,
|
70
|
+
'emailTemplateId' => email_template_id,
|
71
|
+
'smsTemplateId' => sms_template_id,
|
72
|
+
}))
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
payload = @version.create('POST', @uri, data: data)
|
77
|
+
ConfigurationItemInstance.new(
|
78
|
+
@version,
|
79
|
+
payload,
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
##
|
85
|
+
# Lists ConfigurationItemInstance records from the API as a list.
|
86
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
87
|
+
# memory before returning.
|
88
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
89
|
+
# guarantees to never return more than limit. Default is no limit
|
90
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
91
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
92
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
93
|
+
# efficient page size, i.e. min(limit, 1000)
|
94
|
+
# @return [Array] Array of up to limit results
|
95
|
+
def list(limit: nil, page_size: nil)
|
96
|
+
self.stream(
|
97
|
+
limit: limit,
|
98
|
+
page_size: page_size
|
99
|
+
).entries
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Streams Instance records from the API as an Enumerable.
|
104
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
105
|
+
# is reached.
|
106
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
107
|
+
# guarantees to never return more than limit. Default is no limit
|
108
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
109
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
110
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
111
|
+
# efficient page size, i.e. min(limit, 1000)
|
112
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
113
|
+
def stream(limit: nil, page_size: nil)
|
114
|
+
limits = @version.read_limits(limit, page_size)
|
115
|
+
|
116
|
+
page = self.page(
|
117
|
+
page_size: limits[:page_size], )
|
118
|
+
|
119
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# When passed a block, yields ConfigurationItemInstance records from the API.
|
124
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
125
|
+
# is reached.
|
126
|
+
def each
|
127
|
+
limits = @version.read_limits
|
128
|
+
|
129
|
+
page = self.page(page_size: limits[:page_size], )
|
130
|
+
|
131
|
+
@version.stream(page,
|
132
|
+
limit: limits[:limit],
|
133
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
134
|
+
end
|
135
|
+
|
136
|
+
##
|
137
|
+
# Retrieve a single page of ConfigurationItemInstance records from the API.
|
138
|
+
# Request is executed immediately.
|
139
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
140
|
+
# @param [Integer] page_size Number of records to return, defaults to 20
|
141
|
+
# @return [Page] Page of ConfigurationItemInstance
|
142
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
143
|
+
params = Reach::Values.of({
|
144
|
+
|
145
|
+
'page' => page_number,
|
146
|
+
'pageSize' => page_size,
|
147
|
+
})
|
148
|
+
|
149
|
+
baseUrl = @version.url_without_pagination_info(@version.absolute_url(@uri), params)
|
150
|
+
response = @version.page('GET', @uri, params: params)
|
151
|
+
|
152
|
+
ConfigurationItemPage.new(baseUrl, @version, response, @solution)
|
153
|
+
end
|
154
|
+
|
155
|
+
##
|
156
|
+
# Retrieve a single page of ConfigurationItemInstance records from the API.
|
157
|
+
# Request is executed immediately.
|
158
|
+
# @param [String] target_url API-generated URL for the requested results page
|
159
|
+
# @return [Page] Page of ConfigurationItemInstance
|
160
|
+
def get_page(target_url)
|
161
|
+
baseUrl = @version.url_without_pagination_info(target_url)
|
162
|
+
response = @version.domain.request(
|
163
|
+
'GET',
|
164
|
+
target_url
|
165
|
+
)
|
166
|
+
ConfigurationItemPage.new(baseUrl, @version, response, @solution)
|
167
|
+
end
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
# Provide a user friendly representation
|
172
|
+
def to_s
|
173
|
+
'#<Reach.Api.Authentix.ConfigurationItemList>'
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
|
178
|
+
class ConfigurationItemContext < InstanceContext
|
179
|
+
##
|
180
|
+
# Initialize the ConfigurationItemContext
|
181
|
+
# @param [Version] version Version that contains the resource
|
182
|
+
# @param [String] configuration_id The identifier of the configuration to be updated.
|
183
|
+
# @return [ConfigurationItemContext] ConfigurationItemContext
|
184
|
+
def initialize(version, configuration_id)
|
185
|
+
super(version)
|
186
|
+
|
187
|
+
# Path Solution
|
188
|
+
@solution = { configuration_id: configuration_id, }
|
189
|
+
@uri = "/authentix/v1/configurations/#{@solution[:configuration_id]}"
|
190
|
+
|
191
|
+
# Dependents
|
192
|
+
@authentication_control_items = nil
|
193
|
+
@authentication_items = nil
|
194
|
+
end
|
195
|
+
##
|
196
|
+
# Delete the ConfigurationItemInstance
|
197
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
198
|
+
def delete
|
199
|
+
|
200
|
+
baseParams = {
|
201
|
+
}
|
202
|
+
|
203
|
+
|
204
|
+
@version.delete('DELETE', @uri)
|
205
|
+
end
|
206
|
+
|
207
|
+
##
|
208
|
+
# Fetch the ConfigurationItemInstance
|
209
|
+
# @return [ConfigurationItemInstance] Fetched ConfigurationItemInstance
|
210
|
+
def fetch
|
211
|
+
|
212
|
+
baseParams = {
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
payload = @version.fetch('GET', @uri)
|
217
|
+
ConfigurationItemInstance.new(
|
218
|
+
@version,
|
219
|
+
payload,
|
220
|
+
configuration_id: @solution[:configuration_id],
|
221
|
+
)
|
222
|
+
end
|
223
|
+
|
224
|
+
##
|
225
|
+
# Update the ConfigurationItemInstance
|
226
|
+
# @param [String] service_name The name of the authentication service attached to this configuration. It can be up to 40 characters long.
|
227
|
+
# @param [String] code_length The length of the code to be generated. It must be a value between 4 and 10, inclusive.
|
228
|
+
# @param [Boolean] allow_custom_code A flag indicating if the configuration should allow sending custom and non-generated code.
|
229
|
+
# @param [Boolean] used_for_digital_payment A flag indicating if the configuration is used to authenticate digital payments. In such a case, additional information such as the amount and the payee of the financial transaction should be sent to when starting the authentication.
|
230
|
+
# @param [String] default_expiry_time It represents how long, in minutes, an authentication process will remained in the `awaiting` status before moving to `expired` in the case no valid matching is performed in between. It must be any value between 1 and 1440 which represents 24 hours.
|
231
|
+
# @param [String] default_max_trials It represents the maximum number of trials per authentication.
|
232
|
+
# @param [String] default_max_controls It represents the maximum number of code controls per authentication. It must be between 1 and 6 inclusive.
|
233
|
+
# @param [String] smtp_setting_id This is the ID of the SMTP settings used by this configuration. It is mandatory for sending authentication codes via email.
|
234
|
+
# @param [String] email_template_id This is the ID of the default email template to use for sending authenetication codes via email.
|
235
|
+
# @param [String] sms_template_id This is the ID of the default sms template to use for sending authenetication codes via sms.
|
236
|
+
# @return [ConfigurationItemInstance] Updated ConfigurationItemInstance
|
237
|
+
def update(
|
238
|
+
service_name: :unset,
|
239
|
+
code_length: :unset,
|
240
|
+
allow_custom_code: :unset,
|
241
|
+
used_for_digital_payment: :unset,
|
242
|
+
default_expiry_time: :unset,
|
243
|
+
default_max_trials: :unset,
|
244
|
+
default_max_controls: :unset,
|
245
|
+
smtp_setting_id: :unset,
|
246
|
+
email_template_id: :unset,
|
247
|
+
sms_template_id: :unset
|
248
|
+
)
|
249
|
+
|
250
|
+
baseParams = {
|
251
|
+
}
|
252
|
+
data = Reach::Values.of(baseParams.merge({
|
253
|
+
'serviceName' => service_name,
|
254
|
+
'codeLength' => code_length,
|
255
|
+
'allowCustomCode' => allow_custom_code,
|
256
|
+
'usedForDigitalPayment' => used_for_digital_payment,
|
257
|
+
'defaultExpiryTime' => default_expiry_time,
|
258
|
+
'defaultMaxTrials' => default_max_trials,
|
259
|
+
'defaultMaxControls' => default_max_controls,
|
260
|
+
'smtpSettingId' => smtp_setting_id,
|
261
|
+
'emailTemplateId' => email_template_id,
|
262
|
+
'smsTemplateId' => sms_template_id,
|
263
|
+
}))
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
payload = @version.update('POST', @uri, data: data)
|
268
|
+
ConfigurationItemInstance.new(
|
269
|
+
@version,
|
270
|
+
payload,
|
271
|
+
configuration_id: @solution[:configuration_id],
|
272
|
+
)
|
273
|
+
end
|
274
|
+
|
275
|
+
##
|
276
|
+
# Access the authentication_control_items
|
277
|
+
# @return [AuthenticationControlItemList]
|
278
|
+
# @return [AuthenticationControlItemContext]
|
279
|
+
def authentication_control_items
|
280
|
+
unless @authentication_control_items
|
281
|
+
@authentication_control_items = AuthenticationControlItemList.new(
|
282
|
+
@version,
|
283
|
+
configuration_id: @solution[:configuration_id]
|
284
|
+
|
285
|
+
)
|
286
|
+
end
|
287
|
+
|
288
|
+
@authentication_control_items
|
289
|
+
end
|
290
|
+
##
|
291
|
+
# Access the authentication_items
|
292
|
+
# @return [AuthenticationItemList]
|
293
|
+
# @return [AuthenticationItemContext] if sid was passed.
|
294
|
+
def authentication_items(authentication_id=:unset)
|
295
|
+
|
296
|
+
raise ArgumentError, 'authentication_id cannot be nil' if authentication_id.nil?
|
297
|
+
|
298
|
+
if authentication_id != :unset
|
299
|
+
return AuthenticationItemContext.new(@version, @solution[:configuration_id],authentication_id )
|
300
|
+
end
|
301
|
+
|
302
|
+
unless @authentication_items
|
303
|
+
@authentication_items = AuthenticationItemList.new(
|
304
|
+
@version,
|
305
|
+
configuration_id: @solution[:configuration_id]
|
306
|
+
|
307
|
+
)
|
308
|
+
end
|
309
|
+
|
310
|
+
@authentication_items
|
311
|
+
end
|
312
|
+
|
313
|
+
##
|
314
|
+
# Provide a user friendly representation
|
315
|
+
def to_s
|
316
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
317
|
+
"#<Reach.Api.Authentix.ConfigurationItemContext #{context}>"
|
318
|
+
end
|
319
|
+
|
320
|
+
##
|
321
|
+
# Provide a detailed, user friendly representation
|
322
|
+
def inspect
|
323
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
324
|
+
"#<Reach.Api.Authentix.ConfigurationItemContext #{context}>"
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
class ConfigurationItemPage < Page
|
329
|
+
##
|
330
|
+
# Initialize the ConfigurationItemPage
|
331
|
+
# @param [String] baseUrl url without pagination info
|
332
|
+
# @param [Version] version Version that contains the resource
|
333
|
+
# @param [Response] response Response from the API
|
334
|
+
# @param [Hash] solution Path solution for the resource
|
335
|
+
# @return [ConfigurationItemPage] ConfigurationItemPage
|
336
|
+
def initialize(baseUrl, version, response, solution)
|
337
|
+
super(baseUrl, version, response)
|
338
|
+
|
339
|
+
# Path Solution
|
340
|
+
@solution = solution
|
341
|
+
end
|
342
|
+
|
343
|
+
##
|
344
|
+
# Build an instance of ConfigurationItemInstance
|
345
|
+
# @param [Hash] payload Payload response from the API
|
346
|
+
# @return [ConfigurationItemInstance] ConfigurationItemInstance
|
347
|
+
def get_instance(payload)
|
348
|
+
ConfigurationItemInstance.new(@version, payload)
|
349
|
+
end
|
350
|
+
|
351
|
+
##
|
352
|
+
# Provide a user friendly representation
|
353
|
+
def to_s
|
354
|
+
'<Reach.Api.Authentix.ConfigurationItemPage>'
|
355
|
+
end
|
356
|
+
end
|
357
|
+
class ConfigurationItemInstance < InstanceResource
|
358
|
+
##
|
359
|
+
# Initialize the ConfigurationItemInstance
|
360
|
+
# @param [Version] version Version that contains the resource
|
361
|
+
# @param [Hash] payload payload that contains response from Reach(TalkyLabs)
|
362
|
+
# @param [String] account_sid The SID of the
|
363
|
+
# Account that created this ConfigurationItem
|
364
|
+
# resource.
|
365
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
366
|
+
# @return [ConfigurationItemInstance] ConfigurationItemInstance
|
367
|
+
def initialize(version, payload , configuration_id: nil)
|
368
|
+
super(version)
|
369
|
+
|
370
|
+
# Marshaled Properties
|
371
|
+
@properties = {
|
372
|
+
'appletId' => payload['appletId'],
|
373
|
+
'apiVersion' => payload['apiVersion'],
|
374
|
+
'configurationId' => payload['configurationId'],
|
375
|
+
'serviceName' => payload['serviceName'],
|
376
|
+
'codeLength' => payload['codeLength'] == nil ? payload['codeLength'] : payload['codeLength'].to_i,
|
377
|
+
'allowCustomCode' => payload['allowCustomCode'],
|
378
|
+
'usedForDigitalPayment' => payload['usedForDigitalPayment'],
|
379
|
+
'defaultExpiryTime' => payload['defaultExpiryTime'] == nil ? payload['defaultExpiryTime'] : payload['defaultExpiryTime'].to_i,
|
380
|
+
'defaultMaxTrials' => payload['defaultMaxTrials'] == nil ? payload['defaultMaxTrials'] : payload['defaultMaxTrials'].to_i,
|
381
|
+
'defaultMaxControls' => payload['defaultMaxControls'] == nil ? payload['defaultMaxControls'] : payload['defaultMaxControls'].to_i,
|
382
|
+
'smtpSettingId' => payload['smtpSettingId'],
|
383
|
+
'emailTemplateId' => payload['emailTemplateId'],
|
384
|
+
'smsTemplateId' => payload['smsTemplateId'],
|
385
|
+
'dateCreated' => Reach.deserialize_iso8601_datetime(payload['dateCreated']),
|
386
|
+
'dateUpdated' => Reach.deserialize_iso8601_datetime(payload['dateUpdated']),
|
387
|
+
}
|
388
|
+
|
389
|
+
# Context
|
390
|
+
@instance_context = nil
|
391
|
+
@params = { 'configuration_id' => configuration_id || @properties['configurationId'] , }
|
392
|
+
end
|
393
|
+
|
394
|
+
##
|
395
|
+
# Generate an instance context for the instance, the context is capable of
|
396
|
+
# performing various actions. All instance actions are proxied to the context
|
397
|
+
# @return [ConfigurationItemContext] CallContext for this CallInstance
|
398
|
+
def context
|
399
|
+
unless @instance_context
|
400
|
+
@instance_context = ConfigurationItemContext.new(@version , @params['configuration_id'])
|
401
|
+
end
|
402
|
+
@instance_context
|
403
|
+
end
|
404
|
+
|
405
|
+
##
|
406
|
+
# @return [String] The identifier of the applet creating the configuration.
|
407
|
+
def appletId
|
408
|
+
@properties['appletId']
|
409
|
+
end
|
410
|
+
|
411
|
+
##
|
412
|
+
# @return [String] The API version used to create the configuration.
|
413
|
+
def apiVersion
|
414
|
+
@properties['apiVersion']
|
415
|
+
end
|
416
|
+
|
417
|
+
##
|
418
|
+
# @return [String] The identifier of the configuration.
|
419
|
+
def configurationId
|
420
|
+
@properties['configurationId']
|
421
|
+
end
|
422
|
+
|
423
|
+
##
|
424
|
+
# @return [String] The name of the authentication service.
|
425
|
+
def serviceName
|
426
|
+
@properties['serviceName']
|
427
|
+
end
|
428
|
+
|
429
|
+
##
|
430
|
+
# @return [String] The length of the code to be generated.
|
431
|
+
def codeLength
|
432
|
+
@properties['codeLength']
|
433
|
+
end
|
434
|
+
|
435
|
+
##
|
436
|
+
# @return [Boolean] A flag indicating if the configuration allows sending custom and non-generated code.
|
437
|
+
def allowCustomCode
|
438
|
+
@properties['allowCustomCode']
|
439
|
+
end
|
440
|
+
|
441
|
+
##
|
442
|
+
# @return [Boolean] A flag indicating if the configuration is used to authenticate digital payments.
|
443
|
+
def usedForDigitalPayment
|
444
|
+
@properties['usedForDigitalPayment']
|
445
|
+
end
|
446
|
+
|
447
|
+
##
|
448
|
+
# @return [String] the default expiry time of the authentication code.
|
449
|
+
def defaultExpiryTime
|
450
|
+
@properties['defaultExpiryTime']
|
451
|
+
end
|
452
|
+
|
453
|
+
##
|
454
|
+
# @return [String] the default maximum number of trials per authentication.
|
455
|
+
def defaultMaxTrials
|
456
|
+
@properties['defaultMaxTrials']
|
457
|
+
end
|
458
|
+
|
459
|
+
##
|
460
|
+
# @return [String] the default maximum number of code controls per authentication.
|
461
|
+
def defaultMaxControls
|
462
|
+
@properties['defaultMaxControls']
|
463
|
+
end
|
464
|
+
|
465
|
+
##
|
466
|
+
# @return [String] The ID of the SMTP settings used by the configuration.
|
467
|
+
def smtpSettingId
|
468
|
+
@properties['smtpSettingId']
|
469
|
+
end
|
470
|
+
|
471
|
+
##
|
472
|
+
# @return [String] The default email template ID used by this configuration.
|
473
|
+
def emailTemplateId
|
474
|
+
@properties['emailTemplateId']
|
475
|
+
end
|
476
|
+
|
477
|
+
##
|
478
|
+
# @return [String] The default sms template ID used by this configuration.
|
479
|
+
def smsTemplateId
|
480
|
+
@properties['smsTemplateId']
|
481
|
+
end
|
482
|
+
|
483
|
+
##
|
484
|
+
# @return [Time] The date and time in GMT that the configuration was created.
|
485
|
+
def dateCreated
|
486
|
+
@properties['dateCreated']
|
487
|
+
end
|
488
|
+
|
489
|
+
##
|
490
|
+
# @return [Time] The date and time in GMT that the configuration was last updated.
|
491
|
+
def dateUpdated
|
492
|
+
@properties['dateUpdated']
|
493
|
+
end
|
494
|
+
|
495
|
+
##
|
496
|
+
# Delete the ConfigurationItemInstance
|
497
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
498
|
+
def delete
|
499
|
+
|
500
|
+
context.delete
|
501
|
+
end
|
502
|
+
|
503
|
+
##
|
504
|
+
# Fetch the ConfigurationItemInstance
|
505
|
+
# @return [ConfigurationItemInstance] Fetched ConfigurationItemInstance
|
506
|
+
def fetch
|
507
|
+
|
508
|
+
context.fetch
|
509
|
+
end
|
510
|
+
|
511
|
+
##
|
512
|
+
# Update the ConfigurationItemInstance
|
513
|
+
# @param [String] service_name The name of the authentication service attached to this configuration. It can be up to 40 characters long.
|
514
|
+
# @param [String] code_length The length of the code to be generated. It must be a value between 4 and 10, inclusive.
|
515
|
+
# @param [Boolean] allow_custom_code A flag indicating if the configuration should allow sending custom and non-generated code.
|
516
|
+
# @param [Boolean] used_for_digital_payment A flag indicating if the configuration is used to authenticate digital payments. In such a case, additional information such as the amount and the payee of the financial transaction should be sent to when starting the authentication.
|
517
|
+
# @param [String] default_expiry_time It represents how long, in minutes, an authentication process will remained in the `awaiting` status before moving to `expired` in the case no valid matching is performed in between. It must be any value between 1 and 1440 which represents 24 hours.
|
518
|
+
# @param [String] default_max_trials It represents the maximum number of trials per authentication.
|
519
|
+
# @param [String] default_max_controls It represents the maximum number of code controls per authentication. It must be between 1 and 6 inclusive.
|
520
|
+
# @param [String] smtp_setting_id This is the ID of the SMTP settings used by this configuration. It is mandatory for sending authentication codes via email.
|
521
|
+
# @param [String] email_template_id This is the ID of the default email template to use for sending authenetication codes via email.
|
522
|
+
# @param [String] sms_template_id This is the ID of the default sms template to use for sending authenetication codes via sms.
|
523
|
+
# @return [ConfigurationItemInstance] Updated ConfigurationItemInstance
|
524
|
+
def update(
|
525
|
+
service_name: :unset,
|
526
|
+
code_length: :unset,
|
527
|
+
allow_custom_code: :unset,
|
528
|
+
used_for_digital_payment: :unset,
|
529
|
+
default_expiry_time: :unset,
|
530
|
+
default_max_trials: :unset,
|
531
|
+
default_max_controls: :unset,
|
532
|
+
smtp_setting_id: :unset,
|
533
|
+
email_template_id: :unset,
|
534
|
+
sms_template_id: :unset
|
535
|
+
)
|
536
|
+
|
537
|
+
context.update(
|
538
|
+
service_name: service_name,
|
539
|
+
code_length: code_length,
|
540
|
+
allow_custom_code: allow_custom_code,
|
541
|
+
used_for_digital_payment: used_for_digital_payment,
|
542
|
+
default_expiry_time: default_expiry_time,
|
543
|
+
default_max_trials: default_max_trials,
|
544
|
+
default_max_controls: default_max_controls,
|
545
|
+
smtp_setting_id: smtp_setting_id,
|
546
|
+
email_template_id: email_template_id,
|
547
|
+
sms_template_id: sms_template_id,
|
548
|
+
)
|
549
|
+
end
|
550
|
+
|
551
|
+
##
|
552
|
+
# Access the authentication_control_items
|
553
|
+
# @return [authentication_control_items] authentication_control_items
|
554
|
+
def authentication_control_items
|
555
|
+
context.authentication_control_items
|
556
|
+
end
|
557
|
+
|
558
|
+
##
|
559
|
+
# Access the authentication_items
|
560
|
+
# @return [authentication_items] authentication_items
|
561
|
+
def authentication_items
|
562
|
+
context.authentication_items
|
563
|
+
end
|
564
|
+
|
565
|
+
##
|
566
|
+
# Provide a user friendly representation
|
567
|
+
def to_s
|
568
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
569
|
+
"<Reach.Api.Authentix.ConfigurationItemInstance #{values}>"
|
570
|
+
end
|
571
|
+
|
572
|
+
##
|
573
|
+
# Provide a detailed, user friendly representation
|
574
|
+
def inspect
|
575
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
576
|
+
"<Reach.Api.Authentix.ConfigurationItemInstance #{values}>"
|
577
|
+
end
|
578
|
+
end
|
579
|
+
|
580
|
+
end
|
581
|
+
end
|
582
|
+
end
|
583
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# ___ ___ _ ___ _ _ _____ _ _ _ ___ ___ _ ___ ___ ___ _ ___ ___ ___ _ _ ___ ___ _ _____ ___ ___
|
4
|
+
# | _ \ __| /_\ / __| || |__|_ _/_\ | | | |/ | \ / / | /_\ | _ ) __|___ / _ \ /_\ |_ _|__ / __| __| \| | __| _ \ /_\_ _/ _ \| _ \
|
5
|
+
# | / _| / _ \ (__| __ |___|| |/ _ \| |__| ' < \ V /| |__ / _ \| _ \__ \___| (_) / _ \ | |___| (_ | _|| .` | _|| / / _ \| || (_) | /
|
6
|
+
# |_|_\___/_/ \_\___|_||_| |_/_/ \_\____|_|\_\ |_| |____/_/ \_\___/___/ \___/_/ \_\___| \___|___|_|\_|___|_|_\/_/ \_\_| \___/|_|_\
|
7
|
+
#
|
8
|
+
# Reach Authentix API
|
9
|
+
# Reach Authentix API helps you easily integrate user authentification in your application. The authentification allows to verify that a user is indeed at the origin of a request from your application. At the moment, the Reach Authentix API supports the following channels: * SMS * Email We are continuously working to add additionnal channels. ## Base URL All endpoints described in this documentation are relative to the following base URL: ``` https://api.reach.talkylabs.com/rest/authentix/v1/ ``` The API is provided over HTTPS protocol to ensure data privacy. ## API Authentication Requests made to the API must be authenticated. You need to provide the `ApiUser` and `ApiKey` associated with your applet. This information could be found in the settings of the applet. ```curl curl -X GET [BASE_URL]/configurations -H \"ApiUser:[Your_Api_User]\" -H \"ApiKey:[Your_Api_Key]\" ``` ## Reach Authentix API Workflow Three steps are needed in order to authenticate a given user using the Reach Authentix API. ### Step 1: Create an Authentix configuration A configuration is a set of settings used to define and send an authentication code to a user. This includes, for example: ``` - the length of the authentication code, - the message template, - and so on... ``` A configuaration could be created via the web application or directly using the Reach Authentix API. This step does not need to be performed every time one wants to use the Reach Authentix API. Indeed, once created, a configuartion could be used to authenticate several users in the future. ### Step 2: Send an authentication code A configuration is used to send an authentication code via a selected channel to a user. For now, the supported channels are `sms`, and `email`. We are working hard to support additional channels. Newly created authentications will have a status of `awaiting`. ### Step 3: Verify the authentication code This step allows to verify that the code submitted by the user matched the one sent previously. If, there is a match, then the status of the authentication changes from `awaiting` to `passed`. Otherwise, the status remains `awaiting` until either it is verified or it expires. In the latter case, the status becomes `expired`.
|
10
|
+
#
|
11
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
12
|
+
# https://openapi-generator.tech
|
13
|
+
# Do not edit the class manually.
|
14
|
+
#
|
15
|
+
|
16
|
+
module Reach
|
17
|
+
module REST
|
18
|
+
class Api
|
19
|
+
class Authentix < Version
|
20
|
+
##
|
21
|
+
# Initialize the Authentix version of Api
|
22
|
+
def initialize(domain)
|
23
|
+
super
|
24
|
+
@version = 'rest'
|
25
|
+
@authentication_trial_items = nil
|
26
|
+
@authentication_trial_stat_items = nil
|
27
|
+
@configuration_items = nil
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
##
|
32
|
+
# @param [String] trial_id The identifier of the authentication trial to be fetched.
|
33
|
+
# @return [Reach::REST::Api::Authentix::AuthenticationTrialItemContext] if trialId was passed.
|
34
|
+
# @return [Reach::REST::Api::Authentix::AuthenticationTrialItemList]
|
35
|
+
def authentication_trial_items(trial_id=:unset)
|
36
|
+
if trial_id.nil?
|
37
|
+
raise ArgumentError, 'trial_id cannot be nil'
|
38
|
+
end
|
39
|
+
if trial_id == :unset
|
40
|
+
@authentication_trial_items ||= AuthenticationTrialItemList.new self
|
41
|
+
else
|
42
|
+
AuthenticationTrialItemContext.new(self, trial_id)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
##
|
46
|
+
# @return [Reach::REST::Api::Authentix::authenticationTrialStatItemsContext]
|
47
|
+
def authentication_trial_stat_items
|
48
|
+
@authentication_trial_stat_items ||= AuthenticationTrialStatItemContext.new self
|
49
|
+
end
|
50
|
+
##
|
51
|
+
# @param [String] configuration_id The identifier of the configuration to be fetched.
|
52
|
+
# @return [Reach::REST::Api::Authentix::ConfigurationItemContext] if configurationId was passed.
|
53
|
+
# @return [Reach::REST::Api::Authentix::ConfigurationItemList]
|
54
|
+
def configuration_items(configuration_id=:unset)
|
55
|
+
if configuration_id.nil?
|
56
|
+
raise ArgumentError, 'configuration_id cannot be nil'
|
57
|
+
end
|
58
|
+
if configuration_id == :unset
|
59
|
+
@configuration_items ||= ConfigurationItemList.new self
|
60
|
+
else
|
61
|
+
ConfigurationItemContext.new(self, configuration_id)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
##
|
65
|
+
# Provide a user friendly representation
|
66
|
+
def to_s
|
67
|
+
'<Reach::REST::Api::Authentix>';
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
unset
|