A Ruby SDK for the Uber API
Add this line to your application's Gemfile:
gem "uber-sdk", require: "uber"
And then execute:
$ bundle
Or install it yourself as:
$ gem install uber-sdk
client = Uber::Client.new do |config|
config.server_token = "YOUR_SERVER_TOKEN"
config.client_id = "YOUR_CLIENT_ID"
config.client_secret = "YOUR_CLIENT_SECRET"
end
client = Uber::Client.new do |config|
config.server_token = "YOUR_SERVER_TOKEN"
end
client.products(latitude: lat, longitude: lon)
client = Uber::Client.new do |config|
config.server_token = "YOUR_SERVER_TOKEN"
end
client.price_estimations(start_latitude: slat, start_longitude: slon,
end_latitude: dlat, end_longitude: dlon)
client = Uber::Client.new do |config|
config.server_token = "YOUR_SERVER_TOKEN"
end
client.time_estimations(start_latitude: slat, start_longitude: slon)
client = Uber::Client.new do |config|
config.server_token = "YOUR_SERVER_TOKEN"
config.client_id = "YOUR_CLIENT_ID"
config.client_secret = "YOUR_CLIENT_SECRET"
config.bearer_token = "USER_ACCESS_TOKEN"
end
client.me
client = Uber::Client.new do |config|
config.server_token = "YOUR_SERVER_TOKEN"
config.client_id = "YOUR_CLIENT_ID"
config.client_secret = "YOUR_CLIENT_SECRET"
config.bearer_token = "USER_ACCESS_TOKEN"
end
client.history
client = Uber::Client.new do |config|
config.client_id = "YOUR_CLIENT_ID"
config.client_secret = "YOUR_CLIENT_SECRET"
config.bearer_token = "USER_ACCESS_TOKEN"
end
client.trip_request(product_id: product_id, start_latitude: start_lat, start_longitude: start_lng, end_latitude: end_lat, end_longitude: end_lng)
client = Uber::Client.new do |config|
config.client_id = "YOUR_CLIENT_ID"
config.client_secret = "YOUR_CLIENT_SECRET"
config.bearer_token = "USER_ACCESS_TOKEN"
end
# Only available in sandbox environment
# Use this to simulate a surge
# More info here https://developer.uber.com/docs/sandbox#section-product-types
client.apply_surge 'product_id', 2.0
client.trip_request(product_id: product_id, start_latitude: start_lat, start_longitude: start_lng, end_latitude: end_lat, end_longitude: end_lng, surge_confirmation_id: surge_id)
client = Uber::Client.new do |config|
config.client_id = "YOUR_CLIENT_ID"
config.client_secret = "YOUR_CLIENT_SECRET"
config.bearer_token = "USER_ACCESS_TOKEN"
end
# Only available in sandbox environment
# Use this to simulate a request with no drivers available
# More info here https://developer.uber.com/docs/sandbox#section-product-types
client.apply_availability 'product_id', false
client.trip_request(product_id: product_id, start_latitude: start_lat, start_longitude: start_lng, end_latitude: end_lat, end_longitude: end_lng)
client = Uber::Client.new do |config|
config.client_id = "YOUR_CLIENT_ID"
config.client_secret = "YOUR_CLIENT_SECRET"
config.bearer_token = "USER_ACCESS_TOKEN"
end
# Only available in sandbox environment
# Use this to simulate the status change of a ride request
# More info here https://developer.uber.com/docs/sandbox#section-request
client.trip_update('request_id', 'accepted')
client = Uber::Client.new do |config|
config.client_id = "YOUR_CLIENT_ID"
config.client_secret = "YOUR_CLIENT_SECRET"
config.bearer_token = "USER_ACCESS_TOKEN"
end
client.trip_details 'request_id'
client = Uber::Client.new do |config|
config.client_id = "YOUR_CLIENT_ID"
config.client_secret = "YOUR_CLIENT_SECRET"
config.bearer_token = "USER_ACCESS_TOKEN"
end
client.trip_cancel 'request_id'
- Fork it ( http://github.com/chrisenytc/uber-sdk/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Check here