Class: OpenapiClient::Items

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_client/models/items.rb

Overview

Network information.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Items

Initializes the object

Parameters:

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

    Model attributes in the form of hash



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/openapi_client/models/items.rb', line 124

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Items` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Items`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'network_type')
    self.network_type = attributes[:'network_type']
  end

  if attributes.key?(:'ip')
    self.ip = attributes[:'ip']
  end

  if attributes.key?(:'phone_number')
    self.phone_number = attributes[:'phone_number']
  end

  if attributes.key?(:'carrier_name')
    self.carrier_name = attributes[:'carrier_name']
  end

  if attributes.key?(:'mobile_country_code')
    self.mobile_country_code = attributes[:'mobile_country_code']
  end

  if attributes.key?(:'mobile_network_code')
    self.mobile_network_code = attributes[:'mobile_network_code']
  end

  if attributes.key?(:'subscription_identification_number')
    self.subscription_identification_number = attributes[:'subscription_identification_number']
  end

  if attributes.key?(:'location_area_code')
    self.location_area_code = attributes[:'location_area_code']
  end

  if attributes.key?(:'cell_id')
    self.cell_id = attributes[:'cell_id']
  end

  if attributes.key?(:'standard')
    self.standard = attributes[:'standard']
  end

  if attributes.key?(:'mac')
    self.mac = attributes[:'mac']
  end

  if attributes.key?(:'ssid')
    self.ssid = attributes[:'ssid']
  end

  if attributes.key?(:'bssid')
    self.bssid = attributes[:'bssid']
  end

  if attributes.key?(:'user_defined')
    self.user_defined = attributes[:'user_defined']
  end
end

Instance Attribute Details

#bssidObject

The Wi-Fi networks Basic Service Set Identifier (BSSID).



55
56
57
# File 'lib/openapi_client/models/items.rb', line 55

def bssid
  @bssid
end

#carrier_nameObject

The network carrier name.



28
29
30
# File 'lib/openapi_client/models/items.rb', line 28

def carrier_name
  @carrier_name
end

#cell_idObject

The Cell ID (CID) is identifier for a specific Base Transceiver Station (BTS) within a specific Location Area Code (LAC).



43
44
45
# File 'lib/openapi_client/models/items.rb', line 43

def cell_id
  @cell_id
end

#ipObject

The IPv4 or IPv6 address of the device if the network assigned one.



22
23
24
# File 'lib/openapi_client/models/items.rb', line 22

def ip
  @ip
end

#location_area_codeObject

The Location Area Code (LAC) is a 16-bit identifier for a region that is covered by a set of network antennas.



40
41
42
# File 'lib/openapi_client/models/items.rb', line 40

def location_area_code
  @location_area_code
end

#macObject

The MAC address of the device that is connected to the Wi-Fi network.



49
50
51
# File 'lib/openapi_client/models/items.rb', line 49

def mac
  @mac
end

#mobile_country_codeObject

The Mobile Country Code (MCC) as described in the ITUs E.212 specification.



31
32
33
# File 'lib/openapi_client/models/items.rb', line 31

def mobile_country_code
  @mobile_country_code
end

#mobile_network_codeObject

The Mobile Network Code (MNC) as described in the ITUs E.212 specification.



34
35
36
# File 'lib/openapi_client/models/items.rb', line 34

def mobile_network_code
  @mobile_network_code
end

#network_typeObject

Defines the type of network associated with the device.



19
20
21
# File 'lib/openapi_client/models/items.rb', line 19

def network_type
  @network_type
end

#phone_numberObject

The devices primary phone number. This value should be supplied directly without any transformation (e.g. removal of spaces, hyphens or parentheses). If this data is available in segregated fields, it should be concatenated using a blank space (" ") as a separator.



25
26
27
# File 'lib/openapi_client/models/items.rb', line 25

def phone_number
  @phone_number
end

#ssidObject

The Wi-Fi networks Service Set Identifier (SSID).



52
53
54
# File 'lib/openapi_client/models/items.rb', line 52

def ssid
  @ssid
end

#standardObject

An identifier of the network standard used.



46
47
48
# File 'lib/openapi_client/models/items.rb', line 46

def standard
  @standard
end

#subscription_identification_numberObject

The Mobile Subscription Identification Number code (MSIN) as described in the ITUs E.212 specification.



37
38
39
# File 'lib/openapi_client/models/items.rb', line 37

