Class: OCI::IdentityDomains::Models::Addresses

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/identity_domains/models/addresses.rb

Overview

A physical mailing address for this User, as described in (address Element). Canonical Type Values of work, home, and other. The value attribute is a complex type with the following sub-attributes.

Constant Summary collapse

TYPE_ENUM =
[
  TYPE_WORK = 'work'.freeze,
  TYPE_HOME = 'home'.freeze,
  TYPE_OTHER = 'other'.freeze,
  TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Addresses

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :formatted (String)

    The value to assign to the #formatted property

  • :street_address (String)

    The value to assign to the #street_address property

  • :locality (String)

    The value to assign to the #locality property

  • :region (String)

    The value to assign to the #region property

  • :postal_code (String)

    The value to assign to the #postal_code property

  • :country (String)

    The value to assign to the #country property

  • :type (String)

    The value to assign to the #type property

  • :primary (BOOLEAN)

    The value to assign to the #primary property



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/oci/identity_domains/models/addresses.rb', line 179

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.formatted = attributes[:'formatted'] if attributes[:'formatted']

  self.street_address = attributes[:'streetAddress'] if attributes[:'streetAddress']

  raise 'You cannot provide both :streetAddress and :street_address' if attributes.key?(:'streetAddress') && attributes.key?(:'street_address')

  self.street_address = attributes[:'street_address'] if attributes[:'street_address']

  self.locality = attributes[:'locality'] if attributes[:'locality']

  self.region = attributes[:'region'] if attributes[:'region']

  self.postal_code = attributes[:'postalCode'] if attributes[:'postalCode']

  raise 'You cannot provide both :postalCode and :postal_code' if attributes.key?(:'postalCode') && attributes.key?(:'postal_code')

  self.postal_code = attributes[:'postal_code'] if attributes[:'postal_code']

  self.country = attributes[:'country'] if attributes[:'country']

  self.type = attributes[:'type'] if attributes[:'type']

  self.primary = attributes[:'primary'] unless attributes[:'primary'].nil?
end

Instance Attribute Details

#countryString

The country name component.

SCIM++ Properties: - caseExact: false - idcsCanonicalValueSourceFilter: attrName eq "countries" and attrValues.value eq "upper($(country))" - idcsCanonicalValueSourceResourceType: AllowedValue - idcsSearchable: true - multiValued: false - mutability: readWrite - required: false - returned: default - type: string - uniqueness: none

Returns:

  • (String)


103
104
105
# File 'lib/oci/identity_domains/models/addresses.rb', line 103

def country
  @country
end

#formattedString

The full mailing address, formatted for display or use with a mailing label. This attribute MAY contain newlines.

SCIM++ Properties: - caseExact: false - idcsSearchable: true - multiValued: false - mutability: readWrite - required: false - returned: default - type: string - uniqueness: none

Returns:

  • (String)


31
32
33
# File 'lib/oci/identity_domains/models/addresses.rb', line 31

def formatted
  @formatted
end

#localityString

The city or locality component.

SCIM++ Properties: - caseExact: false - idcsSearchable: true - multiValued: false - mutability: readWrite - required: false - returned: default - type: string - uniqueness: none

Returns:

  • (String)


59
60
61
# File 'lib/oci/identity_domains/models/addresses.rb', line 59

def locality
  @locality
end

#postal_codeString

The zipcode or postal code component.

SCIM++ Properties: - caseExact: false - idcsSearchable: true - multiValued: false - mutability: readWrite - required: false - returned: default - type: string - uniqueness: none

Returns:

  • (String)


87
88
89
# File 'lib/oci/identity_domains/models/addresses.rb', line 87

def postal_code
  @postal_code
end

#primaryBOOLEAN

A Boolean value indicating the 'primary' or preferred attribute value for this attribute. The primary attribute value 'true' MUST appear no more than once.

SCIM++ Properties: - caseExact: false - idcsSearchable: true - multiValued: false - mutability: readWrite - required: false - returned: default - type: boolean - uniqueness: none

Returns:

  • (BOOLEAN)


131
132
133
# File 'lib/oci/identity_domains/models/addresses.rb', line 131

def primary
  @primary
end

#regionString

The state or region component.

SCIM++ Properties: - caseExact: false - idcsSearchable: true - multiValued: false - mutability: readWrite - required: false - returned: default - type: string - uniqueness: none

Returns:

  • (String)


73
74
75
# File 'lib/oci/identity_domains/models/addresses.rb', line 73

def region
  @region
end

#street_addressString

The full street address component, which may include house number, street name, PO BOX, and multi-line extended street address information. This attribute MAY contain newlines.

SCIM++ Properties: - caseExact: false - idcsSearchable: true - multiValued: false - mutability: readWrite - required: false - returned: default - type: string - uniqueness: none

Returns:

  • (String)


45
46
47
# File 'lib/oci/identity_domains/models/addresses.rb', line 45

def street_address
  @street_address
end

#typeString

[Required] A label indicating the attribute's function; e.g., 'work' or 'home'.

SCIM++ Properties: - caseExact: false - idcsSearchable: true - multiValued: false - mutability: readWrite - required: true - returned: default - type: string - uniqueness: none

Returns:

  • (String)


117
118
119
# File 'lib/oci/identity_domains/models/addresses.rb', line 117

def type
  @type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/oci/identity_domains/models/addresses.rb', line 134

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'formatted': :'formatted',
    'street_address': :'streetAddress',
    'locality': :'locality',
    'region': :'region',
    'postal_code': :'postalCode',
    'country': :'country',
    'type': :'type',
    'primary': :'primary'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/oci/identity_domains/models/addresses.rb', line 150

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'formatted': :'String',
    'street_address': :'String',
    'locality': :'String',
    'region': :'String',
    'postal_code': :'String',
    'country': :'String',
    'type': :'String',
    'primary': :'BOOLEAN'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/oci/identity_domains/models/addresses.rb', line 230

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    formatted == other.formatted &&
    street_address == other.street_address &&
    locality == other.locality &&
    region == other.region &&
    postal_code == other.postal_code &&
    country == other.country &&
    type == other.type &&
    primary == other.primary
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/oci/identity_domains/models/addresses.rb', line 267

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


247
248
249
# File 'lib/oci/identity_domains/models/addresses.rb', line 247

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



256
257
258
# File 'lib/oci/identity_domains/models/addresses.rb', line 256

def hash
  [formatted, street_address, locality, region, postal_code, country, type, primary].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



300
301
302
303
304
305
306
307
308
309
# File 'lib/oci/identity_domains/models/addresses.rb', line 300

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



294
295
296
# File 'lib/oci/identity_domains/models/addresses.rb', line 294

def to_s
  to_hash.to_s
end