Class: NewStoreApi::AddressDataIeV1Dto

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

Overview

AddressDataIeV1Dto 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(address = nil, city = nil, country = nil, postal_code = nil) ⇒ AddressDataIeV1Dto

Returns a new instance of AddressDataIeV1Dto.



48
49
50
51
52
53
# File 'lib/new_store_api/models/address_data_ie_v1_dto.rb', line 48

def initialize(address = nil, city = nil, country = nil, postal_code = nil)
  @address = address
  @city = city
  @country = country
  @postal_code = postal_code
end

Instance Attribute Details

#addressString

Address of the legal entity.

Returns:

  • (String)


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

def address
  @address
end

#cityString

City of the legal entity.

Returns:

  • (String)


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

def city
  @city
end

#countryString

City of the legal entity.

Returns:

  • (String)


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

def country
  @country
end

#postal_codeString

Postal code of the legal entity.

Returns:

  • (String)


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

def postal_code
  @postal_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/new_store_api/models/address_data_ie_v1_dto.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  address = hash.key?('address') ? hash['address'] : nil
  city = hash.key?('city') ? hash['city'] : nil
  country = hash.key?('country') ? hash['country'] : nil
  postal_code = hash.key?('postal_code') ? hash['postal_code'] : nil

  # Create object from extracted values.
  AddressDataIeV1Dto.new(address,
                         city,
                         country,
                         postal_code)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/new_store_api/models/address_data_ie_v1_dto.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['address'] = 'address'
  @_hash['city'] = 'city'
  @_hash['country'] = 'country'
  @_hash['postal_code'] = 'postal_code'
  @_hash
end

.nullablesObject

An array for nullable fields



44
45
46
# File 'lib/new_store_api/models/address_data_ie_v1_dto.rb', line 44

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
# File 'lib/new_store_api/models/address_data_ie_v1_dto.rb', line 39

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



74
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
# File 'lib/new_store_api/models/address_data_ie_v1_dto.rb', line 74

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.address,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.city,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.country,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.postal_code,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['address'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['city'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['country'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['postal_code'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



110
111
112
113
114
# File 'lib/new_store_api/models/address_data_ie_v1_dto.rb', line 110

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} address: #{@address.inspect}, city: #{@city.inspect}, country:"\
  " #{@country.inspect}, postal_code: #{@postal_code.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



103
104
105
106
107
# File 'lib/new_store_api/models/address_data_ie_v1_dto.rb', line 103

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} address: #{@address}, city: #{@city}, country: #{@country}, postal_code:"\
  " #{@postal_code}>"
end