Class: NinjaVanApi::WaybillResource

Inherits:
BaseResource show all
Defined in:
lib/ninja_van_api/resources/waybill_resource.rb

Instance Attribute Summary

Attributes inherited from BaseResource

#client

Instance Method Summary collapse

Methods inherited from BaseResource

#delete_request, #get_request, #initialize, #post_request, #put_request

Constructor Details

This class inherits a constructor from NinjaVanApi::BaseResource

Instance Method Details

#get(tracking_number, hide_shipper_details: nil, orientation: nil) ⇒ Waybill

Retrieves a waybill for a given tracking number

Parameters:

  • tracking_number (String)

    The tracking number as generated by the Order API

  • hide_shipper_details (Boolean) (defaults to: nil)

    A flag for hiding shipper’s details

  • orientation (String) (defaults to: nil)

    Specifies the orientation of the generated waybill (“portrait” or “landscape”)

Returns:



10
11
12
13
14
15
16
17
# File 'lib/ninja_van_api/resources/waybill_resource.rb', line 10

def get(tracking_number, hide_shipper_details: nil, orientation: nil)
  params = { tid: tracking_number }
  params[:hide_shipper_details] = hide_shipper_details unless hide_shipper_details.nil?
  params[:orientation] = orientation if orientation

  response = get_request("2.0/reports/waybill", params: params)
  Waybill.new(response.body)
end