Class: NewStoreApi::AddressDataNoV1Dto
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::AddressDataNoV1Dto
- Defined in:
- lib/new_store_api/models/address_data_no_v1_dto.rb
Overview
AddressDataNoV1Dto Model.
Instance Attribute Summary collapse
-
#additional_address_details ⇒ String
Additional address details.
-
#city ⇒ String
City.
-
#country ⇒ String
City.
-
#postal_code ⇒ String
Postal code for the relevant city/post district.
-
#region ⇒ String
Country specific value for indicating the region/province within the tax authority.
-
#street_name ⇒ String
Street name.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(city = nil, country = nil, street_name = nil, additional_address_details = SKIP, postal_code = SKIP, region = SKIP) ⇒ AddressDataNoV1Dto
constructor
A new instance of AddressDataNoV1Dto.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(city = nil, country = nil, street_name = nil, additional_address_details = SKIP, postal_code = SKIP, region = SKIP) ⇒ AddressDataNoV1Dto
Returns a new instance of AddressDataNoV1Dto.
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 63 def initialize(city = nil, country = nil, street_name = nil, additional_address_details = SKIP, postal_code = SKIP, region = SKIP) unless additional_address_details == SKIP @additional_address_details = additional_address_details end @city = city @country = country @postal_code = postal_code unless postal_code == SKIP @region = region unless region == SKIP @street_name = street_name end |
Instance Attribute Details
#additional_address_details ⇒ String
Additional address details.
14 15 16 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 14 def additional_address_details @additional_address_details end |
#city ⇒ String
City.
18 19 20 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 18 def city @city end |
#country ⇒ String
City.
22 23 24 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 22 def country @country end |
#postal_code ⇒ String
Postal code for the relevant city/post district.
26 27 28 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 26 def postal_code @postal_code end |
#region ⇒ String
Country specific value for indicating the region/province within the tax authority.
31 32 33 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 31 def region @region end |
#street_name ⇒ String
Street name.
35 36 37 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 35 def street_name @street_name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 78 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. city = hash.key?('city') ? hash['city'] : nil country = hash.key?('country') ? hash['country'] : nil street_name = hash.key?('street_name') ? hash['street_name'] : nil additional_address_details = hash.key?('additional_address_details') ? hash['additional_address_details'] : SKIP postal_code = hash.key?('postal_code') ? hash['postal_code'] : SKIP region = hash.key?('region') ? hash['region'] : SKIP # Create object from extracted values. AddressDataNoV1Dto.new(city, country, street_name, additional_address_details, postal_code, region) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['additional_address_details'] = 'additional_address_details' @_hash['city'] = 'city' @_hash['country'] = 'country' @_hash['postal_code'] = 'postal_code' @_hash['region'] = 'region' @_hash['street_name'] = 'street_name' @_hash end |
.nullables ⇒ Object
An array for nullable fields
59 60 61 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 59 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 50 def self.optionals %w[ additional_address_details postal_code region ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 101 def self.validate(value) if value.instance_of? self return ( 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.street_name, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( 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['street_name'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
134 135 136 137 138 139 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 134 def inspect class_name = self.class.name.split('::').last "<#{class_name} additional_address_details: #{@additional_address_details.inspect}, city:"\ " #{@city.inspect}, country: #{@country.inspect}, postal_code: #{@postal_code.inspect},"\ " region: #{@region.inspect}, street_name: #{@street_name.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
126 127 128 129 130 131 |
# File 'lib/new_store_api/models/address_data_no_v1_dto.rb', line 126 def to_s class_name = self.class.name.split('::').last "<#{class_name} additional_address_details: #{@additional_address_details}, city: #{@city},"\ " country: #{@country}, postal_code: #{@postal_code}, region: #{@region}, street_name:"\ " #{@street_name}>" end |