Class: OCI::ThreatIntelligence::Models::GeodataDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/threat_intelligence/models/geodata_details.rb

Overview

Geodata information for a given IP address

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GeodataDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :routed_prefix (String)

    The value to assign to the #routed_prefix property

  • :origin (String)

    The value to assign to the #origin property

  • :geo_id (String)

    The value to assign to the #geo_id property

  • :country_code (String)

    The value to assign to the #country_code property

  • :admin_div (String)

    The value to assign to the #admin_div property

  • :city (String)

    The value to assign to the #city property

  • :latitude (String)

    The value to assign to the #latitude property

  • :longitude (String)

    The value to assign to the #longitude property

  • :label (String)

    The value to assign to the #label property



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 96

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

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

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

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

  self.geo_id = attributes[:'geoId'] if attributes[:'geoId']

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

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

  self.country_code = attributes[:'countryCode'] if attributes[:'countryCode']

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

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

  self.admin_div = attributes[:'adminDiv'] if attributes[:'adminDiv']

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

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

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

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

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

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

Instance Attribute Details

#admin_divString

[Required] State/Province/subdivision within the country

Returns:

  • (String)


29
30
31
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 29

def admin_div
  @admin_div
end

#cityString

[Required] City of origin

Returns:

  • (String)


33
34
35
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 33

def city
  @city
end

#country_codeString

[Required] Two-letter abbreviation for country of origin

Returns:

  • (String)


25
26
27
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 25

def country_code
  @country_code
end

#geo_idString

Unique Identifier (optional)

Returns:

  • (String)


21
22
23
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 21

def geo_id
  @geo_id
end

#labelString

[Required] Information on source providing the information

Returns:

  • (String)


45
46
47
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 45

def label
  @label
end

#latitudeString

[Required] Latitude

Returns:

  • (String)


37
38
39
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 37

def latitude
  @latitude
end

#longitudeString

[Required] Longitude

Returns:

  • (String)


41
42
43
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 41

def longitude
  @longitude
end

#originString

[Required] ASN entry

Returns:

  • (String)


17
18
19
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 17

def origin
  @origin
end

#routed_prefixString

Encompassing assigned prefix for the IP

Returns:

  • (String)


13
14
15
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 13

def routed_prefix
  @routed_prefix
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
61
62
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 48

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'routed_prefix': :'routedPrefix',
    'origin': :'origin',
    'geo_id': :'geoId',
    'country_code': :'countryCode',
    'admin_div': :'adminDiv',
    'city': :'city',
    'latitude': :'latitude',
    'longitude': :'longitude',
    'label': :'label'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 65

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'routed_prefix': :'String',
    'origin': :'String',
    'geo_id': :'String',
    'country_code': :'String',
    'admin_div': :'String',
    'city': :'String',
    'latitude': :'String',
    'longitude': :'String',
    'label': :'String'
    # 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



144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 144

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

  self.class == other.class &&
    routed_prefix == other.routed_prefix &&
    origin == other.origin &&
    geo_id == other.geo_id &&
    country_code == other.country_code &&
    admin_div == other.admin_div &&
    city == other.city &&
    latitude == other.latitude &&
    longitude == other.longitude &&
    label == other.label
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



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 182

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


162
163
164
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 162

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



171
172
173
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 171

def hash
  [routed_prefix, origin, geo_id, country_code, admin_div, city, latitude, longitude, label].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



215
216
217
218
219
220
221
222
223
224
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 215

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



209
210
211
# File 'lib/oci/threat_intelligence/models/geodata_details.rb', line 209

def to_s
  to_hash.to_s
end