Class: NewStoreApi::StoreV1Dto
- Defined in:
- lib/new_store_api/models/store_v1_dto.rb
Overview
StoreV1Dto Model.
Instance Attribute Summary collapse
-
#cashboxes ⇒ Array[CashboxV1Dto]
List of cashboxes belonging to the store.
-
#config ⇒ StoreConfigV1Dto
Store configuration.
-
#country_code ⇒ String
Store configuration.
-
#description ⇒ String
Store name/description.
-
#id ⇒ String
Store identifier.
-
#multi_cashbox ⇒ TrueClass | FalseClass
Flag that indicates if multiple cashboxes are allowed in the store.
-
#tenant ⇒ String
Tenant identifier.
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(config = nil, country_code = nil, id = nil, multi_cashbox = nil, tenant = nil, cashboxes = SKIP, description = SKIP) ⇒ StoreV1Dto
constructor
A new instance of StoreV1Dto.
-
#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(config = nil, country_code = nil, id = nil, multi_cashbox = nil, tenant = nil, cashboxes = SKIP, description = SKIP) ⇒ StoreV1Dto
Returns a new instance of StoreV1Dto.
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 66 def initialize(config = nil, country_code = nil, id = nil, multi_cashbox = nil, tenant = nil, cashboxes = SKIP, description = SKIP) @cashboxes = cashboxes unless cashboxes == SKIP @config = config @country_code = country_code @description = description unless description == SKIP @id = id @multi_cashbox = multi_cashbox @tenant = tenant end |
Instance Attribute Details
#cashboxes ⇒ Array[CashboxV1Dto]
List of cashboxes belonging to the store.
14 15 16 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 14 def cashboxes @cashboxes end |
#config ⇒ StoreConfigV1Dto
Store configuration.
18 19 20 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 18 def config @config end |
#country_code ⇒ String
Store configuration.
22 23 24 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 22 def country_code @country_code end |
#description ⇒ String
Store name/description.
26 27 28 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 26 def description @description end |
#id ⇒ String
Store identifier.
30 31 32 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 30 def id @id end |
#multi_cashbox ⇒ TrueClass | FalseClass
Flag that indicates if multiple cashboxes are allowed in the store.
34 35 36 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 34 def multi_cashbox @multi_cashbox end |
#tenant ⇒ String
Tenant identifier.
38 39 40 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 38 def tenant @tenant end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 79 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. config = StoreConfigV1Dto.from_hash(hash['config']) if hash['config'] country_code = hash.key?('country_code') ? hash['country_code'] : nil id = hash.key?('id') ? hash['id'] : nil multi_cashbox = hash.key?('multi_cashbox') ? hash['multi_cashbox'] : nil tenant = hash.key?('tenant') ? hash['tenant'] : nil # Parameter is an array, so we need to iterate through it cashboxes = nil unless hash['cashboxes'].nil? cashboxes = [] hash['cashboxes'].each do |structure| cashboxes << (CashboxV1Dto.from_hash(structure) if structure) end end cashboxes = SKIP unless hash.key?('cashboxes') description = hash.key?('description') ? hash['description'] : SKIP # Create object from extracted values. StoreV1Dto.new(config, country_code, id, multi_cashbox, tenant, cashboxes, description) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['cashboxes'] = 'cashboxes' @_hash['config'] = 'config' @_hash['country_code'] = 'country_code' @_hash['description'] = 'description' @_hash['id'] = 'id' @_hash['multi_cashbox'] = 'multi_cashbox' @_hash['tenant'] = 'tenant' @_hash end |
.nullables ⇒ Object
An array for nullable fields
62 63 64 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 62 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 54 def self.optionals %w[ cashboxes description ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
119 120 121 122 123 124 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 119 def inspect class_name = self.class.name.split('::').last "<#{class_name} cashboxes: #{@cashboxes.inspect}, config: #{@config.inspect}, country_code:"\ " #{@country_code.inspect}, description: #{@description.inspect}, id: #{@id.inspect},"\ " multi_cashbox: #{@multi_cashbox.inspect}, tenant: #{@tenant.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
111 112 113 114 115 116 |
# File 'lib/new_store_api/models/store_v1_dto.rb', line 111 def to_s class_name = self.class.name.split('::').last "<#{class_name} cashboxes: #{@cashboxes}, config: #{@config}, country_code:"\ " #{@country_code}, description: #{@description}, id: #{@id}, multi_cashbox:"\ " #{@multi_cashbox}, tenant: #{@tenant}>" end |