RubyUber
A Ruby wrapper for the Uber API. Brought to you by the team at Bandwagon.
Installation
Add this line to your application's Gemfile:
gem 'ruby_uber'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ruby_uber
Usage
First, create a client:
client = RubyUber::Client.new(
server_token: 'my_great_token',
client_id: 'my_client_id',
secret: 'shhh'
)
Client instances must be created with either a server_token (for the non-user endpoints) or with a client_id and secret (for the user endpoints requiring OAuth). You should probably have both though.
Access a resource like this:
client.products.get(latitude: 40.69, longitude: -73.98)
# => [{display_name: "UberBLACK", capacity: 4 ... }, { ... }]
products, price_estimates, and time_estimates are all implemented this way. See documentation for query parameters and response payloads here.
user_activity and user_profile have classes and pending specs. They'll be enabled (along with user authentication) soon.
Testing
To run all tests locally:
$ rspec spec
To point endpoint tests at the live server:
$ LIVE=1 rspec spec
Running the live tests requires API credentials. They're not in the repository. Create a credentials.yml in the root of the project that looks like this:
server_token: my_great_token
client_id: my_client_id
secret: shhh
The tests will pull credentials from this file. It's gitignored so you can just leave it there.
Contributing
- Fork it ( https://github.com/WeeelsInc/ruby_uber/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 a new Pull Request