class FactoryHelper::Address

Public Class Methods

building_number() click to toggle source
# File lib/factory-helper/address.rb, line 23
def building_number
  bothify(fetch('address.building_number'))
end
city() click to toggle source
# File lib/factory-helper/address.rb, line 7
def city
  parse('address.city')
end
city_prefix() click to toggle source
# File lib/factory-helper/address.rb, line 44
def city_prefix;   fetch('address.city_prefix');   end
city_suffix() click to toggle source
# File lib/factory-helper/address.rb, line 43
def city_suffix;   fetch('address.city_suffix');   end
country() click to toggle source
# File lib/factory-helper/address.rb, line 47
def country;       fetch('address.country');       end
country_code() click to toggle source
# File lib/factory-helper/address.rb, line 48
def country_code;  fetch('address.country_code');  end
latitude() click to toggle source
# File lib/factory-helper/address.rb, line 50
def latitude
  ((FactoryHelper::Config.random.rand * 180) - 90).to_s
end
longitude() click to toggle source
# File lib/factory-helper/address.rb, line 54
def longitude
  ((FactoryHelper::Config.random.rand * 360) - 180).to_s
end
postcode(state_abbreviation = '')
Alias for: zip_code
secondary_address() click to toggle source
# File lib/factory-helper/address.rb, line 19
def secondary_address
  numerify(fetch('address.secondary_address'))
end
state() click to toggle source
# File lib/factory-helper/address.rb, line 46
def state;         fetch('address.state');         end
state_abbr() click to toggle source
# File lib/factory-helper/address.rb, line 45
def state_abbr;    fetch('address.state_abbr');    end
street_address(include_secondary = false) click to toggle source
# File lib/factory-helper/address.rb, line 15
def street_address(include_secondary = false)
  numerify(parse('address.street_address') + (include_secondary ? ' ' + secondary_address : ''))
end
street_name() click to toggle source
# File lib/factory-helper/address.rb, line 11
def street_name
  parse('address.street_name')
end
street_suffix() click to toggle source
# File lib/factory-helper/address.rb, line 42
def street_suffix; fetch('address.street_suffix'); end
time_zone() click to toggle source
# File lib/factory-helper/address.rb, line 35
def time_zone
  fetch('address.time_zone')
end
zip(state_abbreviation = '')
Alias for: zip_code
zip_code(state_abbreviation = '') click to toggle source
# File lib/factory-helper/address.rb, line 27
def zip_code(state_abbreviation = '')
  return bothify(fetch('address.postcode')) if state_abbreviation === ''

  # provide a zip code that is valid for the state provided
  # see http://www.fincen.gov/forms/files/us_state_territory_zip_codes.pdf
  bothify(fetch('address.postcode_by_state.' + state_abbreviation))
end
Also aliased as: zip, postcode