Class: HealthcarePhony::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/healthcare_phony/address.rb

Overview

Public: Generates a fake Address

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**init_args) ⇒ Address

Public: Initializes an Address. Pass in hash of different parameters, currently this includes: blank - An integer representing the % of times Address components should be blank. state - Allows specification of the Address state instead of randomly being chosen. country - Allows specification of the Address country. Is blank by default. address_type - Allows specification of the Address type. address_type_data_file - YAML file containing address types to randomly choose from if different options than those that come with gem are desired. See address_type.yml



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/healthcare_phony/address.rb', line 16

def initialize(**init_args)
  @set_blank = !init_args[:blank].nil? && Helper.random_with_blank('X', init_args[:blank]) == ''
  @state = init_args[:state]
  @country = init_args[:country]
  @address_type_data_file = init_args[:address_type_data_file]
  @address_type = init_args[:address_type]
  define_address_line1
  define_address_line2
  define_city
  define_state
  define_postal_code
  define_country
  define_address_type
end

Instance Attribute Details

#address_line1Object

Returns the value of attribute address_line1.



6
7
8
# File 'lib/healthcare_phony/address.rb', line 6

def address_line1
  @address_line1
end

#address_line2Object

Returns the value of attribute address_line2.



6
7
8
# File 'lib/healthcare_phony/address.rb', line 6

def address_line2
  @address_line2
end

#address_typeObject

Returns the value of attribute address_type.



6
7
8
# File 'lib/healthcare_phony/address.rb', line 6

def address_type
  @address_type
end

#cityObject

Returns the value of attribute city.



6
7
8
# File 'lib/healthcare_phony/address.rb', line 6

def city
  @city
end

#countryObject

Returns the value of attribute country.



6
7
8
# File 'lib/healthcare_phony/address.rb', line 6

def country
  @country
end

#postal_codeObject

Returns the value of attribute postal_code.



6
7
8
# File 'lib/healthcare_phony/address.rb', line 6

def postal_code
  @postal_code
end

#stateObject

Returns the value of attribute state.



6
7
8
# File 'lib/healthcare_phony/address.rb', line 6

def state
  @state
end