Class: Unit::Types::ApplicationFormPrefill

Inherits:
Object
  • Object
show all
Defined in:
lib/unit-ruby/types/application_form_prefill.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application_type: nil, full_name: nil, ssn: nil, passport: nil, nationality: nil, date_of_birth: nil, email: nil, address: nil, phone: nil) ⇒ ApplicationFormPrefill

Returns a new instance of ApplicationFormPrefill.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/unit-ruby/types/application_form_prefill.rb', line 7

def initialize(
  application_type: nil,
  full_name: nil,
  ssn: nil,
  passport: nil,
  nationality: nil,
  date_of_birth: nil,
  email: nil,
  address: nil,
  phone: nil
)
  @application_type = application_type
  @full_name = full_name
  @ssn = ssn
  @passport = passport
  @nationality = nationality
  @date_of_birth = date_of_birth
  @email = email
  @address = address
  @phone = phone
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



4
5
6
# File 'lib/unit-ruby/types/application_form_prefill.rb', line 4

def address
  @address
end

#application_typeObject (readonly)

Returns the value of attribute application_type.



4
5
6
# File 'lib/unit-ruby/types/application_form_prefill.rb', line 4

def application_type
  @application_type
end

#date_of_birthObject (readonly)

Returns the value of attribute date_of_birth.



4
5
6
# File 'lib/unit-ruby/types/application_form_prefill.rb', line 4

def date_of_birth
  @date_of_birth
end

#emailObject (readonly)

Returns the value of attribute email.



4
5
6
# File 'lib/unit-ruby/types/application_form_prefill.rb', line 4

def email
  @email
end

#full_nameObject (readonly)

Returns the value of attribute full_name.



4
5
6
# File 'lib/unit-ruby/types/application_form_prefill.rb', line 4

def full_name
  @full_name
end

#nationalityObject (readonly)

Returns the value of attribute nationality.



4
5
6
# File 'lib/unit-ruby/types/application_form_prefill.rb', line 4

def nationality
  @nationality
end

#passportObject (readonly)

Returns the value of attribute passport.



4
5
6
# File 'lib/unit-ruby/types/application_form_prefill.rb', line 4

def passport
  @passport
end

#phoneObject (readonly)

Returns the value of attribute phone.



4
5
6
# File 'lib/unit-ruby/types/application_form_prefill.rb', line 4

def phone
  @phone
end

#ssnObject (readonly)

Returns the value of attribute ssn.



4
5
6
# File 'lib/unit-ruby/types/application_form_prefill.rb', line 4

def ssn
  @ssn
end

Class Method Details

.cast(val) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/unit-ruby/types/application_form_prefill.rb', line 29

def self.cast(val)
  return val if val.is_a? self
  return nil if val.nil?

  new(
    application_type: val[:application_type],
    full_name: val[:full_name],
    ssn: val[:ssn],
    passport: val[:passport],
    nationality: val[:nationality],
    date_of_birth: val[:date_of_birth],
    email: val[:email],
    address: val[:address],
    phone: val[:phone]
  )
end

Instance Method Details

#as_json_apiObject



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/unit-ruby/types/application_form_prefill.rb', line 46

def as_json_api
  {
    application_type: application_type,
    full_name: full_name&.as_json_api,
    ssn: ssn,
    passport: passport,
    nationality: nationality,
    date_of_birth: date_of_birth,
    email: email,
    address: address&.as_json_api,
    phone: phone&.as_json_api
  }.compact
end