Class: OCI::Onesubscription::Models::SubscribedServiceLocation

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/onesubscription/models/subscribed_service_location.rb

Overview

Address location.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SubscribedServiceLocation

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :address1 (String)

    The value to assign to the #address1 property

  • :address2 (String)

    The value to assign to the #address2 property

  • :postal_code (String)

    The value to assign to the #postal_code property

  • :city (String)

    The value to assign to the #city property

  • :country (String)

    The value to assign to the #country property

  • :region (String)

    The value to assign to the #region property

  • :tca_location_id (Integer)

    The value to assign to the #tca_location_id property



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 90

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.address1 = attributes[:'address1'] if attributes[:'address1']

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

  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.city = attributes[:'city'] if attributes[:'city']

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

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

  self.tca_location_id = attributes[:'tcaLocationId'] if attributes[:'tcaLocationId']

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

  self.tca_location_id = attributes[:'tca_location_id'] if attributes[:'tca_location_id']
end

Instance Attribute Details

#address1String

Address first line.

Returns:

  • (String)


15
16
17
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 15

def address1
  @address1
end

#address2String

Address second line.

Returns:

  • (String)


20
21
22
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 20

def address2
  @address2
end

#cityString

City.

Returns:

  • (String)


30
31
32
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 30

def city
  @city
end

#countryString

Country.

Returns:

  • (String)


35
36
37
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 35

def country
  @country
end

#postal_codeString

Postal code.

Returns:

  • (String)


25
26
27
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 25

def postal_code
  @postal_code
end

#regionString

Region.

Returns:

  • (String)


40
41
42
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 40

def region
  @region
end

#tca_location_idInteger

Region.

Returns:

  • (Integer)


45
46
47
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 45

def tca_location_id
  @tca_location_id
end

Class Method Details

.attribute_mapObject

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



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 48

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'address1': :'address1',
    'address2': :'address2',
    'postal_code': :'postalCode',
    'city': :'city',
    'country': :'country',
    'region': :'region',
    'tca_location_id': :'tcaLocationId'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 63

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'address1': :'String',
    'address2': :'String',
    'postal_code': :'String',
    'city': :'String',
    'country': :'String',
    'region': :'String',
    'tca_location_id': :'Integer'
    # 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



126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 126

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

  self.class == other.class &&
    address1 == other.address1 &&
    address2 == other.address2 &&
    postal_code == other.postal_code &&
    city == other.city &&
    country == other.country &&
    region == other.region &&
    tca_location_id == other.tca_location_id
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



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 162

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


142
143
144
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 142

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



151
152
153
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 151

def hash
  [address1, address2, postal_code, city, country, region, tca_location_id].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



195
196
197
198
199
200
201
202
203
204
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 195

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



189
190
191
# File 'lib/oci/onesubscription/models/subscribed_service_location.rb', line 189

def to_s
  to_hash.to_s
end