Class: TokyoMetro::Factory::Get::Api::DataSearch::RailwayLine

Inherits:
MetaClass::Search::DataSearch show all
Includes:
ClassNameLibrary::Api::RailwayLine
Defined in:
lib/tokyo_metro/factory/get/api/data_search/railway_line.rb

Overview

API から鉄道路線情報 odpt:Railway のデータを取得するための Factory Pattern のクラス

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MetaClass::Fundamental

#get_data

Constructor Details

#initialize(id, same_as, title, operator, railway_line_code, parse_json, generate_instance, to_inspect) ⇒ RailwayLine

Constructor



7
8
9
10
11
12
13
14
15
16
# File 'lib/tokyo_metro/factory/get/api/data_search/railway_line.rb', line 7

def initialize( id , same_as , title , operator , railway_line_code ,
  parse_json , generate_instance , to_inspect )

  super( parse_json , generate_instance , to_inspect )
  @id = id
  @same_as = same_as
  @title = title
  @operator = operator
  @railway_line_code = railway_line_code
end

Class Method Details

.process(http_client, id, same_as, title, operator, railway_line_code, parse_json, generate_instance, to_inspect) ⇒ Object

API からデータを取得するメソッド

Parameters:

  • http_client (HTTPClient)

    HTTPClient のインスタンス【必須】

  • parse_json (Boolean)

    JSONを配列とするか否かの設定(false の場合は文字列とする)【必須】

  • generate_instance (Boolean)

    データ取得後に Ruby のインスタンスを作成するか否かの設定【必須】

  • to_inspect (Boolean)

    データ取得後にコマンドツールに内容を表示するか否かの設定【必須】



36
37
38
39
40
41
42
43
# File 'lib/tokyo_metro/factory/get/api/data_search/railway_line.rb', line 36

def self.process( http_client , id , same_as , title , operator , railway_line_code ,
  parse_json , generate_instance , to_inspect )

  info = self.new( id , same_as , title , operator , railway_line_code ,
    parse_json , generate_instance , to_inspect )

  info.get_data( http_client )
end

Instance Method Details

#parametersHash

HTTPClient に送るパラメーター

Returns:

  • (Hash)


20
21
22
23
24
25
26
27
28
29
# File 'lib/tokyo_metro/factory/get/api/data_search/railway_line.rb', line 20

def parameters
  h = super

  set_parameter_send_to_api( h , "\@id" , @id , String )
  set_parameter_send_to_api( h , "owl:sameAs" , @same_as , String )
  set_parameter_send_to_api( h , "dc:title" , @title , String )
  set_parameter_send_to_api( h , "odpt:operator" , @operator , String )
  set_parameter_send_to_api( h , "odpt:lineCode" , @railway_line_code , String )
  h
end