class TokyoMetro::Api::Point::Info

個別の地物情報 ug:Poi のクラス

Attributes

category_name[R]

地物のカテゴリ(必ず「出入口」となる) <ugsrv:categoryName - xsd:string> @return [String]

category_name_ja[R]

地物のカテゴリ(必ず「出入口」となる) <ugsrv:categoryName - xsd:string> @return [String]

floor[R]

地物の階数(高さ情報) <ug:floor - xsd:double> @return [Integer]

geo_json[R]

地物の形状データを GeoJSON で取得するためのURL <ug:region - odpt:GeoDocument> @return [Integer] @note 取得にはアクセストークンの付与が必要

geo_lat[R]

代表点の緯度(10進表記) @return [Float]

geo_long[R]

代表点の経度(10進表記) @return [Float]

latitude[R]

代表点の緯度(10進表記) @return [Float]

longitude[R]

代表点の経度(10進表記) @return [Float]

region[R]

地物の形状データを GeoJSON で取得するためのURL <ug:region - odpt:GeoDocument> @return [Integer] @note 取得にはアクセストークンの付与が必要

title[R]

地物名 <dc:title - xsd:string> @return [String] @note エレベータには「エレベータ」という文字列を含む。「出入口」の文字列の後に出口番号が続く。

Public Class Methods

new( id_urn , title , geo_long , geo_lat , region , ug_floor , category_name ) click to toggle source

Constructor

# File lib/tokyo_metro/api/point/info.rb, line 13
def initialize( id_urn , title , geo_long , geo_lat , region , ug_floor , category_name )
  @id_urn = id_urn

  @title = title
  @geo_long = geo_long
  @geo_lat = geo_lat
  @region = region

  @floor = ug_floor
  @category_name = category_name
end

Public Instance Methods

additional_name() click to toggle source

@!endgroup

# File lib/tokyo_metro/api/point/info.rb, line 92
def additional_name
  _additional_name = @title.additional_name
  if _additional_name.blank?
    nil
  else
    _additional_name
  end
end
Also aliased as: additional_name_ja
additional_name_en() click to toggle source
# File lib/tokyo_metro/api/point/info.rb, line 112
def additional_name_en
  str = ::TokyoMetro::Dictionary.english[ additional_name_ja ]
  #----
  str
end
additional_name_ja()
Alias for: additional_name
category_name_en() click to toggle source
# File lib/tokyo_metro/api/point/info.rb, line 103
def category_name_en
  str = ::TokyoMetro::Dictionary.english[ category_name_ja ]
  unless str.present?
    raise "Error: The category name of \"#{ @title.to_s }\" is not defined yet."
  end

  str
end
station() click to toggle source
# File lib/tokyo_metro/api/point/info.rb, line 134
def station
  station_facility_key = nil
  ::TokyoMetro::Api::stations.each do | sta |
    if sta.exit_list.include?( @id_urn )
      if sta.facility.string?
        station_facility_key = sta.facility
      else
        station_facility_key = sta.facility.same_as
      end
      break
    end
  end

  if station_facility_key.present?
    station_facility_key
  else
    raise "Error"
  end
end
to_h() click to toggle source

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

# File lib/tokyo_metro/api/point/info.rb, line 74
def to_h
  h = Hash.new

  set_data_to_hash( h , "\@id" , @id_urn )
  set_data_to_hash( h , "dc:title" , @title.to_s )
  set_data_to_hash( h , "ug:region" , @region )

  set_data_to_hash( h , "ug:floor" , @floor )
  set_data_to_hash( h , "ugsrv:categoryName" , @category_name )

  set_data_to_hash( h , "geo:long" , @geo_long )
  set_data_to_hash( h , "geo:lat" , @geo_lat )

  h
end
to_s( indent = 0 ) click to toggle source

インスタンスの情報を文字列にして返すメソッド @param indent [Integer (>=0)] インデントの幅 @return [String]

# File lib/tokyo_metro/api/point/info.rb, line 66
def to_s( indent = 0 )
  to_s_with_array( [] , indent )
end
Also aliased as: to_strf
to_strf( indent = 0 )
Alias for: to_s