Sha256: 53534fb962dd5096939a21c43e01ad282a044e3759c6ccf97ed71f1e3d299756

Contents?: true

Size: 1.91 KB

Versions: 1

Compression:

Stored size: 1.91 KB

Contents

# 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 = {
  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',
  total_weight: 4.5,
}
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', {}, {}, {})
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cyberbiz_express-0.1.0 README.md