Class: Pumi::Location

Inherits:
Struct
  • Object
show all
Defined in:
lib/pumi/location.rb

Direct Known Subclasses

Commune, District, Province, Village

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Location

Returns a new instance of Location.



42
43
44
45
# File 'lib/pumi/location.rb', line 42

def initialize(attributes)
  @attributes = attributes
  super
end

Class Attribute Details

.data_store_keyObject

Returns the value of attribute data_store_key.



17
18
19
# File 'lib/pumi/location.rb', line 17

def data_store_key
  @data_store_key
end

Instance Attribute Details

#address_enObject

Returns the value of attribute address_en

Returns:

  • (Object)

    the current value of address_en



2
3
4
# File 'lib/pumi/location.rb', line 2

def address_en
  @address_en
end

#address_kmObject

Returns the value of attribute address_km

Returns:

  • (Object)

    the current value of address_km



2
3
4
# File 'lib/pumi/location.rb', line 2

def address_km
  @address_km
end

#address_latinObject

Returns the value of attribute address_latin

Returns:

  • (Object)

    the current value of address_latin



2
3
4
# File 'lib/pumi/location.rb', line 2

def address_latin
  @address_latin
end

#administrative_unitObject

Returns the value of attribute administrative_unit

Returns:

  • (Object)

    the current value of administrative_unit



2
3
4
# File 'lib/pumi/location.rb', line 2

def administrative_unit
  @administrative_unit
end

#attributesObject

Returns the value of attribute attributes.



40
41
42
# File 'lib/pumi/location.rb', line 40

def attributes
  @attributes
end

#communeObject

Returns the value of attribute commune

Returns:

  • (Object)

    the current value of commune



2
3
4
# File 'lib/pumi/location.rb', line 2

def commune
  @commune
end

#commune_idObject

Returns the value of attribute commune_id

Returns:

  • (Object)

    the current value of commune_id



2
3
4
# File 'lib/pumi/location.rb', line 2

def commune_id
  @commune_id
end

#districtObject

Returns the value of attribute district

Returns:

  • (Object)

    the current value of district



2
3
4
# File 'lib/pumi/location.rb', line 2

def district
  @district
end

#district_idObject

Returns the value of attribute district_id

Returns:

  • (Object)

    the current value of district_id



2
3
4
# File 'lib/pumi/location.rb', line 2

def district_id
  @district_id
end

#full_name_enObject

Returns the value of attribute full_name_en

Returns:

  • (Object)

    the current value of full_name_en



2
3
4
# File 'lib/pumi/location.rb', line 2

def full_name_en
  @full_name_en
end

#full_name_kmObject

Returns the value of attribute full_name_km

Returns:

  • (Object)

    the current value of full_name_km



2
3
4
# File 'lib/pumi/location.rb', line 2

def full_name_km
  @full_name_km
end

#full_name_latinObject

Returns the value of attribute full_name_latin

Returns:

  • (Object)

    the current value of full_name_latin



2
3
4
# File 'lib/pumi/location.rb', line 2

def full_name_latin
  @full_name_latin
end

#full_name_ungegnObject

Returns the value of attribute full_name_ungegn

Returns:

  • (Object)

    the current value of full_name_ungegn



2
3
4
# File 'lib/pumi/location.rb', line 2

def full_name_ungegn
  @full_name_ungegn
end

#geodataObject

Returns the value of attribute geodata

Returns:

  • (Object)

    the current value of geodata



2
3
4
# File 'lib/pumi/location.rb', line 2

def geodata
  @geodata
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



2
3
4
# File 'lib/pumi/location.rb', line 2

def id
  @id
end

#iso3166_2Object

Returns the value of attribute iso3166_2

Returns:

  • (Object)

    the current value of iso3166_2



2
3
4
# File 'lib/pumi/location.rb', line 2

def iso3166_2
  @iso3166_2
end

Returns the value of attribute links

Returns:

  • (Object)

    the current value of links



2
3
4
# File 'lib/pumi/location.rb', line 2

def links
  @links
end

#name_enObject

Returns the value of attribute name_en

Returns:

  • (Object)

    the current value of name_en



2
3
4
# File 'lib/pumi/location.rb', line 2

def name_en
  @name_en
end

#name_kmObject

Returns the value of attribute name_km

Returns:

  • (Object)

    the current value of name_km



2
3
4
# File 'lib/pumi/location.rb', line 2

def name_km
  @name_km
end

#name_latinObject

Returns the value of attribute name_latin

Returns:

  • (Object)

    the current value of name_latin



2
3
4
# File 'lib/pumi/location.rb', line 2

def name_latin
  @name_latin
end

#name_ungegnObject

Returns the value of attribute name_ungegn

Returns:

  • (Object)

    the current value of name_ungegn



2
3
4
# File 'lib/pumi/location.rb', line 2

def name_ungegn
  @name_ungegn
end

#provinceObject

Returns the value of attribute province

Returns:

  • (Object)

    the current value of province



2
3
4
# File 'lib/pumi/location.rb', line 2

def province
  @province
end

#province_idObject

Returns the value of attribute province_id

Returns:

  • (Object)

    the current value of province_id



2
3
4
# File 'lib/pumi/location.rb', line 2

def province_id
  @province_id
end

#village_idObject

Returns the value of attribute village_id

Returns:

  • (Object)

    the current value of village_id



2
3
4
# File 'lib/pumi/location.rb', line 2

def village_id
  @village_id
end

Class Method Details

.allObject



19
20
21
# File 'lib/pumi/location.rb', line 19

def all
  data.values
end

.find_by_id(id) ⇒ Object



23
24
25
# File 'lib/pumi/location.rb', line 23

def find_by_id(id)
  data[id]
end

.where(params) ⇒ Object



27
28
29
30
31
# File 'lib/pumi/location.rb', line 27

def where(params)
  data.values.select do |location|
    (params.transform_keys(&:to_s).to_a - location.attributes.transform_keys(&:to_s).to_a).empty?
  end
end