class ShiprocketAPI::ReturnOrder
Constants
- DEFAULT_ATTRS
Public Class Methods
find_every(options)
click to toggle source
# File lib/shiprocket_api/resources/return_order.rb, line 53 def find_every(options) set_prefix_to_list_all do prefix_options, query_options = split_options(options[:params]) path = collection_path(prefix_options, query_options) instantiate_collection((format.decode(connection.get(path, headers).body)['data'] || []), query_options, prefix_options) rescue ActiveResource::ResourceNotFound # Swallowing ResourceNotFound exceptions and return nil - as per # ActiveRecord. set_prefix_to_add nil end end
set_prefix_to_list_all(&block)
click to toggle source
# File lib/shiprocket_api/resources/return_order.rb, line 49 def set_prefix_to_list_all(&block) set_prefix("#{Base.prefix}/orders/processing/return", &block) end
Public Instance Methods
generate_awb(courier_id:)
click to toggle source
# File lib/shiprocket_api/resources/return_order.rb, line 68 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: 1 ) awb.save end