Class: Lyft::Client::Api::User

Inherits:
Base
  • Object
show all
Defined in:
lib/lyft/client/api/user.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

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

Get user’s profile

Parameters:

  • access_token (String)

    The access_token (required)

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

    The lyft parameters.



31
32
33
34
35
36
37
# File 'lib/lyft/client/api/user.rb', line 31

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

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

Get ride history

Parameters:

  • access_token (String)

    The access_token (required)

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

    The lyft parameters.

Options Hash (params:):

  • :start_time (DateTime) — default: *required*
  • :end_time (DateTime)
  • :limit (Integer)


14
15
16
17
18
19
20
21
22
23
# File 'lib/lyft/client/api/user.rb', line 14

def ride_history(access_token:, params: {})
  params.delete(:end_time) if params[:end_time].blank?
  params.delete(:limit) if params[:limit].blank?

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