Class: Yoti::DocScan::Session::Create::SdkConfigBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/yoti/doc_scan/session/create/sdk_config.rb

Overview

Builder to assist in the creation of SdkConfig.

Instance Method Summary collapse

Constructor Details

#initializeSdkConfigBuilder

Returns a new instance of SdkConfigBuilder.



82
83
84
# File 'lib/yoti/doc_scan/session/create/sdk_config.rb', line 82

def initialize
  @topics = []
end

Instance Method Details

#buildSdkConfig

Returns:



205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/yoti/doc_scan/session/create/sdk_config.rb', line 205

def build
  SdkConfig.new(
    @allowed_capture_methods,
    @primary_colour,
    @secondary_colour,
    @font_colour,
    @locale,
    @preset_issuing_country,
    @success_url,
    @error_url
  )
end

#with_allowed_capture_methods(allowed_capture_methods) ⇒ self

Sets the allowed capture method

Parameters:

  • allowed_capture_methods (String)

Returns:

  • (self)


111
112
113
114
# File 'lib/yoti/doc_scan/session/create/sdk_config.rb', line 111

def with_allowed_capture_methods(allowed_capture_methods)
  @allowed_capture_methods = allowed_capture_methods
  self
end

#with_allows_cameraself

Sets the allowed capture method to “CAMERA”

Returns:

  • (self)


91
92
93
# File 'lib/yoti/doc_scan/session/create/sdk_config.rb', line 91

def with_allows_camera
  with_allowed_capture_methods(Constants::CAMERA)
end

#with_allows_camera_and_uploadself

Sets the allowed capture method to “CAMERA_AND_UPLOAD”

Returns:

  • (self)


100
101
102
# File 'lib/yoti/doc_scan/session/create/sdk_config.rb', line 100

def with_allows_camera_and_upload
  with_allowed_capture_methods(Constants::CAMERA_AND_UPLOAD)
end

#with_error_url(error_url) ⇒ self

Sets the error URL for the redirect that follows the web/native client uploading documents unsuccessfully

Parameters:

  • error_url (String)

Returns:

  • (self)


197
198
199
200
# File 'lib/yoti/doc_scan/session/create/sdk_config.rb', line 197

def with_error_url(error_url)
  @error_url = error_url
  self
end

#with_font_colour(font_colour) ⇒ self

Sets the font colour to be used by the web/native client (used on the button)

Parameters:

  • font_colour (String)

Returns:

  • (self)


147
148
149
150
# File 'lib/yoti/doc_scan/session/create/sdk_config.rb', line 147

def with_font_colour(font_colour)
  @font_colour = font_colour
  self
end

#with_locale(locale) ⇒ self

Sets the locale on the builder

Parameters:

  • locale (String)

Returns:

  • (self)


159
160
161
162
# File 'lib/yoti/doc_scan/session/create/sdk_config.rb', line 159

def with_locale(locale)
  @locale = locale
  self
end

#with_preset_issuing_country(preset_issuing_country) ⇒ self

Sets the preset issuing country on the builder

Parameters:

  • preset_issuing_country (String)

Returns:

  • (self)


171
172
173
174
# File 'lib/yoti/doc_scan/session/create/sdk_config.rb', line 171

def with_preset_issuing_country(preset_issuing_country)
  @preset_issuing_country = preset_issuing_country
  self
end

#with_primary_colour(primary_colour) ⇒ self

Sets the primary colour to be used by the web/native client

Parameters:

  • primary_colour (String)

Returns:

  • (self)


123
124
125
126
# File 'lib/yoti/doc_scan/session/create/sdk_config.rb', line 123

def with_primary_colour(primary_colour)
  @primary_colour = primary_colour
  self
end

#with_secondary_colour(secondary_colour) ⇒ self

Sets the secondary colour to be used by the web/native client (used on the button)

Parameters:

  • secondary_colour (String)

Returns:

  • (self)


135
136
137
138
# File 'lib/yoti/doc_scan/session/create/sdk_config.rb', line 135

def with_secondary_colour(secondary_colour)
  @secondary_colour = secondary_colour
  self
end

#with_success_url(success_url) ⇒ self

Sets the success URL for the redirect that follows the web/native client uploading documents successfully

Parameters:

  • success_url (String)

Returns:

  • (self)


184
185
186
187
# File 'lib/yoti/doc_scan/session/create/sdk_config.rb', line 184

def with_success_url(success_url)
  @success_url = success_url
  self
end