Class: Preneeds::FullName

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

Overview

Models a full name for persons included in a BurialForm form

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#as_json

Methods included from Vets::Model

#attributes, #initialize, #nested_attributes

Methods included from Vets::Attributes

included

Instance Attribute Details

#firstString

Returns first name.

Returns:

  • (String)

    first name



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/models/preneeds/full_name.rb', line 17

class FullName < Preneeds::Base
  attribute :first, String
  attribute :last, String
  attribute :maiden, String
  attribute :middle, String
  attribute :suffix, String

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      firstName: first, lastName: last, maidenName: maiden,
      middleName: middle, suffix:
    }

    %i[maidenName middleName suffix].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    %i[first last maiden middle suffix]
  end
end

#lastString

Returns last name.

Returns:

  • (String)

    last name



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/models/preneeds/full_name.rb', line 17

class FullName < Preneeds::Base
  attribute :first, String
  attribute :last, String
  attribute :maiden, String
  attribute :middle, String
  attribute :suffix, String

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      firstName: first, lastName: last, maidenName: maiden,
      middleName: middle, suffix:
    }

    %i[maidenName middleName suffix].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    %i[first last maiden middle suffix]
  end
end

#maidenString

Returns maiden name.

Returns:

  • (String)

    maiden name



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/models/preneeds/full_name.rb', line 17

class FullName < Preneeds::Base
  attribute :first, String
  attribute :last, String
  attribute :maiden, String
  attribute :middle, String
  attribute :suffix, String

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      firstName: first, lastName: last, maidenName: maiden,
      middleName: middle, suffix:
    }

    %i[maidenName middleName suffix].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    %i[first last maiden middle suffix]
  end
end

#middleString

Returns middle name.

Returns:

  • (String)

    middle name



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/models/preneeds/full_name.rb', line 17

class FullName < Preneeds::Base
  attribute :first, String
  attribute :last, String
  attribute :maiden, String
  attribute :middle, String
  attribute :suffix, String

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      firstName: first, lastName: last, maidenName: maiden,
      middleName: middle, suffix:
    }

    %i[maidenName middleName suffix].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    %i[first last maiden middle suffix]
  end
end

#suffixString

Returns name suffix.

Returns:

  • (String)

    name suffix



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/models/preneeds/full_name.rb', line 17

class FullName < Preneeds::Base
  attribute :first, String
  attribute :last, String
  attribute :maiden, String
  attribute :middle, String
  attribute :suffix, String

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    hash = {
      firstName: first, lastName: last, maidenName: maiden,
      middleName: middle, suffix:
    }

    %i[maidenName middleName suffix].each { |key| hash.delete(key) if hash[key].blank? }
    hash
  end

  # (see Preneeds::Applicant.permitted_params)
  #
  def self.permitted_params
    %i[first last maiden middle suffix]
  end
end

Class Method Details

.permitted_paramsArray

List of permitted params for use with Strong Parameters

Returns:

  • (Array)

    array of class attributes as symbols



38
39
40
# File 'app/models/preneeds/full_name.rb', line 38

def self.permitted_params
  %i[first last maiden middle suffix]
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



26
27
28
29
30
31
32
33
34
# File 'app/models/preneeds/full_name.rb', line 26

def as_eoas
  hash = {
    firstName: first, lastName: last, maidenName: maiden,
    middleName: middle, suffix:
  }

  %i[maidenName middleName suffix].each { |key| hash.delete(key) if hash[key].blank? }
  hash
end