Skip to content

Instantly share code, notes, and snippets.

@mbeale
Last active January 4, 2016 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbeale/8569047 to your computer and use it in GitHub Desktop.
Save mbeale/8569047 to your computer and use it in GitHub Desktop.
Ruby fetch IDs EasyPost
require "easypost"
EasyPost.api_key = 'YOUR API KEY'
shipment_ids = #fetch a list of shipment ids from your end
shipment_ids.each do |id|
shipment = EasyPost::Shipment.retrieve(id)
if shipment.tracker.status == 'pre_transit'
begin
shipment.refund
rescue
puts 'Shipment refund failed'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment