Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

BloomAndWild/on_the_dot_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OnTheDotApi

OnTheDot API ruby wrapper. OnTheDot API documentation - http://developers.onthedot.com/docs/#overview

Installation

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

Usage

Client configuration

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

Operations

Get available timeslots

OnTheDotApi::Operations::GetAvailableTimeslots.new(payload: {YOUR PAYLOAD}).execute

Implements - http://developers.onthedot.com/docs/#TimeslotV2.

Create a booking

OnTheDotApi::Operations::CreateBooking.new(
  payload: {YOUR PAYLOAD},
  headers: { "UUID": {UUID FROM TIMESLOTS RESPONSE} }
).execute

Implements - http://developers.onthedot.com/docs/#create-booking.

Cancel booking

OnTheDotApi::Operations::CancelBooking.new(
  order_number: {OnTheDot API ORDER NUMBER}
).execute

Implements - http://developers.onthedot.com/docs/#cancel-booking.

Retrieve booking

OnTheDotApi::Operations::RetrieveBooking.new(
  order_number: {OnTheDot API ORDER NUMBER}
).execute

Implements - http://developers.onthedot.com/docs/#retrieve-booking.

Amend 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.

Get all bookings

OnTheDotApi::Operations::GettAllBookings.new(
  headers: { params: { "pageNumber": 1, "pageSize": 25 }}
).execute

Implements - http://developers.onthedot.com/docs/#get-all-bookings.

Track delivery

OnTheDotApi::Operations::TrackDelivery.new(
  order_number: {OnTheDot API ORDER NUMBER}
).execute

Implements - http://developers.onthedot.com/docs/#tracking-delivery.

Testing

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.

License

The gem is available as open source under the terms of the MIT License.

About

On the Dot API / CitySprint API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages