Class: Lyft::Client::Api::Availability

Inherits:
Base
  • Object
show all
Defined in:
lib/lyft/client/api/availability.rb

Instance Attribute Summary

Attributes inherited from Base

#configuration

Instance Method Summary collapse

Methods inherited from Base

#connection, #initialize

Constructor Details

This class inherits a constructor from Lyft::Client::Api::Base

Instance Method Details

#cost(access_token:, params: {}) ⇒ Object

Get the estimated cost of ride.

Examples:

Get the estimated cost of a ride.

client.availability.cost(
  access_token: 'token',
  params: {
    start_lat: 37.7772,
    start_lng: -122.4233,
    end_lat: 37.7972,
    end_lng: -122.4533
  }
)

Parameters:

  • access_token (String)

    The access_token (required)

  • params (Hash) (defaults to: {})

    The lyft parameters.

Options Hash (params:):

  • :start_lat (Float)

    The latitude of starting point. (required)

  • :start_lng (Float)

    The longitude of starting point. (required)

  • :end_lat (Float)

    The latitude of the end point. (required)

  • :end_lng (Float)

    The longitude of the end point. (required)



26
27
28
29
30
31
32
# File 'lib/lyft/client/api/availability.rb', line 26

def cost(access_token:, params: {})
  resp = connection(access_token).get do |req|
    req.url "/#{Api::VERSION}/cost"
    req.params = params
  end
  handle_response(resp)
end

#eta(access_token:, params: {}) ⇒ Object

Get eta for lyft driver to reach location

Examples:

Get lyft eta to a specified location.

client.availability.eta access_token: 'my_token',
                        params: { lat: 37.7772, lng: -122.4233 }

Parameters:

  • access_token (String)

    The access_token (required)

  • params (Hash) (defaults to: {})

    The lyft parameters.

Options Hash (params:):

  • :lat (Float)

    The latitude of pickup. (required)

  • :lng (Float)

    The longitude of pickup. (required)



46
47
48
49
50
51
52
# File 'lib/lyft/client/api/availability.rb', line 46

def eta(access_token:, params: {})
  resp = connection(access_token).get do |req|
    req.url "/#{Api::VERSION}/eta"
    req.params = params
  end
  handle_response(resp)
end

#nearby_drivers(access_token:, params: {}) ⇒ Object

Get positions of nearby drivers

Examples:

Get location of nearby drivers.

client.availability.nearby_drivers access_token: 'my_token',
                                   params: { lat: 37.7772, lng: -122.4233 }

Parameters:

  • access_token (String)

    The access_token (required)

  • params (Hash) (defaults to: {})

    The lyft parameters.

Options Hash (params:):

  • :lat (Float)

    The latitude of pickup. (required)

  • :lng (Float)

    The longitude of pickup. (required)



66
67
68
69
70
71
72
# File 'lib/lyft/client/api/availability.rb', line 66

def nearby_drivers(access_token:, params: {})
  resp = connection(access_token).get do |req|
    req.url "/#{Api::VERSION}/drivers"
    req.params = params
  end
  handle_response(resp)
end

#ride_types(access_token:, params: {}) ⇒ Object

Get available lyft ride types

Examples:

Get available ride types for a location.

client.availability.ride_types access_token: 'my_token',
                               params: { lat: 37.7772, lng: -122.4233 }

Parameters:

  • access_token (String)

    The access_token (required)

  • params (Hash) (defaults to: {})

    The lyft parameters.

Options Hash (params:):

  • :lat (Float)

    The latitude of pickup. (required)

  • :lng (Float)

    The longitude of pickup. (required)



86
87
88
89
90
91
92
# File 'lib/lyft/client/api/availability.rb', line 86

def ride_types(access_token:, params: {})
  resp = connection(access_token).get do |req|
    req.url "/#{Api::VERSION}/ridetypes"
    req.params = params
  end
  handle_response(resp)
end