Class: ShiprocketAPI::CustomOrder

Inherits:
Base
  • Object
show all
Includes:
Shared::OrderHelper
Defined in:
lib/shiprocket_api/resources/custom_order.rb

Constant Summary collapse

DEFAULT_ATTRS =
{
  order_id: '',
  order_date: Date.today.strftime('%Y-%m-%d'),
  pickup_location: '',
  channel_id: '',
  comment: '',
  reseller_name: '',
  company_name: '',
  billing_customer_name: '',
  billing_last_name: '',
  billing_address: '',
  billing_address_2: '',
  billing_city: '',
  billing_pincode: '',
  billing_state: '',
  billing_country: '',
  billing_email: '',
  billing_phone: '',
  billing_alternate_phone: '',
  shipping_is_billing: true,
  order_items: [
    ShiprocketAPI::OrderItem.new
  ],
  payment_method: 'Prepaid',
  sub_total: '',
  length: '',
  breadth: '',
  height: '',
  weight: ''
}

Instance Method Summary collapse

Methods included from Shared::OrderHelper

#create_pickup, #generate_label

Methods inherited from Base

clear_session, create_session, #initialize, set_prefix, temp_session

Constructor Details

This class inherits a constructor from ShiprocketAPI::Base

Instance Method Details

#generate_awb(courier_id:) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/shiprocket_api/resources/custom_order.rb', line 41

def generate_awb(courier_id:)
  return false unless attributes['shipment_id'] && shipment_id != 0

  self.awb = ::ShiprocketAPI::Awb.new(
    shipment_id: shipment_id,
    courier_id: courier_id,
    is_return: 0
  )
  awb.save
end