Sha256: 507429daf58d6e50349e8c5b3c74f29542259e01a9f6c753c0fd9052d885a2f3

Contents?: true

Size: 1.77 KB

Versions: 1

Compression:

Stored size: 1.77 KB

Contents

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

  include ::TokyoMetro::ClassNameLibrary::Api::Station
  include ::TokyoMetro::Factory::Generate::Api::MetaClass::Info::ConvertAndSetArrayData::ModuleForMethod

  # Info クラスに送る変数のリスト
  # @return [::Array]
  def variables
    id = @hash[ "\@id" ]
    same_as = @hash[ "owl:sameAs" ]
    title = @hash[ "dc:title" ]
    dc_date = DateTime.parse( @hash[ "dc:date" ] )

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

    operator = @hash[ "odpt:operator" ]
    railway_line = @hash[ "odpt:railway" ]

    facility = @hash[ "odpt:facility" ]

    station_code = @hash[ "odpt:stationCode" ]

    [ id , same_as , title , dc_date , geo_long , geo_lat , region ,
      operator , railway_line , connecting_railway_lines , facility , link_to_passenger_survey , station_code , exit_list ]
  end

  private

  def connecting_railway_lines
    covert_and_set_array_data(
      "odpt:connectingRailway" ,
      ::TokyoMetro::Api::Station::Info::ConnectingRailwayLine::List ,
      ::TokyoMetro::Api::Station::Info::ConnectingRailwayLine::Info
    )
  end

  def link_to_passenger_survey
    covert_and_set_array_data(
      "odpt:passengerSurvey" ,
      ::TokyoMetro::Api::Station::Info::LinkToPassengerSurvey::List ,
      ::TokyoMetro::Api::Station::Info::LinkToPassengerSurvey::Info
    )
  end

  def exit_list
    covert_and_set_array_data(
      "odpt:exit" ,
      ::TokyoMetro::Api::Station::Info::Exit::List ,
      ::TokyoMetro::Api::Station::Info::Exit::Info
    )
  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/station/info.rb