Class: NewStoreApi::StoreUpdateV1Dto

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

Overview

StoreUpdateV1Dto 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(country_code = nil, config = SKIP, description = SKIP) ⇒ StoreUpdateV1Dto

Returns a new instance of StoreUpdateV1Dto.



46
47
48
49
50
# File 'lib/new_store_api/models/store_update_v1_dto.rb', line 46

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

Instance Attribute Details

#configObject

Store configuration.

Returns:

  • (Object)


14
15
16
# File 'lib/new_store_api/models/store_update_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_update_v1_dto.rb', line 18

def country_code
  @country_code
end

#descriptionString

Store description.

Returns:

  • (String)


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

def description
  @description
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/new_store_api/models/store_update_v1_dto.rb', line 53

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  country_code = hash.key?('country_code') ? hash['country_code'] : nil
  config = hash.key?('config') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:StoreUpdateV1DtoConfig), hash['config']
  ) : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP

  # Create object from extracted values.
  StoreUpdateV1Dto.new(country_code,
                       config,
                       description)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/new_store_api/models/store_update_v1_dto.rb', line 25

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

.nullablesObject

An array for nullable fields



42
43
44
# File 'lib/new_store_api/models/store_update_v1_dto.rb', line 42

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
# File 'lib/new_store_api/models/store_update_v1_dto.rb', line 34

def self.optionals
  %w[
    config
    description
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/new_store_api/models/store_update_v1_dto.rb', line 71

def self.validate(value)
  if value.instance_of? self
    return APIHelper.valid_type?(value.country_code,
                                 ->(val) { val.instance_of? String })
  end

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['country_code'],
                        ->(val) { val.instance_of? String })
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



91
92
93
94
95
# File 'lib/new_store_api/models/store_update_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}>"
end

#to_sObject

Provides a human-readable string representation of the object.



84
85
86
87
88
# File 'lib/new_store_api/models/store_update_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}>"
end