Class: InPostUKAPI::ReturnLabel

Inherits:
Base
  • Object
show all
Defined in:
lib/inpost_uk_api/resources/return_label.rb

Class Method Summary collapse

Methods inherited from Base

add_retailer_prefix_option, #initialize, retailer, retailer=, with_account

Constructor Details

This class inherits a constructor from InPostUKAPI::Base

Class Method Details

.find(tracking_id) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/inpost_uk_api/resources/return_label.rb', line 6

def self.find(tracking_id)
  response = connection.get(collection_path(tracking_id: tracking_id))
  response_body = JSON.parse(response.body)
  if response_body['status_code'] == 404
    raise ActiveResource::ResourceNotFound.new(response, response_body['message'])
  end
rescue JSON::ParserError => e
  response.body
end