Class: Preneeds::Claimant

Inherits:
Base
  • Object
show all
Defined in:
app/models/preneeds/claimant.rb

Overview

Models an Claimant from a BurialForm form

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#as_json

Instance Attribute Details

#addressPreneeds::Address

Returns claimant’s address.

Returns:



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/models/preneeds/claimant.rb', line 25

class Claimant < Preneeds::Base
  attribute :date_of_birth, String
  attribute :desired_cemetery, String
  attribute :email, String
  attribute :phone_number, String
  attribute :relationship_to_vet, String
  attribute :ssn, String

  attribute :name, Preneeds::FullName
  attribute :address, Preneeds::Address

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      address: address&.as_eoas, dateOfBirth: date_of_birth, desiredCemetery: desired_cemetery,
      email:, name: name&.as_eoas, phoneNumber: phone_number,
      relationshipToVet: relationship_to_vet, ssn:
    }

    %i[email phoneNumber desiredCemetery].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    [
      :date_of_birth, :desired_cemetery, :email, :completing_reason, :phone_number, :relationship_to_vet, :ssn,
      { address: Preneeds::Address.permitted_params, name: Preneeds::FullName.permitted_params }
    ]
  end
end

#date_of_birthString

Returns claimant date of birth.

Returns:

  • (String)

    claimant date of birth



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/models/preneeds/claimant.rb', line 25

class Claimant < Preneeds::Base
  attribute :date_of_birth, String
  attribute :desired_cemetery, String
  attribute :email, String
  attribute :phone_number, String
  attribute :relationship_to_vet, String
  attribute :ssn, String

  attribute :name, Preneeds::FullName
  attribute :address, Preneeds::Address

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      address: address&.as_eoas, dateOfBirth: date_of_birth, desiredCemetery: desired_cemetery,
      email:, name: name&.as_eoas, phoneNumber: phone_number,
      relationshipToVet: relationship_to_vet, ssn:
    }

    %i[email phoneNumber desiredCemetery].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    [
      :date_of_birth, :desired_cemetery, :email, :completing_reason, :phone_number, :relationship_to_vet, :ssn,
      { address: Preneeds::Address.permitted_params, name: Preneeds::FullName.permitted_params }
    ]
  end
end

#desired_cemeteryString

Returns cemetery number.

Returns:

  • (String)

    cemetery number



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/models/preneeds/claimant.rb', line 25

class Claimant < Preneeds::Base
  attribute :date_of_birth, String
  attribute :desired_cemetery, String
  attribute :email, String
  attribute :phone_number, String
  attribute :relationship_to_vet, String
  attribute :ssn, String

  attribute :name, Preneeds::FullName
  attribute :address, Preneeds::Address

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      address: address&.as_eoas, dateOfBirth: date_of_birth, desiredCemetery: desired_cemetery,
      email:, name: name&.as_eoas, phoneNumber: phone_number,
      relationshipToVet: relationship_to_vet, ssn:
    }

    %i[email phoneNumber desiredCemetery].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    [
      :date_of_birth, :desired_cemetery, :email, :completing_reason, :phone_number, :relationship_to_vet, :ssn,
      { address: Preneeds::Address.permitted_params, name: Preneeds::FullName.permitted_params }
    ]
  end
end

#emailString

Returns claimant email.

Returns:

  • (String)

    claimant email



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/models/preneeds/claimant.rb', line 25

class Claimant < Preneeds::Base
  attribute :date_of_birth, String
  attribute :desired_cemetery, String
  attribute :email, String
  attribute :phone_number, String
  attribute :relationship_to_vet, String
  attribute :ssn, String

  attribute :name, Preneeds::FullName
  attribute :address, Preneeds::Address

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      address: address&.as_eoas, dateOfBirth: date_of_birth, desiredCemetery: desired_cemetery,
      email:, name: name&.as_eoas, phoneNumber: phone_number,
      relationshipToVet: relationship_to_vet, ssn:
    }

    %i[email phoneNumber desiredCemetery].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    [
      :date_of_birth, :desired_cemetery, :email, :completing_reason, :phone_number, :relationship_to_vet, :ssn,
      { address: Preneeds::Address.permitted_params, name: Preneeds::FullName.permitted_params }
    ]
  end
end

#namePreneeds::FullName

Returns claimant’s full name.

Returns:



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/models/preneeds/claimant.rb', line 25

class Claimant < Preneeds::Base
  attribute :date_of_birth, String
  attribute :desired_cemetery, String
  attribute :email, String
  attribute :phone_number, String
  attribute :relationship_to_vet, String
  attribute :ssn, String

  attribute :name, Preneeds::FullName
  attribute :address, Preneeds::Address

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      address: address&.as_eoas, dateOfBirth: date_of_birth, desiredCemetery: desired_cemetery,
      email:, name: name&.as_eoas, phoneNumber: phone_number,
      relationshipToVet: relationship_to_vet, ssn:
    }

    %i[email phoneNumber desiredCemetery].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    [
      :date_of_birth, :desired_cemetery, :email, :completing_reason, :phone_number, :relationship_to_vet, :ssn,
      { address: Preneeds::Address.permitted_params, name: Preneeds::FullName.permitted_params }
    ]
  end
