Class: TokyoMetro::Api::StationFacility::Info

Overview

個別の駅施設情報を扱うクラス

Defined Under Namespace

Modules: Platform Classes: BarrierFree

Instance Attribute Summary collapse

Attributes inherited from MetaClass::Fundamental::Info

#id_urn

Instance Method Summary collapse

Methods included from Modules::Common::ToFactory::Seed::Info

#seed

Methods included from Modules::Api::Info::ToJson

#to_json

Constructor Details

#initialize(id_urn, same_as, barrier_free_facilities, platform_infos, dc_date) ⇒ Info

Constructor



10
11
12
13
14
15
16
17
18
# File 'lib/tokyo_metro/api/station_facility/info.rb', line 10

def initialize( id_urn , same_as , barrier_free_facilities , platform_infos , dc_date )
  @id_urn = id_urn
  @same_as = same_as

  @barrier_free_facilities = barrier_free_facilities
  @platform_infos = platform_infos

  @dc_date = dc_date
end

Instance Attribute Details

#barrier_free_facilitiesBarrierFreeFacilitry::List (readonly)

駅の施設一覧 - (ug:SpatialThing) odpt:barrierfreeFacility

Returns:

  • (BarrierFreeFacilitry::List)


27
28
29
# File 'lib/tokyo_metro/api/station_facility/info.rb', line 27

def barrier_free_facilities
  @barrier_free_facilities
end

#dc_dateObject (readonly)

TODO:

定義されているのか?



34
35
36
# File 'lib/tokyo_metro/api/station_facility/info.rb', line 34

def dc_date
  @dc_date
end

#platform_infosPlatform::List (readonly)

プラットフォームに車両が停車している時の、車両毎の最寄りの施設・出口等の情報 - Array (ug:SpatialThing) odpt:platformInformation

Returns:



31
32
33
# File 'lib/tokyo_metro/api/station_facility/info.rb', line 31

def platform_infos
  @platform_infos
end

#same_asString (readonly)

Note:

命名ルールは「odpt.StationFacility:TokyoMetro.駅名」

固有識別子 - URL

Returns:

  • (String)


23
24
25
# File 'lib/tokyo_metro/api/station_facility/info.rb', line 23

def same_as
  @same_as
end

Instance Method Details

#instance_in_dbObject



70
71
72
# File 'lib/tokyo_metro/api/station_facility/info.rb', line 70

def instance_in_db
  ::StationFacility::Info.find_by_same_as( @same_as )
end

#seed_barrier_free_facilities(indent) ⇒ Object



57
58
59
# File 'lib/tokyo_metro/api/station_facility/info.rb', line 57

def seed_barrier_free_facilities( indent )
  seed_barrier_free_facilities_or_platform_infos( @barrier_free_facilities , indent )
end

#seed_barrier_free_facilities_or_platform_infos(info, indent) ⇒ Object



65
66
67
68
# File 'lib/tokyo_metro/api/station_facility/info.rb', line 65

def seed_barrier_free_facilities_or_platform_infos( info , indent )
  station_facility_info_id = instance_in_db.id
  info.try( :seed , station_facility_info_id , indent )
end

#seed_platform_infos(indent) ⇒ Object



61
62
63
# File 'lib/tokyo_metro/api/station_facility/info.rb', line 61

def seed_platform_infos( indent )
  seed_barrier_free_facilities_or_platform_infos( @platform_infos , indent )
end

#to_hHash

インスタンスの情報をハッシュにして返すメソッド

Returns:

  • (Hash)


38
39
40
41
42
43
44
45
46
47
48
# File 'lib/tokyo_metro/api/station_facility/info.rb', line 38

def to_h
    h = Hash.new

    set_data_to_hash( h , "\@id" , @id_urn )
    set_data_to_hash( h , "owl:sameAs" , @same_as )
    set_data_to_hash( h , "dc:date" , @dc_date.to_s )
    set_data_to_hash( h , "odpt:barrierfreeFacility" , @barrier_free_facilities )
    set_data_to_hash( h , "odpt:platformInformation" , @platform_infos )

    h
end

#to_strf(indent = 0) ⇒ String

インスタンスの情報を整形した文字列にして返すメソッド

Parameters:

  • indent (Integer (>=0) (defaults to: 0)

    ] インデントの幅

Returns:

  • (String)


53
54
55
# File 'lib/tokyo_metro/api/station_facility/info.rb', line 53

def to_strf( indent = 0 )
  to_s_with_array( [ "odpt:barrierfreeFacility" ,  "odpt:platformInformation" ] , indent )
end