Class: NewStoreApi::TenantConfigV1Dto

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

Overview

TenantConfigV1Dto 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(environment = nil, offline_countries = nil, version = nil, created_at = SKIP, updated_at = SKIP, updated_by = SKIP) ⇒ TenantConfigV1Dto

Returns a new instance of TenantConfigV1Dto.



64
65
66
67
68
69
70
71
72
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 64

def initialize(environment = nil, offline_countries = nil, version = nil,
               created_at = SKIP, updated_at = SKIP, updated_by = SKIP)
  @created_at = created_at unless created_at == SKIP
  @environment = environment
  @offline_countries = offline_countries
  @updated_at = updated_at unless updated_at == SKIP
  @updated_by = updated_by unless updated_by == SKIP
  @version = version
end

Instance Attribute Details

#created_atDateTime

Creation date of the configuration.

Returns:

  • (DateTime)


15
16
17
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 15

def created_at
  @created_at
end

#environmentFiscalEnvironmentEnum

Creation date of the configuration.



19
20
21
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 19

def environment
  @environment
end

#offline_countriesOfflineCountriesConfigMetadataV1Dto

Offline mode configuration per country.



23
24
25
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 23

def offline_countries
  @offline_countries
end

#updated_atDateTime

Latest update date of the configuration.

Returns:

  • (DateTime)


27
28
29
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 27

def updated_at
  @updated_at
end

#updated_byString

User identifier who updated the current version of the configuration.

Returns:

  • (String)


31
32
33
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 31

def updated_by
  @updated_by
end

#versionInteger

Version number of the configuration.

  • Version number 0 represents the system defaults.

Returns:

  • (Integer)


36
37
38
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 36

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



75
76
77
78
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
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 75

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  environment = hash.key?('environment') ? hash['environment'] : nil
  if hash['offline_countries']
    offline_countries = OfflineCountriesConfigMetadataV1Dto.from_hash(hash['offline_countries'])
  end
  version = hash.key?('version') ? hash['version'] : nil
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               else
                 SKIP
               end
  updated_at = if hash.key?('updated_at')
                 (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at'])
               else
                 SKIP
               end
  updated_by = hash.key?('updated_by') ? hash['updated_by'] : SKIP

  # Create object from extracted values.
  TenantConfigV1Dto.new(environment,
                        offline_countries,
                        version,
                        created_at,
                        updated_at,
                        updated_by)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
48
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['created_at'] = 'created_at'
  @_hash['environment'] = 'environment'
  @_hash['offline_countries'] = 'offline_countries'
  @_hash['updated_at'] = 'updated_at'
  @_hash['updated_by'] = 'updated_by'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



60
61
62
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 60

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 51

def self.optionals
  %w[
    created_at
    updated_at
    updated_by
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 122

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} created_at: #{@created_at.inspect}, environment: #{@environment.inspect},"\
  " offline_countries: #{@offline_countries.inspect}, updated_at: #{@updated_at.inspect},"\
  " updated_by: #{@updated_by.inspect}, version: #{@version.inspect}>"
end

#to_custom_created_atObject



105
106
107
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 105

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_updated_atObject



109
110
111
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 109

def to_custom_updated_at
  DateTimeHelper.to_rfc3339(updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



114
115
116
117
118
119
# File 'lib/new_store_api/models/tenant_config_v1_dto.rb', line 114

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} created_at: #{@created_at}, environment: #{@environment},"\
  " offline_countries: #{@offline_countries}, updated_at: #{@updated_at}, updated_by:"\
  " #{@updated_by}, version: #{@version}>"
end