Class: TokyoMetro::Factory::Generate::Api::TrainOperation::Info

Inherits:
MetaClass::Info::Fundamental show all
Includes:
ClassNameLibrary::Api::TrainOperation
Defined in:
lib/tokyo_metro/factory/generate/api/train_operation/info.rb

Overview

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

Instance Method Summary collapse

Methods inherited from MetaClass::Info::Fundamental

#generate, #initialize, instance_class, process, #to_check_validity?

Constructor Details

This class inherits a constructor from TokyoMetro::Factory::Generate::Api::MetaClass::Info::Fundamental

Instance Method Details

#variables::Array

Info クラスに送る変数のリスト

Returns:

  • (::Array)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tokyo_metro/factory/generate/api/train_operation/info.rb', line 8

def variables
  id = @hash[ "\@id" ]
  dc_date = DateTime.parse( @hash[ "dc:date" ] )
  valid = DateTime.parse( @hash[ "dct:valid" ] )

  operator = @hash[ "odpt:operator" ]

  time_of_origin = DateTime.parse( @hash[ "odpt:timeOfOrigin" ] )

  railway_line = @hash[ "odpt:railway" ]
  info_status = @hash[ "odpt:trainInformationStatus" ]
  info_text = @hash[ "odpt:trainInformationText" ].process_train_operation_text

  [ id , dc_date , valid , operator , time_of_origin , railway_line , info_status , info_text ]
end