Sha256: bb970ba56be564c91aade487a6519c5807af4b2ac3b2d1169e0bc4e3bc832b38

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

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

  include ::TokyoMetro::ClassNameLibrary::Api::RailwayLine
  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" ]
    region = @hash[ "ug:region" ]
    operator = @hash[ "odpt:operator" ]
    railway_line_code = @hash[ "odpt:lineCode" ]
    dc_date = @hash[ "dc:date" ]

    [ id , same_as , title , region , operator , railway_line_code ,
      station_order , travel_time , women_only_car , dc_date ]
  end

  private

  def station_order
    covert_and_set_array_data( "odpt:stationOrder" ,
      ::TokyoMetro::Api::RailwayLine::Info::StationOrder::List , ::TokyoMetro::Api::RailwayLine::Info::StationOrder::Info )
  end

  def travel_time
    covert_and_set_array_data( "odpt:travelTime" ,
      ::TokyoMetro::Api::RailwayLine::Info::TravelTime::List , ::TokyoMetro::Api::RailwayLine::Info::TravelTime::Info )
  end

  def women_only_car
    covert_and_set_array_data( "odpt:womenOnlyCar" ,
      ::TokyoMetro::Api::RailwayLine::Info::WomenOnlyCar::List , ::TokyoMetro::Api::RailwayLine::Info::WomenOnlyCar::Info , to_flatten: true )
  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/railway_line/info.rb