Class: Lyft::Client::Api::Rides
- Defined in:
- lib/lyft/client/api/rides.rb
Constant Summary collapse
- ENDPOINTS =
{ request: "/#{API_VERSION}/rides", details: "/#{API_VERSION}/rides/{{ride_id}}", cancel: "/#{API_VERSION}/rides/{{ride_id}}/cancel", rating: "/#{API_VERSION}/rides/{{ride_id}}/rating", receipt: "/#{API_VERSION}/rides/{{ride_id}}/receipt", destination: "/#{API_VERSION}/rides/{{ride_id}}/destination", sandbox_primetime: "/#{API_VERSION}/sandbox/primetime", sandbox_rides: "/#{API_VERSION}/sandbox/rides/{{ride_id}}", sandbox_ridetypes: "/#{API_VERSION}/sandbox/ridetypes/{{ride_type}}" }
Constants inherited from Base
Base::API_VERSION, Base::DEFAULT_VALIDATES
Instance Method Summary collapse
-
#cancel(args = {}) ⇒ Object
Cancel a ride request.
-
#destination(args = {}) ⇒ Object
Update the ride destination.
-
#details(args = {}) ⇒ Object
Get details of a ride.
-
#rate(args = {}) ⇒ Object
(also: #tip)
Rate a ride and/or provide a tip.
-
#receipt(args = {}) ⇒ Object
Get receipt for ride.
-
#request(args = {}) ⇒ Object
Request a ride.
-
#set_driver_availability(args = {}) ⇒ Object
Set driver availability for a ride type in an area.
-
#set_primetime(args = {}) ⇒ Object
Set the primetime percentage in area.
-
#set_ridetypes(args = {}) ⇒ Object
Preset the ridetypes in area.
-
#set_status(args = {}) ⇒ Object
Propogate ride through different states.
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
#cancel(args = {}) ⇒ Object
Cancel a ride request.
28 29 30 31 32 33 34 35 |
# File 'lib/lyft/client/api/rides.rb', line 28 def cancel(args = {}) make_request( http_method: :post, endpoint: path_for(:cancel, ride_id: args.delete(:ride_id)), access_token: args.delete(:access_token), options: { body: args.to_json } ) end |
#destination(args = {}) ⇒ Object
Update the ride destination
48 49 50 51 52 53 54 55 |
# File 'lib/lyft/client/api/rides.rb', line 48 def destination(args = {}) make_request( http_method: :put, endpoint: path_for(:destination, ride_id: args.delete(:ride_id)), access_token: args.delete(:access_token), options: { body: args.to_json } ) end |
#details(args = {}) ⇒ Object
Get details of a ride.
65 66 67 68 69 70 71 |
# File 'lib/lyft/client/api/rides.rb', line 65 def details(args = {}) make_request( http_method: :get, endpoint: path_for(:details, ride_id: args.delete(:ride_id)), access_token: args.delete(:access_token) ) end |
#rate(args = {}) ⇒ Object Also known as: tip
Rate a ride and/or provide a tip.
84 85 86 87 88 89 90 91 |
# File 'lib/lyft/client/api/rides.rb', line 84 def rate(args = {}) make_request( http_method: :put, endpoint: path_for(:rating, ride_id: args.delete(:ride_id)), access_token: args.delete(:access_token), options: { body: args.to_json } ) end |
#receipt(args = {}) ⇒ Object
Get receipt for ride
102 103 104 105 106 107 108 |
# File 'lib/lyft/client/api/rides.rb', line 102 def receipt(args = {}) make_request( http_method: :get, endpoint: path_for(:receipt, ride_id: args.delete(:ride_id)), access_token: args.delete(:access_token) ) end |
#request(args = {}) ⇒ Object
Request a ride.
121 122 123 124 125 126 127 128 |
# File 'lib/lyft/client/api/rides.rb', line 121 def request(args = {}) make_request( http_method: :post, endpoint: path_for(:request), access_token: args.delete(:access_token), options: { body: args.to_json } ) end |
#set_driver_availability(args = {}) ⇒ Object
Set driver availability for a ride type in an area.
210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/lyft/client/api/rides.rb', line 210 def set_driver_availability(args = {}) validate_sandboxed raise ArgumentError, 'Invalid Ride Type' unless Lyft::Ride::RIDE_TYPES.include? args[:ride_type] make_request( http_method: :put, endpoint: path_for(:sandbox_ridetypes, ride_type: args.delete(:ride_type)), access_token: args.delete(:access_token), options: { body: args.to_json } ) end |
#set_primetime(args = {}) ⇒ Object
Set the primetime percentage in area
188 189 190 191 192 193 194 195 196 |
# File 'lib/lyft/client/api/rides.rb', line 188 def set_primetime(args = {}) validate_sandboxed make_request( http_method: :put, endpoint: path_for(:sandbox_primetime), access_token: args.delete(:access_token), options: { body: args.to_json } ) end |
#set_ridetypes(args = {}) ⇒ Object
Preset the ridetypes in area.
141 142 143 144 145 146 147 148 149 |
# File 'lib/lyft/client/api/rides.rb', line 141 def set_ridetypes(args = {}) validate_sandboxed make_request( http_method: :put, endpoint: path_for(:sandbox_ridetypes), access_token: args.delete(:access_token), options: { body: args.to_json } ) end |
#set_status(args = {}) ⇒ Object
Propogate ride through different states.
160 161 162 163 164 165 166 167 168 |
# File 'lib/lyft/client/api/rides.rb', line 160 def set_status(args = {}) validate_sandboxed make_request( http_method: :put, endpoint: path_for(:sandbox_rides, ride_id: args.delete(:ride_id)), access_token: args.delete(:access_token), options: { body: args.to_json } ) end |