OnTheDot API ruby wrapper. OnTheDot API documentation - http://developers.onthedot.com/docs/#overview
Add this line to your application's Gemfile:
gem 'on_the_dot_api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install on_the_dot_api
First you need to configure the client (if using Rails, place in an initializer):
OnTheDotApi::Client.configure do |config|
config.base_url = # Base url used to communicate with the OnTheDot API
config.api_key = # Api key used for authentication.
config.store_id = # Store id.
config.logger = Logger.new(STDOUT) # Your choice of logger.
end
OnTheDotApi::Operations::GetAvailableTimeslots.new(payload: {YOUR PAYLOAD}).execute
Implements - http://developers.onthedot.com/docs/#TimeslotV2.
OnTheDotApi::Operations::CreateBooking.new(
payload: {YOUR PAYLOAD},
headers: { "UUID": {UUID FROM TIMESLOTS RESPONSE} }
).execute
Implements - http://developers.onthedot.com/docs/#create-booking.
OnTheDotApi::Operations::CancelBooking.new(
order_number: {OnTheDot API ORDER NUMBER}
).execute
Implements - http://developers.onthedot.com/docs/#cancel-booking.
OnTheDotApi::Operations::RetrieveBooking.new(
order_number: {OnTheDot API ORDER NUMBER}
).execute
Implements - http://developers.onthedot.com/docs/#retrieve-booking.
OnTheDotApi::Operations::AmendBooking.new(
payload: {YOUR PAYLOAD},
headers: { "UUID": {UUID FROM TIMESLOTS RESPONSE} }
).execute
Notice: payload should include order number.
Implements - http://developers.onthedot.com/docs/#amend-booking.
OnTheDotApi::Operations::GettAllBookings.new(
headers: { params: { "pageNumber": 1, "pageSize": 25 }}
).execute
Implements - http://developers.onthedot.com/docs/#get-all-bookings.
OnTheDotApi::Operations::TrackDelivery.new(
order_number: {OnTheDot API ORDER NUMBER}
).execute
Implements - http://developers.onthedot.com/docs/#tracking-delivery.
To run rspec specs you need to have OnTheDot API sandbox credentials (Api key and shop id). Those credentials should be added to .env
file. .env.sample
file is provided as example.
The gem is available as open source under the terms of the MIT License.