Class: CyberSource::Acpv1tokensDeviceInformation
- Inherits:
-
Object
- Object
- CyberSource::Acpv1tokensDeviceInformation
- Defined in:
- lib/cybersource_rest_client/models/acpv1tokens_device_information.rb
Overview
Device and Application instance data.
Instance Attribute Summary collapse
-
#application_name ⇒ Object
Name of the connecting client application.
-
#client_device_id ⇒ Object
Unique identifier of the consumer’s device.
-
#country ⇒ Object
ISO 3166-1 alpha-2 country code.
-
#device_data ⇒ Object
Returns the value of attribute device_data.
-
#fingerprint_session_id ⇒ Object
Device Fingerprinting Session identifier.
-
#ip_address ⇒ Object
IP address of the consumer’s device.
-
#user_agent ⇒ Object
Base64 Encoded userAgent string of the connecting client application, with no padding.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.json_map ⇒ Object
Attribute mapping from JSON key to ruby-style variable name.
-
.swagger_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 = {}) ⇒ Acpv1tokensDeviceInformation
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 = {}) ⇒ Acpv1tokensDeviceInformation
Initializes the object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 78 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?(:'userAgent') self.user_agent = attributes[:'userAgent'] end if attributes.has_key?(:'applicationName') self.application_name = attributes[:'applicationName'] end if attributes.has_key?(:'fingerprintSessionId') self.fingerprint_session_id = attributes[:'fingerprintSessionId'] end if attributes.has_key?(:'country') self.country = attributes[:'country'] end if attributes.has_key?(:'deviceData') self.device_data = attributes[:'deviceData'] end if attributes.has_key?(:'ipAddress') self.ip_address = attributes[:'ipAddress'] end if attributes.has_key?(:'clientDeviceId') self.client_device_id = attributes[:'clientDeviceId'] end end |
Instance Attribute Details
#application_name ⇒ Object
Name of the connecting client application.
21 22 23 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 21 def application_name @application_name end |
#client_device_id ⇒ Object
Unique identifier of the consumer’s device.
35 36 37 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 35 def client_device_id @client_device_id end |
#country ⇒ Object
ISO 3166-1 alpha-2 country code. The country where the Consumer is accessing the service from.
27 28 29 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 27 def country @country end |
#device_data ⇒ Object
Returns the value of attribute device_data.
29 30 31 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 29 def device_data @device_data end |
#fingerprint_session_id ⇒ Object
Device Fingerprinting Session identifier.
24 25 26 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 24 def fingerprint_session_id @fingerprint_session_id end |
#ip_address ⇒ Object
IP address of the consumer’s device.
32 33 34 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 32 def ip_address @ip_address end |
#user_agent ⇒ Object
Base64 Encoded userAgent string of the connecting client application, with no padding. User agent string of the connecting client application. Conditionality: - Required for browsers - Optional for non-browsers
18 19 20 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 18 def user_agent @user_agent end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 38 def self.attribute_map { :'user_agent' => :'userAgent', :'application_name' => :'applicationName', :'fingerprint_session_id' => :'fingerprintSessionId', :'country' => :'country', :'device_data' => :'deviceData', :'ip_address' => :'ipAddress', :'client_device_id' => :'clientDeviceId' } end |
.json_map ⇒ Object
Attribute mapping from JSON key to ruby-style variable name.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 51 def self.json_map { :'user_agent' => :'user_agent', :'application_name' => :'application_name', :'fingerprint_session_id' => :'fingerprint_session_id', :'country' => :'country', :'device_data' => :'device_data', :'ip_address' => :'ip_address', :'client_device_id' => :'client_device_id' } end |
.swagger_types ⇒ Object
Attribute type mapping.
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 64 def self.swagger_types { :'user_agent' => :'String', :'application_name' => :'String', :'fingerprint_session_id' => :'String', :'country' => :'String', :'device_data' => :'Acpv1tokensDeviceInformationDeviceData', :'ip_address' => :'String', :'client_device_id' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 250 def ==(o) return true if self.equal?(o) self.class == o.class && user_agent == o.user_agent && application_name == o.application_name && fingerprint_session_id == o.fingerprint_session_id && country == o.country && device_data == o.device_data && ip_address == o.ip_address && client_device_id == o.client_device_id end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
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 329 330 331 332 333 334 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 298 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 = CyberSource.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
364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 364 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
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 277 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_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("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{self.class.json_map[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
264 265 266 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 264 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
270 271 272 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 270 def hash [user_agent, application_name, fingerprint_session_id, country, device_data, ip_address, client_device_id].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 115 def list_invalid_properties invalid_properties = Array.new #if !@user_agent.nil? && @user_agent !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #invalid_properties.push('invalid value for "user_agent", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.') #end if @application_name.nil? invalid_properties.push('invalid value for "application_name", application_name cannot be nil.') end #if @application_name !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #invalid_properties.push('invalid value for "application_name", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.') #end if @fingerprint_session_id.nil? invalid_properties.push('invalid value for "fingerprint_session_id", fingerprint_session_id cannot be nil.') end #if @fingerprint_session_id !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #invalid_properties.push('invalid value for "fingerprint_session_id", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.') #end #if [email protected]? && @country !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/) #invalid_properties.push('invalid value for "country", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/.') #end if @device_data.nil? invalid_properties.push('invalid value for "device_data", device_data cannot be nil.') end if @ip_address.nil? invalid_properties.push('invalid value for "ip_address", ip_address cannot be nil.') end #if @ip_address !~ Regexp.new(/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:[^0-9]*(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$/) #invalid_properties.push('invalid value for "ip_address", must conform to the pattern /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:[^0-9]*(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$/.') #end #if !@client_device_id.nil? && @client_device_id !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #invalid_properties.push('invalid value for "client_device_id", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.') #end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
344 345 346 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 344 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
350 351 352 353 354 355 356 357 358 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 350 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
338 339 340 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 338 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/cybersource_rest_client/models/acpv1tokens_device_information.rb', line 162 def valid? #return false if !@user_agent.nil? && @user_agent !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) return false if @application_name.nil? #return false if @application_name !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) return false if @fingerprint_session_id.nil? #return false if @fingerprint_session_id !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) #return false if [email protected]? && @country !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/) return false if @device_data.nil? return false if @ip_address.nil? #return false if @ip_address !~ Regexp.new(/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:[^0-9]*(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$/) #return false if !@client_device_id.nil? && @client_device_id !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/) true end |