Class: TokyoMetro::Factory::Get::Api::DataSearch::Fare
- Inherits:
-
MetaClass::Search::DataSearch
- Object
- MetaClass::Fundamental
- MetaClass::Search
- MetaClass::Search::DataSearch
- TokyoMetro::Factory::Get::Api::DataSearch::Fare
- Includes:
- ClassNameLibrary::Api::Fare
- Defined in:
- lib/tokyo_metro/factory/get/api/data_search/fare.rb
Overview
API から運賃 odpt:RailwayFare のデータを取得するための Factory Pattern のクラス
Class Method Summary collapse
-
.process(http_client, id, same_as, operator, from_station, to_station, ticket, child_ticket, ic_card, child_ic_card, parse_json, generate_instance, to_inspect) ⇒ Object
API からデータを取得するメソッド.
Instance Method Summary collapse
-
#initialize(id, same_as, operator, from_station, to_station, ticket, child_ticket, ic_card, child_ic_card, parse_json, generate_instance, to_inspect) ⇒ Fare
constructor
Constructor.
-
#parameters ⇒ Hash
HTTPClient に送るパラメーター.
Methods inherited from MetaClass::Fundamental
Constructor Details
#initialize(id, same_as, operator, from_station, to_station, ticket, child_ticket, ic_card, child_ic_card, parse_json, generate_instance, to_inspect) ⇒ Fare
Constructor
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/tokyo_metro/factory/get/api/data_search/fare.rb', line 7 def initialize( id , same_as , operator , from_station , to_station , ticket , child_ticket , ic_card , child_ic_card , parse_json , generate_instance , to_inspect ) super( parse_json , generate_instance , to_inspect ) @id = id @same_as = same_as @operator = operator @from_station = from_station @to_station = to_station @ticket = ticket @child_ticket = child_ticket @ic_card = ic_card @child_ic_card = child_ic_card end |
Class Method Details
.process(http_client, id, same_as, operator, from_station, to_station, ticket, child_ticket, ic_card, child_ic_card, parse_json, generate_instance, to_inspect) ⇒ Object
API からデータを取得するメソッド
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/tokyo_metro/factory/get/api/data_search/fare.rb', line 51 def self.process( http_client , id , same_as , operator , from_station , to_station , ticket , child_ticket , ic_card , child_ic_card , parse_json , generate_instance , to_inspect ) info = self.new( id , same_as , operator , from_station , to_station , ticket , child_ticket , ic_card , child_ic_card , parse_json , generate_instance , to_inspect ) info.get_data( http_client ) end |
Instance Method Details
#parameters ⇒ Hash
HTTPClient に送るパラメーター
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tokyo_metro/factory/get/api/data_search/fare.rb', line 29 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 , "odpt:operator" , @operator , String ) set_parameter_send_to_api( h , "odpt:fromStation" , @from_station , String ) set_parameter_send_to_api( h , "odpt:toStation" , @to_station , String ) set_parameter_send_to_api( h , "odpt:ticketFare" , @ticket , Integer ) set_parameter_send_to_api( h , "odpt:childTicketFare" , @child_ticket , Integer ) set_parameter_send_to_api( h , "odpt:icCardFare" , @ic_card , Integer ) set_parameter_send_to_api( h , "odpt:childIcCardFare" , @child_ic_card , Integer ) h end |