Class: RailFeeds::NetworkRail::Schedule::Fetcher
- Inherits:
-
Object
- Object
- RailFeeds::NetworkRail::Schedule::Fetcher
- Includes:
- Logging
- Defined in:
- lib/rail_feeds/network_rail/schedule/fetcher.rb
Overview
A class for fetching the schedule data files.
Instance Method Summary collapse
-
#download_all_full(format, file) ⇒ Object
Download the full schedule.
-
#download_all_update(day, format, file) ⇒ Object
Download the daily update to the full schedule.
-
#download_freight_full(file) ⇒ Object
Fetch the freight schedule.
-
#download_freight_update(day, file) ⇒ Object
Fetch the daily update to the freight schedule.
-
#download_toc_full(toc, file) ⇒ Object
Fetch the schedule for a TOC.
-
#download_toc_update(toc, day, file) ⇒ Object
Fetch the daily update for a TOC.
-
#fetch_all_full(format) {|file| ... } ⇒ Object
Fetch the full schedule.
-
#fetch_all_update(day, format) {|file| ... } ⇒ Object
Fetch the daily update to the full schedule.
-
#fetch_freight_full {|file| ... } ⇒ Object
Fetch the freight schedule.
-
#fetch_freight_update(day) {|file| ... } ⇒ Object
Fetch the daily update to the freight schedule.
-
#fetch_toc_full(toc) {|file| ... } ⇒ Object
Fetch the schedule for a TOC.
-
#fetch_toc_update(toc, day) {|file| ... } ⇒ Object
Fetch the daily update for a TOC.
-
#initialize(credentials: Credentials, logger: nil) ⇒ Fetcher
constructor
Initialize a new schedule.
Methods included from Logging
formatter, included, #logger, logger, #logger=, logger=
Constructor Details
#initialize(credentials: Credentials, logger: nil) ⇒ Fetcher
Initialize a new schedule
15 16 17 18 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 15 def initialize(credentials: Credentials, logger: nil) @credentials = credentials self.logger = logger unless logger.nil? end |
Instance Method Details
#download_all_full(format, file) ⇒ Object
Download the full schedule.
25 26 27 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 25 def download_all_full(format, file) download 'ALL', 'full', format, file end |
#download_all_update(day, format, file) ⇒ Object
Download the daily update to the full schedule.
37 38 39 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 37 def download_all_update(day, format, file) download 'ALL', day, format, file end |
#download_freight_full(file) ⇒ Object
Fetch the freight schedule.
44 45 46 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 44 def download_freight_full(file) download 'FREIGHT', 'full', :json, file end |
#download_freight_update(day, file) ⇒ Object
Fetch the daily update to the freight schedule.
54 55 56 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 54 def download_freight_update(day, file) download 'FREIGHT', day, :json, file end |
#download_toc_full(toc, file) ⇒ Object
Fetch the schedule for a TOC.
63 64 65 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 63 def download_toc_full(toc, file) download toc, 'full', :json, file end |
#download_toc_update(toc, day, file) ⇒ Object
Fetch the daily update for a TOC.
75 76 77 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 75 def download_toc_update(toc, day, file) download toc, day, :json, file end |
#fetch_all_full(format) {|file| ... } ⇒ Object
Fetch the full schedule.
84 85 86 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 84 def fetch_all_full(format, &block) fetch 'ALL', 'full', format, &block end |
#fetch_all_update(day, format) {|file| ... } ⇒ Object
Fetch the daily update to the full schedule.
96 97 98 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 96 def fetch_all_update(day, format, &block) fetch 'ALL', day, format, &block end |
#fetch_freight_full {|file| ... } ⇒ Object
Fetch the freight schedule.
103 104 105 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 103 def fetch_freight_full(&block) fetch 'FREIGHT', 'full', :json, &block end |
#fetch_freight_update(day) {|file| ... } ⇒ Object
Fetch the daily update to the freight schedule.
113 114 115 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 113 def fetch_freight_update(day, &block) fetch 'FREIGHT', day, :json, &block end |
#fetch_toc_full(toc) {|file| ... } ⇒ Object
Fetch the schedule for a TOC.
122 123 124 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 122 def fetch_toc_full(toc, &block) fetch toc, 'full', :json, &block end |
#fetch_toc_update(toc, day) {|file| ... } ⇒ Object
Fetch the daily update for a TOC.
134 135 136 |
# File 'lib/rail_feeds/network_rail/schedule/fetcher.rb', line 134 def fetch_toc_update(toc, day, &block) fetch toc, day, :json, &block end |