Class: Inthegra::Client

Inherits:
Object
  • Object
show all
Includes:
BusStops, Lines, Vehicles, Connection, Request
Defined in:
lib/inthegra/client.rb,
lib/inthegra/client/lines.rb,
lib/inthegra/client/vehicles.rb,
lib/inthegra/client/bus_stops.rb

Defined Under Namespace

Modules: BusStops, Lines, Vehicles

Instance Method Summary collapse

Methods included from Vehicles

#vehicles, #vehicles_by_line

Methods included from BusStops

#bus_stops, #bus_stops_by_line, #bus_stops_search

Methods included from Lines

#line_search, #lines

Methods included from Request

#get, #post

Constructor Details

#initialize(options = {}) ⇒ Client

Creates a new Client



17
18
19
20
21
22
23
# File 'lib/inthegra/client.rb', line 17

def initialize(options={})
  options = Inthegra.options.merge(options)

  Configuration::VALID_OPTIONS.each do |key|
    send("#{key}=", options[key])
  end
end

Instance Method Details

#authenticateObject

Authenticate the client and set the auth_token

Returns:

  • Authtoken



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

def authenticate
  response = post('signin', { email: email, password: password })
  self.auth_token = AuthToken.new(response)
end