class AddressParameter

This class represents an address in Rosette API.

Attributes

city[RW]

city (optional)

city_district[RW]

city_district (optional)

country[RW]

country (optional)

country_region[RW]

country_region (optional)

entrance[RW]

entrance (optional)

house[RW]

house (optional)

house_number[RW]

house_number (optional)

island[RW]

island (optional)

level[RW]

level (optional)

po_box[RW]

po_box (optional)

post_code[RW]

post_code (optional)

road[RW]

road (optional)

staircase[RW]

staircase (optional)

state[RW]

state (optional)

state_district[RW]

state_district (optional)

suburb[RW]

suburb (optional)

unit[RW]

unit (optional)

world_region[RW]

world_region (optional)

Public Instance Methods

load_param() click to toggle source

Converts this class to Hash with its keys in lower CamelCase.

Returns the new Hash.

# File address_parameter.rb, line 86
def load_param
  to_hash.select { |_key, value| value }
         .transform_keys { |key| key.to_s.split('_').map(&:capitalize).join.sub!(/\D/, &:downcase) }
end
to_hash() click to toggle source

Converts this class to Hash.

Returns the new Hash.

# File address_parameter.rb, line 94
def to_hash
  {
    house: @house,
    house_number: @house_number,
    road: @road,
    unit: @unit,
    level: @level,
    staircase: @staircase,
    entrance: @entrance,
    suburb: @suburb,
    city_district: @city_district,
    city: @city,
    island: @island,
    state_district: @state_district,
    state: @state,
    country_region: @country_region,
    country: @country,
    world_region: @world_region,
    post_code: @post_code,
    po_box: @po_box
  }
end

Protected Instance Methods

initialize(options = {}) click to toggle source
# File address_parameter.rb, line 42
def initialize(options = {}) # :notnew:
  options = {
    house: nil,
    house_number: nil,
    road: nil,
    unit: nil,
    level: nil,
    staircase: nil,
    entrance: nil,
    suburb: nil,
    city_district: nil,
    city: nil,
    island: nil,
    state_district: nil,
    state: nil,
    country_region: nil,
    country: nil,
    world_region: nil,
    post_code: nil,
    po_box: nil
  }.update options
  @house = options[:house]
  @house_number = options[:house_number]
  @road = options[:road]
  @unit = options[:unit]
  @level = options[:level]
  @staircase = options[:staircase]
  @entrance = options[:entrance]
  @suburb = options[:suburb]
  @city_district = options[:city_district]
  @city = options[:city]
  @island = options[:island]
  @state_district = options[:state_district]
  @state = options[:state]
  @country_region = options[:country_region]
  @country = options[:country]
  @world_region = options[:world_region]
  @post_code = options[:post_code]
  @po_box = options[:po_box]
end