Class: TokyoMetro::Api::StationFacility
- Inherits:
-
MetaClass::NotRealTime
- Object
- MetaClass::Fundamental
- MetaClass::DataSearch
- MetaClass::NotRealTime
- TokyoMetro::Api::StationFacility
- Includes:
- ClassNameLibrary::Api::StationFacility
- Defined in:
- lib/tokyo_metro/api/station_facility.rb
Overview
Note:
駅の施設に関する情報を記述する。
駅施設情報 odpt:StationFacility を扱うクラス
Defined Under Namespace
クラスメソッド - データの取得・保存 collapse
-
.get(http_client, id_urn: nil, same_as: nil, parse_json: false, generate_instance: false, to_inspect: false) ⇒ ::Array
駅施設情報を取得するメソッド.
-
.save(http_client, filename, file_type: :yaml, id_urn: nil, same_as: nil, to_inspect: false) ⇒ nil
駅施設情報を取得し保存するメソッド.
テスト collapse
-
.get_test(http_client, station) ⇒ nil
データ取得のテスト.
Methods inherited from MetaClass::Fundamental
factory_for_generating_from_saved_file
Class Method Details
.get(http_client, id_urn: nil, same_as: nil, parse_json: false, generate_instance: false, to_inspect: false) ⇒ ::Array
駅施設情報を取得するメソッド
18 19 20 21 22 23 24 |
# File 'lib/tokyo_metro/api/station_facility.rb', line 18 def self.get( http_client , id_urn: nil , same_as: nil , parse_json: false , generate_instance: false , to_inspect: false ) factory_for_getting.process( http_client , id_urn , same_as , parse_json , generate_instance , to_inspect ) end |
.get_test(http_client, station) ⇒ nil
データ取得のテスト
57 58 59 60 61 62 63 64 65 |
# File 'lib/tokyo_metro/api/station_facility.rb', line 57 def self.get_test( http_client , station ) puts "● Station Facility" station = "odpt.StationFacility:#{station}" facility_ary = get( http_client , same_as: station , to_inspect: true , parse_json: true , generate_instance: true ) facility_ary.each do | facility | puts facility.to_strf puts "" * 2 end end |
.save(http_client, filename, file_type: :yaml, id_urn: nil, same_as: nil, to_inspect: false) ⇒ nil
駅施設情報を取得し保存するメソッド
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tokyo_metro/api/station_facility.rb', line 33 def self.save( http_client , filename , file_type: :yaml , id_urn: nil , same_as: nil , to_inspect: false ) data = get( http_client , id_urn: id_urn , same_as: same_as , parse_json: true , generate_instance: false , to_inspect: to_inspect ) data = eval( data.to_s.gsub( /(?:\r\n|\r)/ ,"\n" ).encode( "UTF-8" ) ) save_data( data , filename , file_type: file_type ) end |