Module: AftershipAPI
- Defined in:
- lib/aftership-tracking-sdk/version.rb,
lib/aftership-tracking-sdk.rb,
lib/aftership-tracking-sdk/error.rb,
lib/aftership-tracking-sdk/api_client.rb,
lib/aftership-tracking-sdk/api/courier.rb,
lib/aftership-tracking-sdk/sign_string.rb,
lib/aftership-tracking-sdk/api/tracking.rb,
lib/aftership-tracking-sdk/configuration.rb,
lib/aftership-tracking-sdk/api/estimated_delivery_date.rb
Overview
This code was auto generated by AfterShip SDK Generator. Do not edit the class manually.
Defined Under Namespace
Modules: Model Classes: ApiClient, ApiError, Configuration, CourierApi, EstimatedDeliveryDateApi, InvalidOptionError, InvalidParamError, SignString, TrackingApi
Constant Summary collapse
- REQUEST_ERROR =
'REQUEST_ERROR'
- INVALID_API_KEY =
Common AfterShipError
'INVALID_API_KEY'.freeze
- INVALID_OPTION =
'INVALID_OPTION'.freeze
- RATE_LIMIT_EXCEEDED =
'RATE_LIMIT_EXCEEDED'.freeze
- TIMED_OUT =
"TIMED_OUT".freeze
- INVALID_REQUEST =
"INVALID_REQUEST".freeze
- INVALID_JSON =
"INVALID_JSON".freeze
- TRACKING_ALREADY_EXIST =
"TRACKING_ALREADY_EXIST".freeze
- TRACKING_DOES_NOT_EXIST =
"TRACKING_DOES_NOT_EXIST".freeze
- TRACKING_NUMBER_INVALID =
"TRACKING_NUMBER_INVALID".freeze
- TRACKING_REQUIRED =
"TRACKING_REQUIRED".freeze
- TRACKING_NUMBER_REQUIRED =
"TRACKING_NUMBER_REQUIRED".freeze
- VALUE_INVALID =
"VALUE_INVALID".freeze
- VALUE_REQUIRED =
"VALUE_REQUIRED".freeze
- SLUG_INVALID =
"SLUG_INVALID".freeze
- MISSING_OR_INVALID_REQUIRED_FIELD =
"MISSING_OR_INVALID_REQUIRED_FIELD".freeze
- BAD_COURIER =
"BAD_COURIER".freeze
- INACTIVE_RETRACK_NOT_ALLOWED =
"INACTIVE_RETRACK_NOT_ALLOWED".freeze
- NOTIFICATION_REUQIRED =
"NOTIFICATION_REUQIRED".freeze
- ID_INVALID =
"ID_INVALID".freeze
- RETRACK_ONCE_ALLOWED =
"RETRACK_ONCE_ALLOWED".freeze
- TRACKING_NUMBER_FORMAT_INVALID =
"TRACKING_NUMBER_FORMAT_INVALID".freeze
- API_KEY_INVALID =
"API_KEY_INVALID".freeze
- REQUEST_NOT_ALLOWED =
"REQUEST_NOT_ALLOWED".freeze
- NOT_FOUND =
"NOT_FOUND".freeze
- TOO_MANY_REQUEST =
"TOO_MANY_REQUEST".freeze
- INTERNAL_ERROR =
"INTERNAL_ERROR".freeze
- ERROR_MAP =
{ # Format: metaCode => ErrorCode 400 => INVALID_REQUEST, 4001 => INVALID_JSON, 4003 => TRACKING_ALREADY_EXIST, 4004 => TRACKING_DOES_NOT_EXIST, 4005 => TRACKING_NUMBER_INVALID, 4006 => TRACKING_REQUIRED, 4007 => TRACKING_NUMBER_REQUIRED, 4008 => VALUE_INVALID, 4009 => VALUE_REQUIRED, 4010 => SLUG_INVALID, 4011 => MISSING_OR_INVALID_REQUIRED_FIELD, 4012 => BAD_COURIER, 4013 => INACTIVE_RETRACK_NOT_ALLOWED, 4014 => NOTIFICATION_REUQIRED, 4015 => ID_INVALID, 4016 => RETRACK_ONCE_ALLOWED, 4017 => TRACKING_NUMBER_FORMAT_INVALID, 401 => API_KEY_INVALID, 403 => REQUEST_NOT_ALLOWED, 404 => NOT_FOUND, 429 => TOO_MANY_REQUEST, 500 => INTERNAL_ERROR, 502 => INTERNAL_ERROR, 503 => INTERNAL_ERROR, 504 => INTERNAL_ERROR, }
- VERSION =
'9.0.0'
- AUTHENTICATION_TYPE_API_KEY =
'API_KEY'
- AUTHENTICATION_TYPE_AES =
'AES'
- AUTHENTICATION_TYPE_RSA =
'RSA'
- SDK_PREFIX =
'AFTERSHIP_TRACKING_SDK'
Class Method Summary collapse
Class Method Details
.configure {|config| ... } ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/aftership-tracking-sdk.rb', line 20 def configure config = Configuration.default yield(config) if block_given? config.check if !@is_initialized @is_initialized = true self.constants.each do |c| next unless c[-3..-1] == 'Api' attributes = [:attr1] wrapper_class = self.const_set(c[0..-4], Struct.new(*attributes)) original_class = self.const_get(c) original_class.public_instance_methods(false).each do |m| wrapper_class.class_eval do define_singleton_method m do |**arg| original_class.new.send(m, **arg) end end end end end config end |