class TokyoMetro::Api::StationFacility::Info::BarrierFree::Info

各種施設のメタクラス

Attributes

located_area_name[R]

@return [String] 施設の設置場所(改札内/改札外)

located_area_name_ja[R]

@return [String] 施設の設置場所(改札内/改札外)

place_name[R]

@return [String] 施設の設置されている場所の名前

remark[R]

@return [String] 補足事項

same_as[R]

@return [String] 固有識別子 @note 命名ルールは「odpt.Facility:TokyoMetro.路線名.駅名.改札の内外.カテゴリ名.通し番号」

service_details[R]

@return [ServiceDetail::List] 施設の詳細情報

Public Class Methods

factory_for_seeding_this_class() click to toggle source
# File lib/tokyo_metro/api/station_facility/info/barrier_free/info.rb, line 85
def self.factory_for_seeding_this_class
  factory_for_seeding_barrier_free_facility_info
end
factory_for_this_class() click to toggle source
# File lib/tokyo_metro/api/station_facility/info/barrier_free/info.rb, line 81
def self.factory_for_this_class
  factory_for_generating_barrier_free_info_from_hash
end
new( id_urn , same_as , service_details , place_name , located_area_name , remark ) click to toggle source

Constructor

# File lib/tokyo_metro/api/station_facility/info/barrier_free/info.rb, line 17
def initialize( id_urn , same_as , service_details , place_name , located_area_name , remark )
  @id_urn = id_urn
  @same_as = same_as
  @service_details = service_details
  @place_name = place_name
  @located_area_name = located_area_name
  @remark = remark

  # 利用可能な車いすの情報は、LinkForMobilityScooter, Escalator のクラスメソッドとして定義する。
end

Public Instance Methods

instance_in_db() click to toggle source
# File lib/tokyo_metro/api/station_facility/info/barrier_free/info.rb, line 77
def instance_in_db
  self.class.db_instance_class_of_barrier_free_facility_info.find_by_same_as( @same_as )
end
located_area_name_en() click to toggle source
# File lib/tokyo_metro/api/station_facility/info/barrier_free/info.rb, line 44
def located_area_name_en
  if inside?
    "Inside"
  elsif outside?
    "Outside"
  else
    raise "Error"
  end
end
to_h() click to toggle source

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

# File lib/tokyo_metro/api/station_facility/info/barrier_free/info.rb, line 56
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 , "odpt:serviceDetail" , @service_details )
    set_data_to_hash( h , "odpt:placeName" , @place_name )
    set_data_to_hash( h , "odpt:locatedAreaName" , @located_area_name )
    set_data_to_hash( h , "ugsrv:remark" , @remark )

    set_data_to_hash( h , "ugsrv:categoryName" , self.class.category_name )

    # LinkForMobilityScooter, Escalator クラスのみに関連(他のクラスでは、self.class.spac__is_available_to は nil)
    set_data_to_hash( h , "spac:isAvailableTo" , self.class.spac__is_available_to )

    # Toilet クラスのみに関連(他のクラスでは @has_assistant は定義されないため、@has_assistant は nil を返す)
    set_data_to_hash( h , "spac:hasAssistant" , @has_assistant )

    h
end

Private Instance Methods

seed_service_detail( barrier_free_facility_id ) click to toggle source
# File lib/tokyo_metro/api/station_facility/info/barrier_free/info.rb, line 91
def seed_service_detail( barrier_free_facility_id )
  raise unless barrier_free_facility_id.integer?
  @service_details.try( :seed , barrier_free_facility_id )
end