Class: NewStoreApi::CancellationPolicySettingsValue
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::CancellationPolicySettingsValue
- Defined in:
- lib/new_store_api/models/cancellation_policy_settings_value.rb
Overview
Order cancellation policies.
Instance Attribute Summary collapse
-
#default ⇒ TrueClass | FalseClass
Determines whether orders are canceled automatically in case of a conflict.
-
#reasons_to_overwrite_default ⇒ Array[CancellationPolicySettingsReasonsEnum]
A list of reasons to prevent an automatic cancelation of an order (in case default is 'true') or to prevent an order being in the conflict state.
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(default = true, reasons_to_overwrite_default = SKIP) ⇒ CancellationPolicySettingsValue
constructor
A new instance of CancellationPolicySettingsValue.
-
#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(default = true, reasons_to_overwrite_default = SKIP) ⇒ CancellationPolicySettingsValue
Returns a new instance of CancellationPolicySettingsValue.
43 44 45 46 47 48 49 |
# File 'lib/new_store_api/models/cancellation_policy_settings_value.rb', line 43 def initialize(default = true, reasons_to_overwrite_default = SKIP) @default = default unless default == SKIP unless reasons_to_overwrite_default == SKIP @reasons_to_overwrite_default = reasons_to_overwrite_default end end |
Instance Attribute Details
#default ⇒ TrueClass | FalseClass
Determines whether orders are canceled automatically in case of a conflict.
15 16 17 |
# File 'lib/new_store_api/models/cancellation_policy_settings_value.rb', line 15 def default @default end |
#reasons_to_overwrite_default ⇒ Array[CancellationPolicySettingsReasonsEnum]
A list of reasons to prevent an automatic cancelation of an order (in case default is 'true') or to prevent an order being in the conflict state.
20 21 22 |
# File 'lib/new_store_api/models/cancellation_policy_settings_value.rb', line 20 def reasons_to_overwrite_default @reasons_to_overwrite_default end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/new_store_api/models/cancellation_policy_settings_value.rb', line 52 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. default = hash['default'] ||= true reasons_to_overwrite_default = hash.key?('reasons_to_overwrite_default') ? hash['reasons_to_overwrite_default'] : SKIP # Create object from extracted values. CancellationPolicySettingsValue.new(default, reasons_to_overwrite_default) end |
.names ⇒ Object
A mapping from model property names to API property names.
23 24 25 26 27 28 |
# File 'lib/new_store_api/models/cancellation_policy_settings_value.rb', line 23 def self.names @_hash = {} if @_hash.nil? @_hash['default'] = 'default' @_hash['reasons_to_overwrite_default'] = 'reasons_to_overwrite_default' @_hash end |
.nullables ⇒ Object
An array for nullable fields
39 40 41 |
# File 'lib/new_store_api/models/cancellation_policy_settings_value.rb', line 39 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
31 32 33 34 35 36 |
# File 'lib/new_store_api/models/cancellation_policy_settings_value.rb', line 31 def self.optionals %w[ default reasons_to_overwrite_default ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
73 74 75 76 77 |
# File 'lib/new_store_api/models/cancellation_policy_settings_value.rb', line 73 def inspect class_name = self.class.name.split('::').last "<#{class_name} default: #{@default.inspect}, reasons_to_overwrite_default:"\ " #{@reasons_to_overwrite_default.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
66 67 68 69 70 |
# File 'lib/new_store_api/models/cancellation_policy_settings_value.rb', line 66 def to_s class_name = self.class.name.split('::').last "<#{class_name} default: #{@default}, reasons_to_overwrite_default:"\ " #{@reasons_to_overwrite_default}>" end |