Class: TokyoMetro::Api::Point::Info
- Inherits:
-
MetaClass::Hybrid::Info
- Object
- MetaClass::Fundamental::Info
- MetaClass::Hybrid::Info
- TokyoMetro::Api::Point::Info
- Includes:
- ClassNameLibrary::Api::Point, Modules::Api::Info::ToJson, Modules::Api::Info::ToStringGeneral, Modules::Api::Info::ToStringWithArray, Modules::Common::ToFactory::Seed::Info
- Defined in:
- lib/tokyo_metro/api/point/info.rb
Overview
個別の地物情報 ug:Poi のクラス
Defined Under Namespace
Classes: Title
地理情報 (For developers) collapse
-
#geo_lat ⇒ Float
(also: #latitude)
readonly
代表点の緯度(10進表記).
-
#geo_long ⇒ Float
(also: #longitude)
readonly
代表点の経度(10進表記).
-
#region ⇒ Integer
(also: #geo_json)
readonly
地物の形状データを GeoJSON で取得するためのURL <ug:region - odpt:GeoDocument>.
一般の情報 collapse
-
#category_name ⇒ String
(also: #category_name_ja)
readonly
地物のカテゴリ(必ず「出入口」となる) <ugsrv:categoryName - xsd:string>.
-
#floor ⇒ Integer
readonly
地物の階数(高さ情報) <ug:floor - xsd:double>.
-
#title ⇒ String
readonly
地物名 <dc:title - xsd:string>.
Attributes inherited from MetaClass::Fundamental::Info
駅情報の取得 collapse
-
#to_h ⇒ Hash
インスタンスの情報をハッシュにして返すメソッド.
-
#to_s(indent = 0) ⇒ String
(also: #to_strf)
インスタンスの情報を文字列にして返すメソッド.
Instance Method Summary collapse
- #additional_name ⇒ Object (also: #additional_name_ja)
- #additional_name_en ⇒ Object
- #category_name_en ⇒ Object
-
#initialize(id_urn, title, geo_long, geo_lat, region, ug_floor, category_name) ⇒ Info
constructor
Constructor.
- #station ⇒ Object
Methods included from Modules::Api::Info::ToJson
Methods included from Modules::Common::ToFactory::Seed::Info
Constructor Details
#initialize(id_urn, title, geo_long, geo_lat, region, ug_floor, category_name) ⇒ Info
Constructor
13 14 15 16 17 18 19 20 21 22 23 |
# 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 |
Instance Attribute Details
#category_name ⇒ String (readonly) Also known as: category_name_ja
地物のカテゴリ(必ず「出入口」となる) <ugsrv:categoryName - xsd:string>
44 45 46 |
# File 'lib/tokyo_metro/api/point/info.rb', line 44 def category_name @category_name end |
#floor ⇒ Integer (readonly)
地物の階数(高さ情報) <ug:floor - xsd:double>
48 49 50 |
# File 'lib/tokyo_metro/api/point/info.rb', line 48 def floor @floor end |
#geo_lat ⇒ Float (readonly) Also known as: latitude
代表点の緯度(10進表記)
33 34 35 |
# File 'lib/tokyo_metro/api/point/info.rb', line 33 def geo_lat @geo_lat end |
#geo_long ⇒ Float (readonly) Also known as: longitude
代表点の経度(10進表記)
29 30 31 |
# File 'lib/tokyo_metro/api/point/info.rb', line 29 def geo_long @geo_long end |
#region ⇒ Integer (readonly) Also known as: geo_json
Note:
取得にはアクセストークンの付与が必要
地物の形状データを GeoJSON で取得するためのURL <ug:region - odpt:GeoDocument>
38 39 40 |
# File 'lib/tokyo_metro/api/point/info.rb', line 38 def region @region end |
#title ⇒ String (readonly)
Note:
エレベータには「エレベータ」という文字列を含む。「出入口」の文字列の後に出口番号が続く。
地物名 <dc:title - xsd:string>
53 54 55 |
# File 'lib/tokyo_metro/api/point/info.rb', line 53 def title @title end |
Instance Method Details
#additional_name ⇒ Object Also known as: additional_name_ja
92 93 94 95 96 97 98 99 |
# 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 |
#additional_name_en ⇒ Object
112 113 114 115 116 |
# File 'lib/tokyo_metro/api/point/info.rb', line 112 def additional_name_en str = ::TokyoMetro::Dictionary.english[ additional_name_ja ] #---- str end |
#category_name_en ⇒ Object
103 104 105 106 107 108 109 110 |
# 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 ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# 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 ⇒ Hash
インスタンスの情報をハッシュにして返すメソッド
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# 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) ⇒ String Also known as: to_strf
インスタンスの情報を文字列にして返すメソッド
66 67 68 |
# File 'lib/tokyo_metro/api/point/info.rb', line 66 def to_s( indent = 0 ) to_s_with_array( [] , indent ) end |