class Yoti::DocScan::Session::Create::NotificationConfig

Configures call-back Notifications to some backend endpoint provided by the Relying Business.

Notifications can be configured to notified a client backend of certain events, avoiding the need to poll for the state of the Session.

Public Class Methods

builder() click to toggle source

@return [NotificationConfigBuilder]

# File lib/yoti/doc_scan/session/create/notification_config.rb, line 49
def self.builder
  NotificationConfigBuilder.new
end
new(auth_token, endpoint, topics) click to toggle source

@param [String] auth_token

The authorization token to be included in call-back messages

@param [String] endpoint

The endpoint that notifications should be sent to

@param [Array<String>] topics

The list of topics that should trigger notifications
# File lib/yoti/doc_scan/session/create/notification_config.rb, line 23
def initialize(auth_token, endpoint, topics)
  Validation.assert_is_a(String, auth_token, 'auth_token', true)
  @auth_token = auth_token

  Validation.assert_is_a(String, endpoint, 'endpoint', true)
  @endpoint = endpoint

  Validation.assert_is_a(Array, topics, 'auth_token', true)
  @topics = topics.uniq unless topics.nil?
end

Public Instance Methods

as_json(*_args) click to toggle source
# File lib/yoti/doc_scan/session/create/notification_config.rb, line 38
def as_json(*_args)
  {
    auth_token: @auth_token,
    endpoint: @endpoint,
    topics: @topics
  }.compact
end
to_json(*_args) click to toggle source
# File lib/yoti/doc_scan/session/create/notification_config.rb, line 34
def to_json(*_args)
  as_json.to_json
end