Class: DHLEcommerceAPI::Base
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- DHLEcommerceAPI::Base
show all
- Defined in:
- lib/dhl_ecommerce_api/resources/base.rb
Instance Method Summary
collapse
Instance Method Details
#account_ids ⇒ Object
12
13
14
15
16
17
|
# File 'lib/dhl_ecommerce_api/resources/base.rb', line 12
def account_ids
{
"pickupAccountId": DHLEcommerceAPI.config.pickup_account_id,
"soldToAccountId": DHLEcommerceAPI.config.sold_to_account_id,
}
end
|
#attributes_with_account_ids ⇒ Object
8
9
10
|
# File 'lib/dhl_ecommerce_api/resources/base.rb', line 8
def attributes_with_account_ids
account_ids.merge(attributes)
end
|
custom keys that arent following lowerCamel convention
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/dhl_ecommerce_api/resources/base.rb', line 24
def custom_key_format(key)
case key.to_s
when "shipment_id"
"shipmentID"
when "total_weight_uom"
"totalWeightUOM"
when "dimension_uom"
"dimensionUOM"
when "order_url"
"orderURL"
when "location_id"
"locationID"
when "piece_id"
"pieceID"
when "weight_uom"
"weightUOM"
when "marketplace_url"
"marketplaceURL"
when "handover_id"
"handoverID"
when "email_id"
"emailID"
when "e_pod_required"
"ePODRequired"
else
key.to_s.camelize(:lower)
end
end
|
#handle_errors(code, error_messages) ⇒ Object
19
20
21
|
# File 'lib/dhl_ecommerce_api/resources/base.rb', line 19
def handle_errors(code, error_messages)
errors.add(:base, "#{code} - #{error_messages.join(", ")}")
end
|