Class: OpenapiClient::Device
- Inherits:
-
Object
- Object
- OpenapiClient::Device
- Defined in:
- lib/openapi_client/models/device.rb
Overview
The device where this transaction originated.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#device_id ⇒ Object
The unique ID of the device.
-
#device_type ⇒ Object
Defines the type of this object.
-
#imei ⇒ Object
The device's International Mobile Equipment Identity (IMEI) as described in IETF RFC7254.
-
#latitude ⇒ Object
The GPS decimal latitude, ranging from (-90.0 to 90.0) where positive numbers indicate locations North of the equator.
-
#longitude ⇒ Object
The GPS decimal longitude, ranging from (-180.0 to 180.0) where positive numbers indicate locations East of the IERS Reference Meridian.
-
#malware_detected ⇒ Object
A flag indicating that malware was detected on the mobile phone.
-
#manufacturer ⇒ Object
The device's manufacturer.
-
#model ⇒ Object
The device's model name.
-
#networks ⇒ Object
Information about the networks associated with the device.
-
#rooted ⇒ Object
A flag indicating that the device has been altered to allow privileged access to users.
-
#timezone_offset ⇒ Object
The timezone offset from UTC to the devices timezone configuration, specified in the format +hh:mm.
-
#user_defined ⇒ Object
A JSON object that can carry any additional information about the device that might be helpful for fraud detection.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Device
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Device
Initializes the object
114 115 116 117 118 119 120 121 122 123 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 |
# File 'lib/openapi_client/models/device.rb', line 114 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 } if attributes.has_key?(:'deviceType') self.device_type = attributes[:'deviceType'] end if attributes.has_key?(:'deviceId') self.device_id = attributes[:'deviceId'] end if attributes.has_key?(:'networks') if (value = attributes[:'networks']).is_a?(Array) self.networks = value end end if attributes.has_key?(:'latitude') self.latitude = attributes[:'latitude'] end if attributes.has_key?(:'longitude') self.longitude = attributes[:'longitude'] end if attributes.has_key?(:'imei') self.imei = attributes[:'imei'] end if attributes.has_key?(:'model') self.model = attributes[:'model'] end if attributes.has_key?(:'manufacturer') self.manufacturer = attributes[:'manufacturer'] end if attributes.has_key?(:'timezoneOffset') self.timezone_offset = attributes[:'timezoneOffset'] end if attributes.has_key?(:'rooted') self.rooted = attributes[:'rooted'] end if attributes.has_key?(:'malwareDetected') self.malware_detected = attributes[:'malwareDetected'] end if attributes.has_key?(:'userDefined') self.user_defined = attributes[:'userDefined'] end end |
Instance Attribute Details
#device_id ⇒ Object
The unique ID of the device. Must be unique for the entire system (not just within a specific merchant or industry).
22 23 24 |
# File 'lib/openapi_client/models/device.rb', line 22 def device_id @device_id end |
#device_type ⇒ Object
Defines the type of this object.
19 20 21 |
# File 'lib/openapi_client/models/device.rb', line 19 def device_type @device_type end |
#imei ⇒ Object
The device's International Mobile Equipment Identity (IMEI) as described in IETF RFC7254.
34 35 36 |
# File 'lib/openapi_client/models/device.rb', line 34 def imei @imei end |
#latitude ⇒ Object
The GPS decimal latitude, ranging from (-90.0 to 90.0) where positive numbers indicate locations North of the equator.
28 29 30 |
# File 'lib/openapi_client/models/device.rb', line 28 def latitude @latitude end |
#longitude ⇒ Object
The GPS decimal longitude, ranging from (-180.0 to 180.0) where positive numbers indicate locations East of the IERS Reference Meridian.
31 32 33 |
# File 'lib/openapi_client/models/device.rb', line 31 def longitude @longitude end |
#malware_detected ⇒ Object
A flag indicating that malware was detected on the mobile phone. This flag should only be set to false if a test was performed and the result was negative. Leave unset otherwise.
49 50 51 |
# File 'lib/openapi_client/models/device.rb', line 49 def malware_detected @malware_detected end |
#manufacturer ⇒ Object
The device's manufacturer.
40 41 42 |
# File 'lib/openapi_client/models/device.rb', line 40 def manufacturer @manufacturer end |
#model ⇒ Object
The device's model name.
37 38 39 |
# File 'lib/openapi_client/models/device.rb', line 37 def model @model end |
#networks ⇒ Object
Information about the networks associated with the device.
25 26 27 |
# File 'lib/openapi_client/models/device.rb', line 25 def networks @networks end |
#rooted ⇒ Object
A flag indicating that the device has been altered to allow privileged access to users. This flag should only be set to false if a test was performed and the result was negative. Leave unset otherwise.
46 47 48 |
# File 'lib/openapi_client/models/device.rb', line 46 def rooted @rooted end |
#timezone_offset ⇒ Object
The timezone offset from UTC to the devices timezone configuration, specified in the format +hh:mm.
43 44 45 |
# File 'lib/openapi_client/models/device.rb', line 43 def timezone_offset @timezone_offset end |
#user_defined ⇒ Object
A JSON object that can carry any additional information about the device that might be helpful for fraud detection.
52 53 54 |
# File 'lib/openapi_client/models/device.rb', line 52 def user_defined @user_defined end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/openapi_client/models/device.rb', line 77 def self.attribute_map { :'device_type' => :'deviceType', :'device_id' => :'deviceId', :'networks' => :'networks', :'latitude' => :'latitude', :'longitude' => :'longitude', :'imei' => :'imei', :'model' => :'model', :'manufacturer' => :'manufacturer', :'timezone_offset' => :'timezoneOffset', :'rooted' => :'rooted', :'malware_detected' => :'malwareDetected', :'user_defined' => :'userDefined' } end |
.openapi_types ⇒ Object
Attribute type mapping.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/openapi_client/models/device.rb', line 95 def self.openapi_types { :'device_type' => :'String', :'device_id' => :'String', :'networks' => :'Array<DeviceNetworks>', :'latitude' => :'Float', :'longitude' => :'Float', :'imei' => :'String', :'model' => :'String', :'manufacturer' => :'String', :'timezone_offset' => :'String', :'rooted' => :'BOOLEAN', :'malware_detected' => :'BOOLEAN', :'user_defined' => :'Object' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/openapi_client/models/device.rb', line 208 def ==(o) return true if self.equal?(o) self.class == o.class && device_type == o.device_type && device_id == o.device_id && networks == o.networks && latitude == o.latitude && longitude == o.longitude && imei == o.imei && model == o.model && manufacturer == o.manufacturer && timezone_offset == o.timezone_offset && rooted == o.rooted && malware_detected == o.malware_detected && user_defined == o.user_defined end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
# File 'lib/openapi_client/models/device.rb', line 261 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 temp_model = OpenapiClient.const_get(type).new temp_model.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
327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/openapi_client/models/device.rb', line 327 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) ⇒ Object
Builds the object from hash
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/openapi_client/models/device.rb', line 240 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/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) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(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?(o) ⇒ Boolean
227 228 229 |
# File 'lib/openapi_client/models/device.rb', line 227 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
233 234 235 |
# File 'lib/openapi_client/models/device.rb', line 233 def hash [device_type, device_id, networks, latitude, longitude, imei, model, manufacturer, timezone_offset, rooted, malware_detected, user_defined].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/openapi_client/models/device.rb', line 173 def list_invalid_properties invalid_properties = Array.new if @device_type.nil? invalid_properties.push('invalid value for "device_type", device_type cannot be nil.') end if @device_id.nil? invalid_properties.push('invalid value for "device_id", device_id cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
307 308 309 |
# File 'lib/openapi_client/models/device.rb', line 307 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
313 314 315 316 317 318 319 320 321 |
# File 'lib/openapi_client/models/device.rb', line 313 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
301 302 303 |
# File 'lib/openapi_client/models/device.rb', line 301 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
188 189 190 191 192 193 194 |
# File 'lib/openapi_client/models/device.rb', line 188 def valid? return false if @device_type.nil? device_type_validator = EnumAttributeValidator.new('String', ['device/pos', 'device/mobile']) return false unless device_type_validator.valid?(@device_type) return false if @device_id.nil? true end |