The Bosta Ruby SDK provides convenient access to the Bosta API from applications written in the Ruby language.
gem install bosta
require('bosta');
Bosta.api_key= ENV['API_KEY']
Bosta.base_url= ENV['BASE_URL']
API_KEY
is your integartion api key with bosta, to get an api key you must be registered, here is the registration link Bosta. And BASE_URL
is the url to bosta Apis wheither it's staging or production. If BASE_URL
is not sent in initialization as parameter it's production by default.
deliveryTypes = Bosta::DELIVERY_TYPES;
pickupTimeSlots_1 = Bosta::TIME_SLOT_10_TO_13;
pickupTimeSlots_2 = Bosta::TIME_SLOT_13_TO_16;
receiver1 = Bosta::Receiver.new('Ahmad Mohamad', '01029394959')
address1 = Bosta::Address.new('EG-01', 'address firstline')
type = Bosta::DELIVERY_TYPES[:SEND]
spec = Bosta::Specs.new(Bosta::DELIVERY_SIZES[:SMALL])
create_delivery = Bosta::Delivery.create(type, 100, receiver1, address1, spec)
delivery_id = create_delivery['_id'];
tracking_number = create_delivery['trackingNumber'];
update_delivery = Bosta::Delivery.update(delivery_id, cod=nil, address= nil, receiver = nil, business_reference=nil, webhook_url=nil, notes=nil);
deliveries = Bosta::Delivery.find_all_deliveries();
delivery = Bosta::Delivery.find_delivery_by_traking_number(tracking_number);
tracking_history = Bosta::Delivery.track_delivery(tracking_number);
airwayBill = Bosta::Delivery.print_delivery_awb(delivery_id);
Bosta::Delivery.terminate_delivery(delivery_id);
pickup_locations = Bosta::Pickup.find_pickup_locations();
business_location_id = pickup_locations["pickupLocations"][0]['_id'];
create_pickup = Bosta::Pickup.create(business_location_id, scheduled_date, scheduled_time_slot, contact_person);
update_pickup = Bosta::Pickup.update(pickup_id, business_location_id=nil, scheduled_date=nil, scheduled_time_slot=nil, contact_person=nil, notes=nil);
pickup_requests = Bosta::Pickup.find_pickups();
pikcup_request = Bosta::Pickup.find_pickup_by_id(pickup_id);
Bosta::Pickup.delete_pickup(pickup_id);
cities = Bosta::City.find_all_cities();
zones = Bosta::City.show_city_zones(city_id);
We are open to, and grateful for, any contributions made by the community. By contributing to Bosta, you agree to abide by the code of conduct.
The MIT License (MIT) License.