Class: Jpzip::ZipcodeEntry

Inherits:
Data
  • Object
show all
Defined in:
lib/jpzip/types.rb

Overview

ZipcodeEntry is one logical entry as published by the CDN.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#cityObject (readonly)

Returns the value of attribute city

Returns:

  • (Object)

    the current value of city



27
28
29
# File 'lib/jpzip/types.rb', line 27

def city
  @city
end

#city_codeObject (readonly)

Returns the value of attribute city_code

Returns:

  • (Object)

    the current value of city_code



27
28
29
# File 'lib/jpzip/types.rb', line 27

def city_code
  @city_code
end

#city_kanaObject (readonly)

Returns the value of attribute city_kana

Returns:

  • (Object)

    the current value of city_kana



27
28
29
# File 'lib/jpzip/types.rb', line 27

def city_kana
  @city_kana
end

#city_romaObject (readonly)

Returns the value of attribute city_roma

Returns:

  • (Object)

    the current value of city_roma



27
28
29
# File 'lib/jpzip/types.rb', line 27

def city_roma
  @city_roma
end

#prefectureObject (readonly)

Returns the value of attribute prefecture

Returns:

  • (Object)

    the current value of prefecture



27
28
29
# File 'lib/jpzip/types.rb', line 27

def prefecture
  @prefecture
end

#prefecture_codeObject (readonly)

Returns the value of attribute prefecture_code

Returns:

  • (Object)

    the current value of prefecture_code



27
28
29
# File 'lib/jpzip/types.rb', line 27

def prefecture_code
  @prefecture_code
end

#prefecture_kanaObject (readonly)

Returns the value of attribute prefecture_kana

Returns:

  • (Object)

    the current value of prefecture_kana



27
28
29
# File 'lib/jpzip/types.rb', line 27

def prefecture_kana
  @prefecture_kana
end

#prefecture_romaObject (readonly)

Returns the value of attribute prefecture_roma

Returns:

  • (Object)

    the current value of prefecture_roma



27
28
29
# File 'lib/jpzip/types.rb', line 27

def prefecture_roma
  @prefecture_roma
end

#townsObject (readonly)

Returns the value of attribute towns

Returns:

  • (Object)

    the current value of towns



27
28
29
# File 'lib/jpzip/types.rb', line 27

def towns
  @towns
end

Class Method Details

.from_hash(h) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/jpzip/types.rb', line 38

def self.from_hash(h)
  new(
    prefecture: h["prefecture"] || "",
    prefecture_kana: h["prefecture_kana"] || "",
    prefecture_roma: h["prefecture_roma"] || "",
    prefecture_code: h["prefecture_code"] || "",
    city: h["city"] || "",
    city_kana: h["city_kana"] || "",
    city_roma: h["city_roma"] || "",
    city_code: h["city_code"] || "",
    towns: (h["towns"] || []).map { |t| Town.from_hash(t) }
  )
end