Class: NewStoreApi::StoreCreateV1Dto

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/store_create_v1_dto.rb

Overview

StoreCreateV1Dto Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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, description = SKIP) ⇒ StoreCreateV1Dto

Returns a new instance of StoreCreateV1Dto.



55
56
57
58
59
60
61
62
# File 'lib/new_store_api/models/store_create_v1_dto.rb', line 55

def initialize(config = nil, country_code = nil, id = nil,
               multi_cashbox = nil, description = SKIP)
  @config = config
  @country_code = country_code
  @description = description unless description == SKIP
  @id = id
  @multi_cashbox = multi_cashbox
end

Instance Attribute Details

#configStoreConfigV1Dto

Store configuration.

Returns:



14
15
16
# File 'lib/new_store_api/models/store_create_v1_dto.rb', line 14

def config
  @config
end

#country_codeString

Store configuration.

Returns:

  • (String)


18
19
20
# File 'lib/new_store_api/models/store_create_v1_dto.rb', line 18

def country_code
  @country_code
end

#descriptionString

Store name/description.

Returns:

  • (String)


22
23
24
# File 'lib/new_store_api/models/store_create_v1_dto.rb', line 22

def description
  @description
end

#idString

Store identifier.

Returns:

  • (String)


26
27
28
# File 'lib/new_store_api/models/store_create_v1_dto.rb', line 26

def id
  @id
end

#multi_cashboxTrueClass | FalseClass

Flag that indicates if multiple cashboxes are allowed in the store.

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/new_store_api/models/store_create_v1_dto.rb', line 30

def multi_cashbox
  @multi_cashbox
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/new_store_api/models/store_create_v1_dto.rb', line 65

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
  description = hash.key?('description') ? hash['description'] : SKIP

  # Create object from extracted values.
  StoreCreateV1Dto.new(config,
                       country_code,
                       id,
                       multi_cashbox,
                       description)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/new_store_api/models/store_create_v1_dto.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['config'] = 'config'
  @_hash['country_code'] = 'country_code'
  @_hash['description'] = 'description'
  @_hash['id'] = 'id'
  @_hash['multi_cashbox'] = 'multi_cashbox'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/new_store_api/models/store_create_v1_dto.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
# File 'lib/new_store_api/models/store_create_v1_dto.rb', line 44

def self.optionals
  %w[
    description
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



91
92
93
94
95
96
# File 'lib/new_store_api/models/store_create_v1_dto.rb', line 91

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} config: #{@config.inspect}, country_code: #{@country_code.inspect},"\
  " description: #{@description.inspect}, id: #{@id.inspect}, multi_cashbox:"\
  " #{@multi_cashbox.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



84
85
86
87
88
# File 'lib/new_store_api/models/store_create_v1_dto.rb', line 84

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} config: #{@config}, country_code: #{@country_code}, description:"\
  " #{@description}, id: #{@id}, multi_cashbox: #{@multi_cashbox}>"
end