class TokyoMetro::Factory::Generate::Api::Fare::Info

API から取得したハッシュからインスタンスを生成するための Factory Pattern のクラス(メタクラス)

Public Instance Methods

variables() click to toggle source

Info クラスに送る変数のリスト @return [::Array]

# File lib/tokyo_metro/factory/generate/api/fare/info.rb, line 8
def variables
  id = @hash[ "\@id" ]
  same_as = @hash[ "owl:sameAs" ]
  dc_date = DateTime.parse( @hash[ "dc:date" ] )
  operator = @hash[ "odpt:operator" ]
  from_station = @hash[ "odpt:fromStation" ]
  to_station = @hash[ "odpt:toStation" ]

  fares = [ "odpt:ticketFare" , "odpt:childTicketFare" , "odpt:icCardFare" , "odpt:childIcCardFare" ].map { | key | @hash[ key ] }
  normal_fare = ::TokyoMetro::Static.normal_fare.select_fare( *fares )

  [ id , same_as , dc_date , operator , from_station , to_station , normal_fare ]
end