Class: Unit::ApplicationForm::CreateApplicationFormRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/application_form/create_application_form_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tags = nil, applicant_details = nil, allowed_application_types = nil, lang = nil, settings_override = nil, require_id_verification = nil, hide_application_progress_tracker = nil) ⇒ CreateApplicationFormRequest

Returns a new instance of CreateApplicationFormRequest.

Parameters:

  • tags (Hash) (defaults to: nil)
    • optional

  • applicant_details (ApplicationFormPrefill) (defaults to: nil)
    • optional

  • lang (String) (defaults to: nil)
    • optional

  • settings_override (ApplicationFormSettingsOverride) (defaults to: nil)
    • optional

  • require_id_verification (RequireIdVerification) (defaults to: nil)
    • optional

  • hide_application_progress_tracker (Boolean) (defaults to: nil)
    • optional



18
19
20
21
22
23
24
25
26
# File 'lib/unit/models/application_form/create_application_form_request.rb', line 18

def initialize(tags = nil, applicant_details = nil, allowed_application_types = nil, lang = nil, settings_override = nil, require_id_verification = nil, hide_application_progress_tracker = nil)
  @tags = tags
  @applicant_details = applicant_details&.represent
  @allowed_application_types = allowed_application_types
  @lang = lang
  @settings_override = settings_override&.represent
  @require_id_verification = require_id_verification&.represent
  @hide_application_progress_tracker = hide_application_progress_tracker
end

Instance Attribute Details

#allowed_application_typesObject (readonly)

Returns the value of attribute allowed_application_types.



8
9
10
# File 'lib/unit/models/application_form/create_application_form_request.rb', line 8

def allowed_application_types
  @allowed_application_types
end

#applicant_detailsObject (readonly)

Returns the value of attribute applicant_details.



8
9
10
# File 'lib/unit/models/application_form/create_application_form_request.rb', line 8

def applicant_details
  @applicant_details
end

#hide_application_progress_trackerObject (readonly)

Returns the value of attribute hide_application_progress_tracker.



8
9
10
# File 'lib/unit/models/application_form/create_application_form_request.rb', line 8

def hide_application_progress_tracker
  @hide_application_progress_tracker
end

#langObject (readonly)

Returns the value of attribute lang.



8
9
10
# File 'lib/unit/models/application_form/create_application_form_request.rb', line 8

def lang
  @lang
end

#require_id_verificationObject (readonly)

Returns the value of attribute require_id_verification.



8
9
10
# File 'lib/unit/models/application_form/create_application_form_request.rb', line 8

def require_id_verification
  @require_id_verification
end

#settings_overrideObject (readonly)

Returns the value of attribute settings_override.



8
9
10
# File 'lib/unit/models/application_form/create_application_form_request.rb', line 8

def settings_override
  @settings_override
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/application_form/create_application_form_request.rb', line 8

def tags
  @tags
end

Instance Method Details

#to_json_apiObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/unit/models/application_form/create_application_form_request.rb', line 28

def to_json_api
  payload = {
    data: {
      type: "applicationForm",
      attributes: {
        tags: tags,
        applicantDetails: applicant_details,
        allowedApplicationTypes: allowed_application_types,
        lang: lang,
        settingsOverride: settings_override,
        requireIdVerification: require_id_verification,
        hideApplicationProgressTracker: hide_application_progress_tracker
      }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end