Class: NewStoreApi::CashDenominationDto
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::CashDenominationDto
- Defined in:
- lib/new_store_api/models/cash_denomination_dto.rb
Overview
CashDenominationDto Model.
Instance Attribute Summary collapse
-
#default_label ⇒ String
Default label of the denomination.
-
#localized_labels ⇒ Object
Labels of the denomination for the supported language code(s).
-
#value ⇒ Float
Value of the denomination.
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(value = nil, default_label = SKIP, localized_labels = SKIP) ⇒ CashDenominationDto
constructor
A new instance of CashDenominationDto.
-
#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(value = nil, default_label = SKIP, localized_labels = SKIP) ⇒ CashDenominationDto
Returns a new instance of CashDenominationDto.
49 50 51 52 53 |
# File 'lib/new_store_api/models/cash_denomination_dto.rb', line 49 def initialize(value = nil, default_label = SKIP, localized_labels = SKIP) @default_label = default_label unless default_label == SKIP @localized_labels = localized_labels unless localized_labels == SKIP @value = value end |
Instance Attribute Details
#default_label ⇒ String
Default label of the denomination.
14 15 16 |
# File 'lib/new_store_api/models/cash_denomination_dto.rb', line 14 def default_label @default_label end |
#localized_labels ⇒ Object
Labels of the denomination for the supported language code(s).
- Key is a ISO 639-1 language code.
- Will be set if the given denomination is represented differently in supported languages.
21 22 23 |
# File 'lib/new_store_api/models/cash_denomination_dto.rb', line 21 def localized_labels @localized_labels end |
#value ⇒ Float
Value of the denomination.
25 26 27 |
# File 'lib/new_store_api/models/cash_denomination_dto.rb', line 25 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/new_store_api/models/cash_denomination_dto.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. value = hash.key?('value') ? hash['value'] : nil default_label = hash.key?('default_label') ? hash['default_label'] : SKIP localized_labels = hash.key?('localized_labels') ? hash['localized_labels'] : SKIP # Create object from extracted values. CashDenominationDto.new(value, default_label, localized_labels) end |
.names ⇒ Object
A mapping from model property names to API property names.
28 29 30 31 32 33 34 |
# File 'lib/new_store_api/models/cash_denomination_dto.rb', line 28 def self.names @_hash = {} if @_hash.nil? @_hash['default_label'] = 'default_label' @_hash['localized_labels'] = 'localized_labels' @_hash['value'] = 'value' @_hash end |
.nullables ⇒ Object
An array for nullable fields
45 46 47 |
# File 'lib/new_store_api/models/cash_denomination_dto.rb', line 45 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
37 38 39 40 41 42 |
# File 'lib/new_store_api/models/cash_denomination_dto.rb', line 37 def self.optionals %w[ default_label localized_labels ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
79 80 81 82 83 |
# File 'lib/new_store_api/models/cash_denomination_dto.rb', line 79 def inspect class_name = self.class.name.split('::').last "<#{class_name} default_label: #{@default_label.inspect}, localized_labels:"\ " #{@localized_labels.inspect}, value: #{@value.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
72 73 74 75 76 |
# File 'lib/new_store_api/models/cash_denomination_dto.rb', line 72 def to_s class_name = self.class.name.split('::').last "<#{class_name} default_label: #{@default_label}, localized_labels: #{@localized_labels},"\ " value: #{@value}>" end |