Class: DHLEcommerceAPI::Shipment::ShipmentItem

Inherits:
Base
  • Object
show all
Defined in:
lib/dhl_ecommerce_api/resources/shipment/shipment_item.rb

Overview

Component item

Instance Method Summary collapse

Methods inherited from Base

#account_ids, #attributes_with_account_ids, #custom_key_format, #handle_errors

Constructor Details

#initialize(attributes = {}, persisted = false) ⇒ ShipmentItem

Returns a new instance of ShipmentItem.



6
7
8
9
10
11
12
13
# File 'lib/dhl_ecommerce_api/resources/shipment/shipment_item.rb', line 6

def initialize(attributes = {}, persisted = false)
  status = attributes["response_status"]
  if status.present? && status["code"] != "200"
    error_messages = status["message_details"].map{|err| err["message_detail"]}
    handle_errors(status["code"], error_messages) 
  end
  super
end