Class: NewStoreApi::OfflineCountryConfigMetadataV1Dto

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

Overview

OfflineCountryConfigMetadataV1Dto 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(enabled = nil, strategy = nil, allowed_strategies = SKIP, editable = SKIP) ⇒ OfflineCountryConfigMetadataV1Dto

Returns a new instance of OfflineCountryConfigMetadataV1Dto.



53
54
55
56
57
58
59
# File 'lib/new_store_api/models/offline_country_config_metadata_v1_dto.rb', line 53

def initialize(enabled = nil, strategy = nil, allowed_strategies = SKIP,
               editable = SKIP)
  @allowed_strategies = allowed_strategies unless allowed_strategies == SKIP
  @editable = editable unless editable == SKIP
  @enabled = enabled
  @strategy = strategy
end

Instance Attribute Details

#allowed_strategiesArray[TransactionSignatureStrategyEnum]

List of allowed strategies for the current country.

  • Metadata field.


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

def allowed_strategies
  @allowed_strategies
end

#editableTrueClass | FalseClass

Defines whether offline mode can be enabled for this country.

  • Metadata field.

Returns:

  • (TrueClass | FalseClass)


20
21
22
# File 'lib/new_store_api/models/offline_country_config_metadata_v1_dto.rb', line 20

def editable
  @editable
end

#enabledTrueClass | FalseClass

Defines whether offline mode is enabled for this country.

Returns:

  • (TrueClass | FalseClass)


24
25
26
# File 'lib/new_store_api/models/offline_country_config_metadata_v1_dto.rb', line 24

def enabled
  @enabled
end

#strategyTransactionSignatureStrategyEnum

Defines whether offline mode is enabled for this country.



28
29
30
# File 'lib/new_store_api/models/offline_country_config_metadata_v1_dto.rb', line 28

def strategy
  @strategy
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/new_store_api/models/offline_country_config_metadata_v1_dto.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  enabled = hash.key?('enabled') ? hash['enabled'] : nil
  strategy = hash.key?('strategy') ? hash['strategy'] : nil
  allowed_strategies =
    hash.key?('allowed_strategies') ? hash['allowed_strategies'] : SKIP
  editable = hash.key?('editable') ? hash['editable'] : SKIP

  # Create object from extracted values.
  OfflineCountryConfigMetadataV1Dto.new(enabled,
                                        strategy,
                                        allowed_strategies,
                                        editable)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
38
# File 'lib/new_store_api/models/offline_country_config_metadata_v1_dto.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['allowed_strategies'] = 'allowed_strategies'
  @_hash['editable'] = 'editable'
  @_hash['enabled'] = 'enabled'
  @_hash['strategy'] = 'strategy'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/new_store_api/models/offline_country_config_metadata_v1_dto.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
44
45
46
# File 'lib/new_store_api/models/offline_country_config_metadata_v1_dto.rb', line 41

def self.optionals
  %w[
    allowed_strategies
    editable
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



87
88
89
90
91
# File 'lib/new_store_api/models/offline_country_config_metadata_v1_dto.rb', line 87

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} allowed_strategies: #{@allowed_strategies.inspect}, editable:"\
  " #{@editable.inspect}, enabled: #{@enabled.inspect}, strategy: #{@strategy.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



80
81
82
83
84
# File 'lib/new_store_api/models/offline_country_config_metadata_v1_dto.rb', line 80

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} allowed_strategies: #{@allowed_strategies}, editable: #{@editable},"\
  " enabled: #{@enabled}, strategy: #{@strategy}>"
end