Class: NewStoreApi::EasypostAdapterConfig
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::EasypostAdapterConfig
- Defined in:
- lib/new_store_api/models/easypost_adapter_config.rb
Overview
EasypostAdapterConfig Model.
Instance Attribute Summary collapse
-
#base_customization_url ⇒ String
The customization webhook URL to customize the data used to create the shipment.
-
#carrier_accounts ⇒ Hash[String, String]
The name of the shipping carrier in lowercase.
-
#easypost_api_key ⇒ String
The API key provided by EasyPost.
-
#ignore_customization_failure_on_booking ⇒ TrueClass | FalseClass
If set to true, the EasyPost adapter books a shipment with non-customized data if the call to the "base customization URL" fails.
-
#newstore_password ⇒ String
the password provided by NewStore.
-
#newstore_url ⇒ String
Optional: The base URL to NewStore API.
-
#newstore_username ⇒ String
The username provided by NewStore.
-
#shipment_creation_options ⇒ Hash[String, Object]
The name of the shipping carrier in lowercase.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(easypost_api_key = nil, base_customization_url = SKIP, carrier_accounts = SKIP, ignore_customization_failure_on_booking = SKIP, newstore_password = SKIP, newstore_url = SKIP, newstore_username = SKIP, shipment_creation_options = SKIP) ⇒ EasypostAdapterConfig
constructor
A new instance of EasypostAdapterConfig.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(easypost_api_key = nil, base_customization_url = SKIP, carrier_accounts = SKIP, ignore_customization_failure_on_booking = SKIP, newstore_password = SKIP, newstore_url = SKIP, newstore_username = SKIP, shipment_creation_options = SKIP) ⇒ EasypostAdapterConfig
Returns a new instance of EasypostAdapterConfig.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 83 def initialize(easypost_api_key = nil, base_customization_url = SKIP, carrier_accounts = SKIP, ignore_customization_failure_on_booking = SKIP, newstore_password = SKIP, newstore_url = SKIP, newstore_username = SKIP, = SKIP) @base_customization_url = base_customization_url unless base_customization_url == SKIP @carrier_accounts = carrier_accounts unless carrier_accounts == SKIP @easypost_api_key = easypost_api_key unless ignore_customization_failure_on_booking == SKIP @ignore_customization_failure_on_booking = ignore_customization_failure_on_booking end @newstore_password = newstore_password unless newstore_password == SKIP @newstore_url = newstore_url unless newstore_url == SKIP @newstore_username = newstore_username unless newstore_username == SKIP unless == SKIP @shipment_creation_options = end end |
Instance Attribute Details
#base_customization_url ⇒ String
The customization webhook URL to customize the data used to create the shipment.
15 16 17 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 15 def base_customization_url @base_customization_url end |
#carrier_accounts ⇒ Hash[String, String]
The name of the shipping carrier in lowercase.
19 20 21 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 19 def carrier_accounts @carrier_accounts end |
#easypost_api_key ⇒ String
The API key provided by EasyPost.
23 24 25 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 23 def easypost_api_key @easypost_api_key end |
#ignore_customization_failure_on_booking ⇒ TrueClass | FalseClass
If set to true, the EasyPost adapter books a shipment with non-customized data if the call to the "base customization URL" fails. If set to false, the shipment is not booked if the call to the "base customization URL" fails. The value of the flag does not affect the processing of shipping options for the shipment.
31 32 33 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 31 def ignore_customization_failure_on_booking @ignore_customization_failure_on_booking end |
#newstore_password ⇒ String
the password provided by NewStore.
35 36 37 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 35 def newstore_password @newstore_password end |
#newstore_url ⇒ String
Optional: The base URL to NewStore API. This is used to push package status update from carriers.
40 41 42 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 40 def newstore_url @newstore_url end |
#newstore_username ⇒ String
The username provided by NewStore.
44 45 46 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 44 def newstore_username @newstore_username end |
#shipment_creation_options ⇒ Hash[String, Object]
The name of the shipping carrier in lowercase.
48 49 50 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 48 def @shipment_creation_options end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 105 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. easypost_api_key = hash.key?('easypost_api_key') ? hash['easypost_api_key'] : nil base_customization_url = hash.key?('base_customization_url') ? hash['base_customization_url'] : SKIP carrier_accounts = hash.key?('carrier_accounts') ? hash['carrier_accounts'] : SKIP ignore_customization_failure_on_booking = hash.key?('ignore_customization_failure_on_booking') ? hash['ignore_customization_failure_on_booking'] : SKIP newstore_password = hash.key?('newstore_password') ? hash['newstore_password'] : SKIP newstore_url = hash.key?('newstore_url') ? hash['newstore_url'] : SKIP newstore_username = hash.key?('newstore_username') ? hash['newstore_username'] : SKIP = hash.key?('shipment_creation_options') ? hash['shipment_creation_options'] : SKIP # Create object from extracted values. EasypostAdapterConfig.new(easypost_api_key, base_customization_url, carrier_accounts, ignore_customization_failure_on_booking, newstore_password, newstore_url, newstore_username, ) end |
.names ⇒ Object
A mapping from model property names to API property names.
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 51 def self.names @_hash = {} if @_hash.nil? @_hash['base_customization_url'] = 'base_customization_url' @_hash['carrier_accounts'] = 'carrier_accounts' @_hash['easypost_api_key'] = 'easypost_api_key' @_hash['ignore_customization_failure_on_booking'] = 'ignore_customization_failure_on_booking' @_hash['newstore_password'] = 'newstore_password' @_hash['newstore_url'] = 'newstore_url' @_hash['newstore_username'] = 'newstore_username' @_hash['shipment_creation_options'] = 'shipment_creation_options' @_hash end |
.nullables ⇒ Object
An array for nullable fields
79 80 81 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 79 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 66 def self.optionals %w[ base_customization_url carrier_accounts ignore_customization_failure_on_booking newstore_password newstore_url newstore_username shipment_creation_options ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
148 149 150 151 152 153 154 155 156 157 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 148 def inspect class_name = self.class.name.split('::').last "<#{class_name} base_customization_url: #{@base_customization_url.inspect},"\ " carrier_accounts: #{@carrier_accounts.inspect}, easypost_api_key:"\ " #{@easypost_api_key.inspect}, ignore_customization_failure_on_booking:"\ " #{@ignore_customization_failure_on_booking.inspect}, newstore_password:"\ " #{@newstore_password.inspect}, newstore_url: #{@newstore_url.inspect}, newstore_username:"\ " #{@newstore_username.inspect}, shipment_creation_options:"\ " #{@shipment_creation_options.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
137 138 139 140 141 142 143 144 145 |
# File 'lib/new_store_api/models/easypost_adapter_config.rb', line 137 def to_s class_name = self.class.name.split('::').last "<#{class_name} base_customization_url: #{@base_customization_url}, carrier_accounts:"\ " #{@carrier_accounts}, easypost_api_key: #{@easypost_api_key},"\ " ignore_customization_failure_on_booking: #{@ignore_customization_failure_on_booking},"\ " newstore_password: #{@newstore_password}, newstore_url: #{@newstore_url},"\ " newstore_username: #{@newstore_username}, shipment_creation_options:"\ " #{@shipment_creation_options}>" end |