Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uber-estimates

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uber-estimates

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Uber::Estimates

Uber Estimates is a small gem that wraps estimate endpoints from Uber API. Using this gem you will be able to get estimates about Uber rides nice and smooth.

Installation

Add this line to your application's Gemfile:

gem 'uber-estimates'

And then execute:

$ bundle

Or install it yourself as:

$ gem install uber-estimates

Usage

Gem configuration

Uber::Estimates.configure do |config|
  config.server_token = "your server token"
end

Getting price estimates

To get price estimates you need to provide ruby :price as estimations type, start point and end point coordinates, as below. More details at Uber Docs

Uber::Estimates.get_estimations(:price,
  {start_latitude: 44.427587, start_longitude: 26.0987345,
    end_latitude: 44.4599565, end_longitude: 26.0984328
  }
)
Response:
#<Uber::Estimates::Response:0x0000000345cce0
 @code=200,
 @data=
  [#<Uber::Estimates::ResponseTypes::Price:0x0000000345b9f8
    @currency_code="RON",
    @display_name="uberX",
    @distance=3.24,
    @duration=840,
    @estimate="RON20-27",
    @high_estimate=27,
    @localized_display_name="uberX",
    @low_estimate=20,
    @product_id="1ca8d691-9f67-4bfb-9c57-cb727b52b7b7",
    @surge_multiplier=2>,
   #<Uber::Estimates::ResponseTypes::Price:0x0000000345b9d0
    @currency_code="RON",
    @display_name="uberSELECT",
    @distance=3.24,
    @duration=840,
    @estimate="RON19-26",
    @high_estimate=26,
    @localized_display_name="uberSELECT",
    @low_estimate=19,
    @product_id="df439009-d1de-4a3c-9ead-9e0e6f0294b9",
    @surge_multiplier=1.5>,
   #<Uber::Estimates::ResponseTypes::Price:0x0000000345b9a8
    @currency_code="RON",
    @display_name="Uber Child Seat",
    @distance=3.24,
    @duration=840,
    @estimate="RON20-24",
    @high_estimate=24,
    @localized_display_name="Uber Child Seat",
    @low_estimate=20,
    @product_id="99e0492a-acc1-412d-b650-48ed7fed9788",
    @surge_multiplier=1.0>]>

Getting time estimates

To get time estimates you need to provide ruby :time as estimations type, start point and end point coordinates, or a product_id. More details at Uber Docs

Uber::Estimates.get_estimations(:time,
  {start_latitude: 44.427587, start_longitude: 26.0987345,
    end_latitude: 44.4599565, end_longitude: 26.0984328
  }
)

or

Uber::Estimates.get_estimations(:time,
  {start_latitude: 44.427587, start_longitude: 26.0987345,
    product_id: "99e0492a-acc1-412d-b650-48ed7fed9788"
  }
)
Response
#<Uber::Estimates::Response:0x00000001cf2730
 @code=200,
 @data=
  [#<Uber::Estimates::ResponseTypes::Time:0x00000001cf1790
    @display_name="uberX",
    @estimate=300,
    @localized_display_name="uberX",
    @product_id="1ca8d691-9f67-4bfb-9c57-cb727b52b7b7">,
   #<Uber::Estimates::ResponseTypes::Time:0x00000001cf1768
    @display_name="uberSELECT",
    @estimate=420,
    @localized_display_name="uberSELECT",
    @product_id="df439009-d1de-4a3c-9ead-9e0e6f0294b9">]>

Contributing

  1. Fork it ( https://github.com/[my-github-username]/uber-estimates/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

FAQs

Package last updated on 04 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc