Module: Inthegra::Client::Vehicles

Included in:
Inthegra::Client
Defined in:
lib/inthegra/client/vehicles.rb

Overview

Define methods related to vehicles

Instance Method Summary collapse

Instance Method Details

#vehiclesArray::Vehicle

Return a list of all vehicles

Examples:

Return all vehicles

Inthegra.vehicles

Returns:

  • (Array::Vehicle)

    All vehicles

See Also:



13
14
15
16
17
# File 'lib/inthegra/client/vehicles.rb', line 13

def vehicles
  response = get('veiculos')

  VehiclesSerializer.parse(response, Vehicle)
end

#vehicles_by_line(line_code) ⇒ Array::Vehicle

Return a list of all vehicles of from a line code

Examples:

Return a list of all vehicles of from a line code 401

Inthegra.line_search('0401')

Parameters:

  • query (String)

    An search query

Returns:

  • (Array::Vehicle)

    All lines

See Also:



27
28
29
30
31
# File 'lib/inthegra/client/vehicles.rb', line 27

def (line_code)
  response = get('veiculosLinha', { busca: URI::encode(line_code) })

  VehiclesSerializer.parse([response], Vehicle)
end