Class: TokyoMetro::Factory::Seed::Api::StationTrainTime
Overview
Defined Under Namespace
Classes: Checker, TrainInStationTimetable
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of StationTrainTime.
6
7
8
|
# File 'lib/tokyo_metro/factory/seed/api/station_train_time.rb', line 6
def initialize( info )
@info = info
end
|
Class Method Details
.check_chiyoda_line_info_in_db ⇒ Object
.check_number(*symbol_of_railway_lines) ⇒ Object
.compare_chiyoda_line_info_in_db_and_api ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/tokyo_metro/factory/seed/api/station_train_time.rb', line 38
def self.compare_chiyoda_line_info_in_db_and_api
ary = ::Array.new
::TokyoMetro::Api.train_timetables.chiyoda.each do | train_timetable |
train_timetable_instance_in_db = ::TrainTimetable.find_by_same_as( train_timetable.same_as )
if train_timetable_instance_in_db.nil?
raise "Error: The train timetable of \"#{ train_timetable.same_as }\" does not exist in the db."
end
number_of_station_train_times_in_db = train_timetable_instance_in_db.station_train_times.length
number_of_station_train_times_in_api = train_timetable.number_of_station_times
unless number_of_station_train_times_in_db == number_of_station_train_times_in_api
str_ary = [
"\"#{train_timetable.same_as}\"" ,
"(#{train_timetable.train_type})" ,
"---" ,
"in db: #{ number_of_station_train_times_in_db }" ,
"/" ,
"api : #{ number_of_station_train_times_in_api }" ,
diff_to_s( number_of_station_train_times_in_db , number_of_station_train_times_in_api )
]
ary << str_ary.join( " " )
end
end
puts ary
return nil
end
|
.destroy!(*symbol_of_railway_lines) ⇒ Object
.display_railway_line_info_in_db(*symbol_of_railway_lines) ⇒ Object
.process(info) ⇒ Object
18
19
20
|
# File 'lib/tokyo_metro/factory/seed/api/station_train_time.rb', line 18
def self.process( info )
self.new( info ).seed
end
|
Instance Method Details
#seed ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/tokyo_metro/factory/seed/api/station_train_time.rb', line 10
def seed
seed_main
seed_optional_infos
check_validity_after_finish_seeding
return nil
end
|