# CyberbizExpress Ninja Van API Document: https://api-docs.ninjavan.co/en ## Installation Add this line to your application's Gemfile: ```ruby gem 'cyberbiz_express' ``` And then execute: $ bundle Or install it yourself as: $ gem install cyberbiz_express ## Usage ### Ninja Van ### config/initializers/ninja_van.rb ```ruby require 'cyberbiz_express/ninja_van/ninja_van' CyberbizExpress::NinjaVan.configure do |config|ÂÂÂÂ config.client_id = SecretSetting.ninja_van.client_id config.client_secret = SecretSetting.ninja_van.client_secret config.api_url = if Rails.env.production? 'https://api.ninjavan.co/my' else 'https://api-sandbox.ninjavan.co/sg' end end ``` ### submit_order ```ruby order = { number: '1101', email: 'buyer@cyberbiz.io', line_items: [{ name: 'test1', quantity: 3 },{ name: 'test2', quantity: 1 }], } shipping_address = { name: 'Jane Doe', phone: '+60103067174', email: 'sample_to@cyberbiz,io', address1: 'Jalan PJU 8/8', address2: '', district: 'Damansara Perdana', city: 'Petaling Jaya', province: 'Selangor', location: 'MY', zip_code: '47820', } shop = { id: 24719, name: 'My Shop', phone: '+60138201527', email: 'sample@cyberbiz,io', address: '17 Lorong Jambu 3', district: 'Taman Sri Delima', city: 'Simpang Ampat', province: 'Pulau Pinang', location: 'MY', zip_code: '51200', } options = { service_type: 'Parcel', pickup_date: '2024-12-31', pickup_start_time: '09:01', pickup_end_time: '13:31', delivery_date: '2025-01-12', delivery_start_time: '09:01', delivery_end_time: '13:31', insured_value: 300.21, total_weight: 4.5, pickup_instructions: 'If recipient is not around, leave parcel in power riser.', delivery_instructions: 'Hello Ninja Van!', } CyberbizExpress::NinjaVan::Api.new('ninja_van').submit_order(order, shipping_address, shop, options) ``` ### update_order ```ruby CyberbizExpress::NinjaVan::Api.new('ninja_van').update_order('CYB14530O1103', {}) ``` ### cancel_order ```ruby CyberbizExpress::NinjaVan::Api.new('ninja_van').cancel_order('FF0194810413', {}, {}, {}) ```