Class: Rome2rio::SearchResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/rome2rio/response/search_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ SearchResponse

Returns a new instance of SearchResponse.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rome2rio/response/search_response.rb', line 4

def initialize(json)
  @verbatim = json

  @agencies = []
  json["agencies"].each { |agency| @agencies << Agency.new(agency) }

  @airlines = []
  json["airlines"].each { |airline| @airlines << Airline.new(airline) }

  @aircrafts = []
  json["aircrafts"].each { |aircraft| @aircrafts << Aircraft.new(aircraft) }

  @airports = []
  json["airports"].each { |airport| @airports << Airport.new(airport) }

  @routes = []
  json["routes"].each { |route| @routes << Route.new(route) }

  @data = json["data"]
end

Instance Attribute Details

#agenciesObject (readonly)

Returns the value of attribute agencies.



3
4
5
# File 'lib/rome2rio/response/search_response.rb', line 3

def agencies
  @agencies
end

#aircraftsObject (readonly)

Returns the value of attribute aircrafts.



3
4
5
# File 'lib/rome2rio/response/search_response.rb', line 3

def aircrafts
  @aircrafts
end

#airlinesObject (readonly)

Returns the value of attribute airlines.



3
4
5
# File 'lib/rome2rio/response/search_response.rb', line 3

def airlines
  @airlines
end

#airportsObject (readonly)

Returns the value of attribute airports.



3
4
5
# File 'lib/rome2rio/response/search_response.rb', line 3

def airports
  @airports
end

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/rome2rio/response/search_response.rb', line 3

def data
  @data
end

#routesObject (readonly)

Returns the value of attribute routes.



3
4
5
# File 'lib/rome2rio/response/search_response.rb', line 3

def routes
  @routes
end

#verbatimObject (readonly)

Returns the value of attribute verbatim.



3
4
5
# File 'lib/rome2rio/response/search_response.rb', line 3

def verbatim
  @verbatim
end