end

#phone_numberString

Returns claimant phone number.

Returns:

  • (String)

    claimant phone number



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/models/preneeds/claimant.rb', line 25

class Claimant < Preneeds::Base
  attribute :date_of_birth, String
  attribute :desired_cemetery, String
  attribute :email, String
  attribute :phone_number, String
  attribute :relationship_to_vet, String
  attribute :ssn, String

  attribute :name, Preneeds::FullName
  attribute :address, Preneeds::Address

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      address: address&.as_eoas, dateOfBirth: date_of_birth, desiredCemetery: desired_cemetery,
      email:, name: name&.as_eoas, phoneNumber: phone_number,
      relationshipToVet: relationship_to_vet, ssn:
    }

    %i[email phoneNumber desiredCemetery].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    [
      :date_of_birth, :desired_cemetery, :email, :completing_reason, :phone_number, :relationship_to_vet, :ssn,
      { address: Preneeds::Address.permitted_params, name: Preneeds::FullName.permitted_params }
    ]
  end
end

#relationship_to_vetString

Returns code representing claimant’s relationship to servicemember; one of ‘1’, ‘2’, ‘3’, or ‘4’.

Returns:

  • (String)

    code representing claimant’s relationship to servicemember; one of ‘1’, ‘2’, ‘3’, or ‘4’



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/models/preneeds/claimant.rb', line 25

class Claimant < Preneeds::Base
  attribute :date_of_birth, String
  attribute :desired_cemetery, String
  attribute :email, String
  attribute :phone_number, String
  attribute :relationship_to_vet, String
  attribute :ssn, String

  attribute :name, Preneeds::FullName
  attribute :address, Preneeds::Address

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      address: address&.as_eoas, dateOfBirth: date_of_birth, desiredCemetery: desired_cemetery,
      email:, name: name&.as_eoas, phoneNumber: phone_number,
      relationshipToVet: relationship_to_vet, ssn:
    }

    %i[email phoneNumber desiredCemetery].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    [
      :date_of_birth, :desired_cemetery, :email, :completing_reason, :phone_number, :relationship_to_vet, :ssn,
      { address: Preneeds::Address.permitted_params, name: Preneeds::FullName.permitted_params }
    ]
  end
end

#ssnString

Returns claimant’s social security number.

Returns:

  • (String)

    claimant’s social security number



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/models/preneeds/claimant.rb', line 25

class Claimant < Preneeds::Base
  attribute :date_of_birth, String
  attribute :desired_cemetery, String
  attribute :email, String
  attribute :phone_number, String
  attribute :relationship_to_vet, String
  attribute :ssn, String

  attribute :name, Preneeds::FullName
  attribute :address, Preneeds::Address

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      address: address&.as_eoas, dateOfBirth: date_of_birth, desiredCemetery: desired_cemetery,
      email:, name: name&.as_eoas, phoneNumber: phone_number,
      relationshipToVet: relationship_to_vet, ssn:
    }

    %i[email phoneNumber desiredCemetery].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    [
      :date_of_birth, :desired_cemetery, :email, :completing_reason, :phone_number, :relationship_to_vet, :ssn,
      { address: Preneeds::Address.permitted_params, name: Preneeds::FullName.permitted_params }
    ]
  end
end

Class Method Details

.permitted_paramsArray

List of permitted params for use with Strong Parameters

Returns:

  • (Array)

    array of class attributes as symbols



51
52
53
54
55
56
# File 'app/models/preneeds/claimant.rb', line 51

def self.permitted_params
  [
    :date_of_birth, :desired_cemetery, :email, :completing_reason, :phone_number, :relationship_to_vet, :ssn,
    { address: Preneeds::Address.permitted_params, name: Preneeds::FullName.permitted_params }
  ]
end

Instance Method Details

#as_eoasHash

Converts object attributes to a hash to be used when constructing a SOAP request body. Hash attributes must correspond to XSD ordering or API call will fail

Returns:

  • (Hash)

    object attributes and association objects converted to EOAS service compatible hash



38
39
40
41
42
43
44
45
46
47
# File 'app/models/preneeds/claimant.rb', line 38

def as_eoas
  hash = {
    address: address&.as_eoas, dateOfBirth: date_of_birth, desiredCemetery: desired_cemetery,
    email:, name: name&.as_eoas, phoneNumber: phone_number,
    relationshipToVet: relationship_to_vet, ssn:
  }

  %i[email phoneNumber desiredCemetery].each { |key| hash.delete(key) if hash[key].blank? }
  hash
end