Sha256: 5f8e4db8ff6fa542a0f66ccccc28f77faff6b314da763fca86b6a632fa16d25f

Contents?: true

Size: 953 Bytes

Versions: 1

Compression:

Stored size: 953 Bytes

Contents

# API から取得したハッシュからインスタンスを生成するための Factory Pattern のクラス(メタクラス)
class TokyoMetro::Factory::Generate::Api::Point::Info < TokyoMetro::Factory::Generate::Api::MetaClass::Info::Fundamental

  include ::TokyoMetro::ClassNameLibrary::Api::Point

  private

  # Info クラスに送る変数のリスト
  # @return [::Array]
  def variables
    id = @hash[ "\@id" ]

    geo_long = @hash[ "geo:long" ]
    geo_lat = @hash[ "geo:lat" ]
    region = @hash[ "ug:region" ]
    ug_floor = @hash[ "ug:floor" ]

    [ id , title , geo_long , geo_lat , region , ug_floor , category_name ]
  end

  def title
    self.class.title_class.generate_from_hash( @hash[ "dc:title" ] )
  end

  def category_name
    str = @hash[ "ugsrv:categoryName" ]
    unless valid_category_name_ja.include?( str )
      raise "Error"
    end
    str
  end

  def valid_category_name_ja
    [ "出入口" ]
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/factory/generate/api/point/info.rb