Class: Locality::Postnummerservice::State

Inherits:
Object
  • Object
show all
Includes:
Collection
Defined in:
lib/locality/postnummerservice/state.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Collection

#aregion_codes, #city_names, #initialize, #province_codes, #province_names, #state_codes, #state_names, #zip_codes

Class Method Details

.codesObject



10
11
12
13
# File 'lib/locality/postnummerservice/state.rb', line 10

def self.codes
  array = backend.map { |code, entries| [code, entries.first.state_name] }.sort
  Hash[*array.flatten]
end

Instance Method Details

#codeObject



15
16
17
# File 'lib/locality/postnummerservice/state.rb', line 15

def code
  raw_code.to_i
end

#nameObject



19
20
21
# File 'lib/locality/postnummerservice/state.rb', line 19

def name
  state_names.first
end