def subscription_identification_number
  @subscription_identification_number
end

#user_definedObject

A JSON object that can carry any additional information about the network that might be helpful for fraud detection.



58
59
60
# File 'lib/openapi_client/models/items.rb', line 58

def user_defined
  @user_defined
end

Class Method Details

.attribute_mapObject

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



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/openapi_client/models/items.rb', line 83

def self.attribute_map
  {
    :'network_type' => :'networkType',
    :'ip' => :'ip',
    :'phone_number' => :'phoneNumber',
    :'carrier_name' => :'carrierName',
    :'mobile_country_code' => :'mobileCountryCode',
    :'mobile_network_code' => :'mobileNetworkCode',
    :'subscription_identification_number' => :'subscriptionIdentificationNumber',
    :'location_area_code' => :'locationAreaCode',
    :'cell_id' => :'cellId',
    :'standard' => :'standard',
    :'mac' => :'mac',
    :'ssid' => :'ssid',
    :'bssid' => :'bssid',
    :'user_defined' => :'userDefined'
  }
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



260
261
262
# File 'lib/openapi_client/models/items.rb', line 260

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_typesObject

Attribute type mapping.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/openapi_client/models/items.rb', line 103

def self.openapi_types
  {
    :'network_type' => :'String',
    :'ip' => :'String',
    :'phone_number' => :'String',
    :'carrier_name' => :'String',
    :'mobile_country_code' => :'String',
    :'mobile_network_code' => :'String',
    :'subscription_identification_number' => :'String',
    :'location_area_code' => :'String',
    :'cell_id' => :'String',
    :'standard' => :'String',
    :'mac' => :'String',
    :'ssid' => :'String',
    :'bssid' => :'String',
    :'user_defined' => :'Object'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/openapi_client/models/items.rb', line 226

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      network_type == o.network_type &&
      ip == o.ip &&
      phone_number == o.phone_number &&
      carrier_name == o.carrier_name &&
      mobile_country_code == o.mobile_country_code &&
      mobile_network_code == o.mobile_network_code &&
      subscription_identification_number == o.subscription_identification_number &&
      location_area_code == o.location_area_code &&
      cell_id == o.cell_id &&
      standard == o.standard &&
      mac == o.mac &&
      ssid == o.ssid &&
      bssid == o.bssid &&
      user_defined == o.user_defined
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/openapi_client/models/items.rb', line 288

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    klass = OpenapiClient.const_get(type)
    if klass.respond_to?(:openapi_discriminator_name)
      klass = OpenapiClient.const_get(value[klass.attribute_map[klass.openapi_discriminator_name]])
    end
 
    klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/openapi_client/models/items.rb', line 362

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes, attribute_map = self.class.attribute_map, openapi_types = self.class.openapi_types) ⇒ 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
# File 'lib/openapi_client/models/items.rb', line 267

def build_from_hash(attributes, attribute_map = self.class.attribute_map, openapi_types = self.class.openapi_types)
  return nil unless attributes.is_a?(Hash)
  openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[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?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


247
248
249
# File 'lib/openapi_client/models/items.rb', line 247

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



253
254
255
# File 'lib/openapi_client/models/items.rb', line 253

def hash
  [network_type, ip, phone_number, carrier_name, mobile_country_code, mobile_network_code, subscription_identification_number, location_area_code, cell_id, standard, mac, ssid, bssid, user_defined].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



196
197
198
199
200
201
202
203
# File 'lib/openapi_client/models/items.rb', line 196

def list_invalid_properties
  invalid_properties = Array.new
  if @network_type.nil?
    invalid_properties.push('invalid value for "network_type", network_type cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



338
339
340
# File 'lib/openapi_client/models/items.rb', line 338

def to_body
  to_hash
end

#to_hash(attribute_map = self.class.attribute_map, openapi_nullable = Set.new([])) ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/openapi_client/models/items.rb', line 344

def to_hash(attribute_map = self.class.attribute_map, openapi_nullable = Set.new([]))
  hash = {}
  attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end
    
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



332
333
334
# File 'lib/openapi_client/models/items.rb', line 332

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



207
208
209
210
211
212
# File 'lib/openapi_client/models/items.rb', line 207

def valid?
  return false if @network_type.nil?
  network_type_validator = EnumAttributeValidator.new('String', ["network/mobile", "network/wifi"])
  return false unless network_type_validator.valid?(@network_type)
  true
end