Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.2 #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

v1.2 #40

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ driver.first_name #=> 'John'
driver.last_name #=> 'Driver'
driver.promo_code #=> 'join_john_on_uber'
```
More details can be found [here](https://developer.uber.com/docs/drivers/references/api/v1/partners-me-get).
More details can be found [here](https://developer.uber.com/docs/drivers/references/api/v1.2/partners-me-get).

### Earnings details
It returns an array of payments for the given driver. Payments are available at this endpoint in near real-time.
Expand All @@ -313,7 +313,7 @@ payment.event_time #=> 2016-11-12 10:29:28 UTC
# Using params:
earnings = client.partners.payments(:offset => 1, :limit => 2)
```
More details can be found [here](https://developer.uber.com/docs/drivers/references/api/v1/partners-payments-get).
More details can be found [here](https://developer.uber.com/docs/drivers/references/api/v1.2/partners-payments-get).

### Trips details
It returns an array of trips for the authenticated driver.
Expand All @@ -329,7 +329,7 @@ trip.distance #=> 0
trip.status #=> 'driver_canceled'
trip.duration #=> 0
```
More details can be found [here](https://developer.uber.com/docs/drivers/references/api/v1/partners-trips-get).
More details can be found [here](https://developer.uber.com/docs/drivers/references/api/v1.2/partners-trips-get).

## Deliveries API
[Deliveries API]() lets you and your customer track the exact location of your delivery from any device.
Expand All @@ -354,7 +354,7 @@ It retrieves a list of all deliveries
```ruby
deliveries = client.deliveries.list #=> Array of Uber::Delivery::Delivery
```
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1/deliveries-get)
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1.2/deliveries-get)

### Create a delivery
It allows a delivery to be requested given the delivery information and quote ID
Expand All @@ -363,7 +363,7 @@ It allows a delivery to be requested given the delivery information and quote ID
delivery = client.deliveries.add_delivery({quote_id: 'KEBjNGUxNjhlZmNmMD...', .. })
delivery.quote_id #=> 'KEBjNGUxNjhlZmNmMD...'
```
More details and parameters can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1/deliveries-post)
More details and parameters can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1.2/deliveries-post)

### Create delivery quote
Generate a delivery quote, given a pickup and dropoff location. On-demand and scheduled delivery quotes will be returned.
Expand All @@ -375,7 +375,7 @@ quotes = client.deliveries.add_quote({ "pickup" => { "location" => { ... } },
quotes.size #=> 4
quotes[0].fee #=> 5.42
```
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1/deliveries-quote-post)
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1.2/deliveries-quote-post)

### Retrieve a delivery information
Get the status of an ongoing delivery
Expand All @@ -386,7 +386,7 @@ delivery.currency_code #=> "USD"
delivery.delivery_id #=> '8b58bc58-7352-4278-b569-b5d24d8e3f76'
delivery.fee #=> 5.0
```
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1/deliveries-delivery_id-get)
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1.2/deliveries-delivery_id-get)

### Retrieve receipt for a delivery
```ruby
Expand All @@ -395,7 +395,7 @@ receipt.delivery_id #=> '8b58bc58-7352-4278-b569-b5d24d8e3f76'
receipt.total_fee #=> 6.17
receipt.charges #=> hash of charges
```
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1/deliveries-delivery_id-receipt-get)
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1.2/deliveries-delivery_id-receipt-get)

### Get delivery ratings
Retrieve the available ratings for a delivery.
Expand All @@ -406,7 +406,7 @@ ratings = client.deliveries.ratings('8b58bc58-7352-4278-b569-b5d24d8e3f76')
ratings.size #=> 2
ratings[0].waypoint #=> 'pickup'
```
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1/deliveries-delivery_id-ratings-get)
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1.2/deliveries-delivery_id-ratings-get)

### Submit a rating
Submit a rating for a delivery.
Expand All @@ -421,7 +421,7 @@ status = client.deliveries.add_rating('8b58bc58-7352-4278-b569-b5d24d8e3f76',
# Returns the status code, with no content
status #=> 204
```
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1/deliveries-delivery_id-ratings-post)
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1.2/deliveries-delivery_id-ratings-post)

### Get rating tags
Retrieve the available rating tags for a delivery
Expand All @@ -433,7 +433,7 @@ tags.size #=> 2
tags[0].waypoint #=> 'pickup'
tags.tags #=> Array of rating tags for delivery
```
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1/deliveries-delivery_id-rating_tags-get)
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1.2/deliveries-delivery_id-rating_tags-get)

### Cancel a delivery
Cancel an existing delivery.
Expand All @@ -442,7 +442,7 @@ Cancel an existing delivery.
status = client.deliveries.cancel('8b58bc58-7352-4278-b569-b5d24d8e3f76')
status #=> 204
```
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1/deliveries-delivery_id-cancel-post)
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1.2/deliveries-delivery_id-cancel-post)

