Class: Preneeds::Address
Overview
Models an address from a BurialForm form
Instance Attribute Summary collapse
-
#city ⇒ String
Address city.
-
#country ⇒ String
Address country.
-
#postal_code ⇒ String
Address postal code.
-
#state ⇒ String
Address state.
-
#street ⇒ String
Address line 1.
-
#street2 ⇒ String
Address line 2.
Class Method Summary collapse
-
.permitted_params ⇒ Array
List of permitted params for use with Strong Parameters.
Instance Method Summary collapse
-
#as_eoas ⇒ Hash
Converts object attributes to a hash to be used when constructing a SOAP request body.
Methods inherited from Base
Methods included from Vets::Model
#attributes, #initialize, #nested_attributes
Methods included from Vets::Attributes
Instance Attribute Details
#city ⇒ String
Returns address city.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/preneeds/address.rb', line 19 class Address < Preneeds::Base attribute :street, String attribute :street2, String attribute :city, String attribute :country, String attribute :state, String attribute :postal_code, String # (see Preneeds::BurialForm#as_eoas) # def as_eoas hash = { address1: street, address2: street2, city:, countryCode: country, postalZip: postal_code, state: state || '' } hash.delete(:address2) if hash[:address2].blank? hash end # (see Preneeds::Applicant.permitted_params) # def self.permitted_params attribute_set.map { |a| a.name.to_sym } end end |
#country ⇒ String
Returns address country.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/preneeds/address.rb', line 19 class Address < Preneeds::Base attribute :street, String attribute :street2, String attribute :city, String attribute :country, String attribute :state, String attribute :postal_code, String # (see Preneeds::BurialForm#as_eoas) # def as_eoas hash = { address1: street, address2: street2, city:, countryCode: country, postalZip: postal_code, state: state || '' } hash.delete(:address2) if hash[:address2].blank? hash end # (see Preneeds::Applicant.permitted_params) # def self.permitted_params attribute_set.map { |a| a.name.to_sym } end end |
#postal_code ⇒ String
Returns address postal code.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/preneeds/address.rb', line 19 class Address < Preneeds::Base attribute :street, String attribute :street2, String attribute :city, String attribute :country, String attribute :state, String attribute :postal_code, String # (see Preneeds::BurialForm#as_eoas) # def as_eoas hash = { address1: street, address2: street2, city:, countryCode: country, postalZip: postal_code, state: state || '' } hash.delete(:address2) if hash[:address2].blank? hash end # (see Preneeds::Applicant.permitted_params) # def self.permitted_params attribute_set.map { |a| a.name.to_sym } end end |
#state ⇒ String
Returns address state.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/preneeds/address.rb', line 19 class Address < Preneeds::Base attribute :street, String attribute :street2, String attribute :city, String attribute :country, String attribute :state, String attribute :postal_code, String # (see Preneeds::BurialForm#as_eoas) # def as_eoas hash = { address1: street, address2: street2, city:, countryCode: country, postalZip: postal_code, state: state || '' } hash.delete(:address2) if hash[:address2].blank? hash end # (see Preneeds::Applicant.permitted_params) # def self.permitted_params attribute_set.map { |a| a.name.to_sym } end end |
#street ⇒ String
Returns address line 1.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/preneeds/address.rb', line 19 class Address < Preneeds::Base attribute :street, String attribute :street2, String attribute :city, String attribute :country, String attribute :state, String attribute :postal_code, String # (see Preneeds::BurialForm#as_eoas) # def as_eoas hash = { address1: street, address2: street2, city:, countryCode: country, postalZip: postal_code, state: state || '' } hash.delete(:address2) if hash[:address2].blank? hash end # (see Preneeds::Applicant.permitted_params) # def self.permitted_params attribute_set.map { |a| a.name.to_sym } end end |
#street2 ⇒ String
Returns address line 2.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/preneeds/address.rb', line 19 class Address < Preneeds::Base attribute :street, String attribute :street2, String attribute :city, String attribute :country, String attribute :state, String attribute :postal_code, String # (see Preneeds::BurialForm#as_eoas) # def as_eoas hash = { address1: street, address2: street2, city:, countryCode: country, postalZip: postal_code, state: state || '' } hash.delete(:address2) if hash[:address2].blank? hash end # (see Preneeds::Applicant.permitted_params) # def self.permitted_params attribute_set.map { |a| a.name.to_sym } end end |
Class Method Details
.permitted_params ⇒ Array
List of permitted params for use with Strong Parameters
41 42 43 |
# File 'app/models/preneeds/address.rb', line 41 def self.permitted_params attribute_set.map { |a| a.name.to_sym } end |
Instance Method Details
#as_eoas ⇒ Hash
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
29 30 31 32 33 34 35 36 37 |
# File 'app/models/preneeds/address.rb', line 29 def as_eoas hash = { address1: street, address2: street2, city:, countryCode: country, postalZip: postal_code, state: state || '' } hash.delete(:address2) if hash[:address2].blank? hash end |