Last active
January 4, 2016 04:29
-
-
Save mbeale/8569047 to your computer and use it in GitHub Desktop.
Ruby fetch IDs EasyPost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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