### Get service regions
Returns all regions where UberRUSH is available.
Expand All @@ -452,7 +452,7 @@ regions = client.deliveries.regions
# Array of Uber::Delivery::Region
regions[0].city #=> 'San Francisco'
```
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1/deliveries-regions-get)
More details can be found [here](https://developer.uber.com/docs/deliveries/references/api/v1.2/deliveries-regions-get)

## Contributors

Expand Down
20 changes: 10 additions & 10 deletions lib/uber/api/deliveries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,51 @@ module Deliveries

def list(*args)
arguments = Uber::Arguments.new(args)
perform_with_objects(:get, "/v1/deliveries", arguments.options, Delivery::Delivery, self.client)
perform_with_objects(:get, "/v1.2/deliveries", arguments.options, Delivery::Delivery, self.client)
end

def add_delivery(*args)
arguments = Uber::Arguments.new(args)
perform_with_object(:post, "/v1/deliveries", arguments.options, Delivery::Delivery, self.client)
perform_with_object(:post, "/v1.2/deliveries", arguments.options, Delivery::Delivery, self.client)
end

def add_quote(*args)
arguments = Uber::Arguments.new(args)
perform_with_objects(:post, "/v1/deliveries/quote", arguments.options, Delivery::Quote, self.client)
perform_with_objects(:post, "/v1.2/deliveries/quote", arguments.options, Delivery::Quote, self.client)
end

def retrieve(delivery_id)
perform_with_object(:get, "/v1/deliveries/#{delivery_id}", {}, Delivery::Delivery, self.client)
perform_with_object(:get, "/v1.2/deliveries/#{delivery_id}", {}, Delivery::Delivery, self.client)
end

def receipt(delivery_id)
delivery_id = delivery_id.is_a?(Delivery::Delivery) ? delivery_id.delivery_id : delivery_id
perform_with_object(:get, "/v1/deliveries/#{delivery_id}/receipt", {}, Delivery::Receipt, self.client)
perform_with_object(:get, "/v1.2/deliveries/#{delivery_id}/receipt", {}, Delivery::Receipt, self.client)
end

def ratings(delivery_id)
delivery_id = delivery_id.is_a?(Delivery::Delivery) ? delivery_id.delivery_id : delivery_id
perform_with_objects(:get, "/v1/deliveries/#{delivery_id}/ratings", {}, Delivery::Rating, self.client)
perform_with_objects(:get, "/v1.2/deliveries/#{delivery_id}/ratings", {}, Delivery::Rating, self.client)
end

def add_rating(delivery_id, *args)
delivery_id = delivery_id.is_a?(Delivery::Delivery) ? delivery_id.delivery_id : delivery_id
arguments = Uber::Arguments.new(args)
perform_without_object(:post, "/v1/deliveries/#{delivery_id}/rating", arguments.options, self.client)
perform_without_object(:post, "/v1.2/deliveries/#{delivery_id}/rating", arguments.options, self.client)
end

def rating_tags(delivery_id)
delivery_id = delivery_id.is_a?(Delivery::Delivery) ? delivery_id.delivery_id : delivery_id
perform_with_objects(:get, "/v1/deliveries/#{delivery_id}/rating_tags", {}, Delivery::RatingTag, self.client)
perform_with_objects(:get, "/v1.2/deliveries/#{delivery_id}/rating_tags", {}, Delivery::RatingTag, self.client)
end

def cancel(delivery_id)
delivery_id = delivery_id.is_a?(Delivery::Delivery) ? delivery_id.delivery_id : delivery_id
perform_without_object(:post, "/v1/deliveries/#{delivery_id}/cancel", {}, self.client)
perform_without_object(:post, "/v1.2/deliveries/#{delivery_id}/cancel", {}, self.client)
end

def regions
perform_with_objects(:get, "/v1/deliveries/regions", {}, Delivery::Region, self.client)
perform_with_objects(:get, "/v1.2/deliveries/regions", {}, Delivery::Region, self.client)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/uber/api/me.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module API
module Me
def me(*args)
arguments = Uber::Arguments.new(args)
perform_with_object(:get, "/v1/me", arguments.options, User)
perform_with_object(:get, "/v1.2/me", arguments.options, User)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/uber/api/partners.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ module API
module Partners
include Uber::Utils
def me
perform_with_object(:get, "v1/partners/me", {}, Uber::Partner::Partner, self.client)
perform_with_object(:get, "v1.2/partners/me", {}, Uber::Partner::Partner, self.client)
end

def payments(*args)
arguments = Uber::Arguments.new(args)
perform_with_object(:get, "/v1/partners/payments", arguments.options, Uber::Partner::PaymentActivity, self.client)
perform_with_object(:get, "/v1.2/partners/payments", arguments.options, Uber::Partner::PaymentActivity, self.client)
end

def trips(*args)
arguments = Uber::Arguments.new(args)
perform_with_object(:get, "/v1/partners/trips", arguments.options, Uber::Partner::TripActivity, self.client)
perform_with_object(:get, "/v1.2/partners/trips", arguments.options, Uber::Partner::TripActivity, self.client)
end

alias_method :earnings, :payments
Expand Down
4 changes: 2 additions & 2 deletions lib/uber/api/places.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ module Uber
module API
module Places
def place(place_id)
perform_with_object(:get, "/v1/places/#{place_id}", {}, Place)
perform_with_object(:get, "/v1.2/places/#{place_id}", {}, Place)
end

def place_update(place_id, address)
perform_with_object(:put, "/v1/places/#{place_id}", {address: address}, Place)
perform_with_object(:put, "/v1.2/places/#{place_id}", {address: address}, Place)
end

alias_method :place_detail, :place
Expand Down
2 changes: 1 addition & 1 deletion lib/uber/api/price_estimates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module API
module PriceEstimates
def price_estimations(*args)
arguments = Uber::Arguments.new(args)
perform_with_objects(:get, "/v1/estimates/price", arguments.options, Price)
perform_with_objects(:get, "/v1.2/estimates/price", arguments.options, Price)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/uber/api/products.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ module API
module Products
def products(*args)
arguments = Uber::Arguments.new(args)
perform_with_objects(:get, "/v1/products", arguments.options, Product)
perform_with_objects(:get, "/v1.2/products", arguments.options, Product)
end

def apply_surge(product_id, surge_multiplier)
perform_with_object(:put, "/v1/sandbox/products/#{product_id}", {surge_multiplier: surge_multiplier}, Product)
perform_with_object(:put, "/v1.2/sandbox/products/#{product_id}", {surge_multiplier: surge_multiplier}, Product)
end

def apply_availability(product_id, value)
perform_with_object(:put, "/v1/sandbox/products/#{product_id}", {drivers_available: value}, Product)
perform_with_object(:put, "/v1.2/sandbox/products/#{product_id}", {drivers_available: value}, Product)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/uber/api/promotions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module API
module Promotions
def promotion(*args)
arguments = Uber::Arguments.new(args)
perform_with_object(:get, "/v1/promotions", arguments.options, Promotion)
perform_with_object(:get, "/v1.2/promotions", arguments.options, Promotion)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/uber/api/reminders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ module API
module Reminders

def reminder(reminder_id)
perform_with_object(:get, "/v1/reminders/#{reminder_id}", {}, Reminder)
perform_with_object(:get, "/v1.2/reminders/#{reminder_id}", {}, Reminder)
end

def add_reminder(*args)
arguments = sanitize_time(Uber::Arguments.new(args))
perform_with_object(:post, "/v1/reminders", arguments.options, Reminder)
perform_with_object(:post, "/v1.2/reminders", arguments.options, Reminder)
end

def update_reminder(reminder_id, *args)
arguments = sanitize_time(Uber::Arguments.new(args))
perform_with_object(:patch, "/v1/reminders/#{reminder_id}", arguments.options, Reminder)
perform_with_object(:patch, "/v1.2/reminders/#{reminder_id}", arguments.options, Reminder)
end

def delete_reminder(reminder_id)
perform_with_object(:delete, "/v1/reminders/#{reminder_id}", {}, Reminder)
perform_with_object(:delete, "/v1.2/reminders/#{reminder_id}", {}, Reminder)
end

alias_method :reminder_detail, :reminder
Expand Down
12 changes: 6 additions & 6 deletions lib/uber/api/requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ module API
module Requests
def trip_estimate(*args)
arguments = Uber::Arguments.new(args)
perform_with_object(:post, "v1/requests/estimate", arguments.options, Estimate)
perform_with_object(:post, "v1.2/requests/estimate", arguments.options, Estimate)
end

def trip_request(*args)
arguments = Uber::Arguments.new(args)
perform_with_object(:post, "v1/requests", arguments.options, Request)
perform_with_object(:post, "v1.2/requests", arguments.options, Request)
end

def trip_details(request_id)
perform_with_object(:get, "v1/requests/#{request_id}", {}, Request)
perform_with_object(:get, "v1.2/requests/#{request_id}", {}, Request)
end

def trip_map(request_id)
perform_with_object(:get, "v1/requests/#{request_id}/map", {}, Map)
perform_with_object(:get, "v1.2/requests/#{request_id}/map", {}, Map)
end

def trip_update(request_id, status)
perform_with_object(:put, "v1/sandbox/requests/#{request_id}", {status: status}, Request)
perform_with_object(:put, "v1.2/sandbox/requests/#{request_id}", {status: status}, Request)
end

def trip_cancel(request_id)
perform_with_object(:delete, "v1/requests/#{request_id}", {}, Request)
perform_with_object(:delete, "v1.2/requests/#{request_id}", {}, Request)
end

def trip_receipt(request_id)
Expand Down
2 changes: 1 addition & 1 deletion lib/uber/api/time_estimates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module API
module TimeEstimates
def time_estimations(*args)
arguments = Uber::Arguments.new(args)
perform_with_objects(:get, "/v1/estimates/time", arguments.options, Time)
perform_with_objects(:get, "/v1.2/estimates/time", arguments.options, Time)
end
end
end
Expand Down
Loading