Class: Reach::REST::Api::Authentix::ConfigurationItemContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/reach-ruby/rest/api/authentix/configuration_item.rb,
lib/reach-ruby/rest/api/authentix/configuration_item/authentication_item.rb,
lib/reach-ruby/rest/api/authentix/configuration_item/authentication_control_item.rb

Defined Under Namespace

Classes: AuthenticationControlItemInstance, AuthenticationControlItemList, AuthenticationControlItemPage, AuthenticationItemContext, AuthenticationItemInstance, AuthenticationItemList, AuthenticationItemPage

Instance Method Summary collapse

Constructor Details

#initialize(version, configuration_id) ⇒ ConfigurationItemContext

Initialize the ConfigurationItemContext

Parameters:

  • version (Version)

    Version that contains the resource

  • configuration_id (String)

    The identifier of the configuration to be updated.



184
185
186
187
188
189
190
191
192
193
194
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 184

def initialize(version, configuration_id)
    super(version)

    # Path Solution
    @solution = { configuration_id: configuration_id,  }
    @uri = "/authentix/v1/configurations/#{@solution[:configuration_id]}"

    # Dependents
    @authentication_control_items = nil
    @authentication_items = nil
end

Instance Method Details

#authentication_control_itemsAuthenticationControlItemList, AuthenticationControlItemContext

Access the authentication_control_items

Returns:



279
280
281
282
283
284
285
286
287
288
289
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 279

def authentication_control_items
  unless @authentication_control_items
    @authentication_control_items = AuthenticationControlItemList.new(
            @version,
            configuration_id: @solution[:configuration_id]
            
            )
  end

  @authentication_control_items
end

#authentication_items(authentication_id = :unset) ⇒ AuthenticationItemList, AuthenticationItemContext

Access the authentication_items

Returns:

Raises:

  • (ArgumentError)


294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 294

def authentication_items(authentication_id=:unset)

    raise ArgumentError, 'authentication_id cannot be nil' if authentication_id.nil?

    if authentication_id != :unset
        return AuthenticationItemContext.new(@version, @solution[:configuration_id],authentication_id )
    end

    unless @authentication_items
        @authentication_items = AuthenticationItemList.new(
            @version,
            configuration_id: @solution[:configuration_id]
            
            )
    end

 @authentication_items
end

#deleteBoolean

Delete the ConfigurationItemInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



198
199
200
201
202
203
204
205
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 198

def delete

    baseParams = {
    }
    
    
    @version.delete('DELETE', @uri)
end

#fetchConfigurationItemInstance

Fetch the ConfigurationItemInstance

Returns:



210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 210

def fetch

    baseParams = {
    }
    
    
    payload = @version.fetch('GET', @uri)
    ConfigurationItemInstance.new(
        @version,
        payload,
        configuration_id: @solution[:configuration_id],
    )
end

#inspectObject

Provide a detailed, user friendly representation



322
323
324
325
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 322

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Reach.Api.Authentix.ConfigurationItemContext #{context}>"
end

#to_sObject

Provide a user friendly representation



315
316
317
318
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 315

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Reach.Api.Authentix.ConfigurationItemContext #{context}>"
end

#update(service_name: :unset, code_length: :unset, allow_custom_code: :unset, used_for_digital_payment: :unset, default_expiry_time: :unset, default_max_trials: :unset, default_max_controls: :unset, smtp_setting_id: :unset, email_template_id: :unset, sms_template_id: :unset) ⇒ ConfigurationItemInstance

Update the ConfigurationItemInstance

Parameters:

  • service_name (String) (defaults to: :unset)

    The name of the authentication service attached to this configuration. It can be up to 40 characters long.

  • code_length (String) (defaults to: :unset)

    The length of the code to be generated. It must be a value between 4 and 10, inclusive.

  • allow_custom_code (Boolean) (defaults to: :unset)

    A flag indicating if the configuration should allow sending custom and non-generated code.

  • used_for_digital_payment (Boolean) (defaults to: :unset)

    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.

  • default_expiry_time (String) (defaults to: :unset)

    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.

  • default_max_trials (String) (defaults to: :unset)

    It represents the maximum number of trials per authentication.

  • default_max_controls (String) (defaults to: :unset)

    It represents the maximum number of code controls per authentication. It must be between 1 and 6 inclusive.

  • smtp_setting_id (String) (defaults to: :unset)

    This is the ID of the SMTP settings used by this configuration. It is mandatory for sending authentication codes via email.

  • email_template_id (String) (defaults to: :unset)

    This is the ID of the default email template to use for sending authenetication codes via email.

  • sms_template_id (String) (defaults to: :unset)

    This is the ID of the default sms template to use for sending authenetication codes via sms.

Returns:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/reach-ruby/rest/api/authentix/configuration_item.rb', line 237

def update(
    service_name: :unset, 
    code_length: :unset, 
    allow_custom_code: :unset, 
    used_for_digital_payment: :unset, 
    default_expiry_time: :unset, 
    default_max_trials: :unset, 
    default_max_controls: :unset, 
    smtp_setting_id: :unset, 
    email_template_id: :unset, 
    sms_template_id: :unset
)

    baseParams = {
    }
    data = Reach::Values.of(baseParams.merge({                        
        'serviceName' => service_name,
        'codeLength' => code_length,
        'allowCustomCode' => allow_custom_code,
        'usedForDigitalPayment' => used_for_digital_payment,
        'defaultExpiryTime' => default_expiry_time,
        'defaultMaxTrials' => default_max_trials,
        'defaultMaxControls' => default_max_controls,
        'smtpSettingId' => smtp_setting_id,
        'emailTemplateId' => email_template_id,
        'smsTemplateId' => sms_template_id,
    }))

    
    
    payload = @version.update('POST', @uri, data: data)
    ConfigurationItemInstance.new(
        @version,
        payload,
        configuration_id: @solution[:configuration_id],
    )
end