Class: NewStoreApi::CarriersConfigCarrier
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::CarriersConfigCarrier
- Defined in:
- lib/new_store_api/models/carriers_config_carrier.rb
Overview
CarriersConfigCarrier Model.
Instance Attribute Summary collapse
-
#api_base_url ⇒ String
The shipping provider adapter URL.
-
#api_key ⇒ String
The shipping provider adapter URL.
-
#booking_includes_return ⇒ TrueClass | FalseClass
The shipping provider adapter URL.
-
#return_deliveries_should_be_canceled ⇒ TrueClass | FalseClass
The shipping provider adapter URL.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(api_base_url = nil, api_key = SKIP, booking_includes_return = false, return_deliveries_should_be_canceled = false) ⇒ CarriersConfigCarrier
constructor
A new instance of CarriersConfigCarrier.
-
#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(api_base_url = nil, api_key = SKIP, booking_includes_return = false, return_deliveries_should_be_canceled = false) ⇒ CarriersConfigCarrier
Returns a new instance of CarriersConfigCarrier.
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/new_store_api/models/carriers_config_carrier.rb', line 57 def initialize(api_base_url = nil, api_key = SKIP, booking_includes_return = false, return_deliveries_should_be_canceled = false) @api_base_url = api_base_url @api_key = api_key unless api_key == SKIP @booking_includes_return = booking_includes_return unless booking_includes_return == SKIP unless return_deliveries_should_be_canceled == SKIP @return_deliveries_should_be_canceled = return_deliveries_should_be_canceled end end |
Instance Attribute Details
#api_base_url ⇒ String
The shipping provider adapter URL. Must end with a slash /
14 15 16 |
# File 'lib/new_store_api/models/carriers_config_carrier.rb', line 14 def api_base_url @api_base_url end |
#api_key ⇒ String
The shipping provider adapter URL. Must end with a slash /
18 19 20 |
# File 'lib/new_store_api/models/carriers_config_carrier.rb', line 18 def api_key @api_key end |
#booking_includes_return ⇒ TrueClass | FalseClass
The shipping provider adapter URL. Must end with a slash /
22 23 24 |
# File 'lib/new_store_api/models/carriers_config_carrier.rb', line 22 def booking_includes_return @booking_includes_return end |
#return_deliveries_should_be_canceled ⇒ TrueClass | FalseClass
The shipping provider adapter URL. Must end with a slash /
26 27 28 |
# File 'lib/new_store_api/models/carriers_config_carrier.rb', line 26 def return_deliveries_should_be_canceled @return_deliveries_should_be_canceled end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/new_store_api/models/carriers_config_carrier.rb', line 70 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. api_base_url = hash.key?('api_base_url') ? hash['api_base_url'] : nil api_key = hash.key?('api_key') ? hash['api_key'] : SKIP booking_includes_return = hash['booking_includes_return'] ||= false return_deliveries_should_be_canceled = hash['return_deliveries_should_be_canceled'] ||= false # Create object from extracted values. CarriersConfigCarrier.new(api_base_url, api_key, booking_includes_return, return_deliveries_should_be_canceled) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 37 |
# File 'lib/new_store_api/models/carriers_config_carrier.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['api_base_url'] = 'api_base_url' @_hash['api_key'] = 'api_key' @_hash['booking_includes_return'] = 'booking_includes_return' @_hash['return_deliveries_should_be_canceled'] = 'return_deliveries_should_be_canceled' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 52 53 54 55 |
# File 'lib/new_store_api/models/carriers_config_carrier.rb', line 49 def self.nullables %w[ api_key booking_includes_return return_deliveries_should_be_canceled ] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 46 |
# File 'lib/new_store_api/models/carriers_config_carrier.rb', line 40 def self.optionals %w[ api_key booking_includes_return return_deliveries_should_be_canceled ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/new_store_api/models/carriers_config_carrier.rb', line 89 def self.validate(value) if value.instance_of? self return APIHelper.valid_type?(value.api_base_url, ->(val) { val.instance_of? String }) end return false unless value.instance_of? Hash APIHelper.valid_type?(value['api_base_url'], ->(val) { val.instance_of? String }) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
110 111 112 113 114 115 |
# File 'lib/new_store_api/models/carriers_config_carrier.rb', line 110 def inspect class_name = self.class.name.split('::').last "<#{class_name} api_base_url: #{@api_base_url.inspect}, api_key: #{@api_key.inspect},"\ " booking_includes_return: #{@booking_includes_return.inspect},"\ " return_deliveries_should_be_canceled: #{@return_deliveries_should_be_canceled.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
102 103 104 105 106 107 |
# File 'lib/new_store_api/models/carriers_config_carrier.rb', line 102 def to_s class_name = self.class.name.split('::').last "<#{class_name} api_base_url: #{@api_base_url}, api_key: #{@api_key},"\ " booking_includes_return: #{@booking_includes_return},"\ " return_deliveries_should_be_canceled: #{@return_deliveries_should_be_canceled}>" end |