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

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

Constant Summary collapse

ENDPOINTS =
{
  history: "/#{API_VERSION}/rides",
  profile: "/#{API_VERSION}/profile"
}

Constants inherited from Base

Base::API_VERSION, Base::DEFAULT_VALIDATES

Instance Method Summary collapse

Methods inherited from Base

#initialize, #path_for, path_for, #set_debug_output

Constructor Details

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

Instance Method Details

#profile(args = {}) ⇒ Object

Get user’s profile

Parameters:

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

Options Hash (args):

  • :access_token (String) — default: *required*


37
38
39
40
41
42
43
44
# File 'lib/lyft/client/api/user.rb', line 37

def profile(args = {})
  make_request(
    http_method: :get,
    endpoint: path_for(:profile),
    access_token: args.delete(:access_token),
    options: { query: args }
  )
end

#ride_history(args = {}) ⇒ Object

Get ride history

Parameters:

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

Options Hash (args):

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


19
20
21
22
23
24
25
26
27
28
29
# File 'lib/lyft/client/api/user.rb', line 19

def ride_history(args = {})
  args.delete(:end_time) if args[:end_time].blank?
  args.delete(:limit) if args[:limit].blank?

  make_request(
    http_method: :get,
    endpoint: path_for(:history),
    access_token: args.delete(:access_token),
    options: { query: args }
  )
end