Class: CyberSourceMergedSpec::DeviceInformation14

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/device_information14.rb

Overview

DeviceInformation14 Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(http_accept_content:, http_browser_language:, http_browser_java_enabled:, http_browser_color_depth:, http_browser_screen_height:, http_browser_screen_width:, http_browser_time_difference:, user_agent_browser_value:, ip_address: SKIP, raw_data: SKIP, http_accept_browser_value: SKIP, http_browser_java_script_enabled: SKIP, additional_properties: nil) ⇒ DeviceInformation14

Returns a new instance of DeviceInformation14.



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
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 116

def initialize(http_accept_content:, http_browser_language:,
               http_browser_java_enabled:, http_browser_color_depth:,
               http_browser_screen_height:, http_browser_screen_width:,
               http_browser_time_difference:, user_agent_browser_value:,
               ip_address: SKIP, raw_data: SKIP,
               http_accept_browser_value: SKIP,
               http_browser_java_script_enabled: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @ip_address = ip_address unless ip_address == SKIP
  @raw_data = raw_data unless raw_data == SKIP
  unless http_accept_browser_value == SKIP
    @http_accept_browser_value =
      http_accept_browser_value
  end
  @http_accept_content = http_accept_content
  @http_browser_language = http_browser_language
  @http_browser_java_enabled = http_browser_java_enabled
  unless http_browser_java_script_enabled == SKIP
    @http_browser_java_script_enabled =
      http_browser_java_script_enabled
  end
  @http_browser_color_depth = http_browser_color_depth
  @http_browser_screen_height = http_browser_screen_height
  @http_browser_screen_width = http_browser_screen_width
  @http_browser_time_difference = http_browser_time_difference
  @user_agent_browser_value = user_agent_browser_value
  @additional_properties = additional_properties
end

Instance Attribute Details

#http_accept_browser_valueString

Value of the Accept header sent by the customer’s web browser. Note If the customer’s browser provides a value, you must include it in your request.

Returns:

  • (String)


30
31
32
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 30

def http_accept_browser_value
  @http_accept_browser_value
end

#http_accept_contentString

The exact content of the HTTP accept header.

Returns:

  • (String)


34
35
36
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 34

def http_accept_content
  @http_accept_content
end

#http_browser_color_depthString

Value represents the bit depth of the color palette for displaying images, in bits per pixel. Example : 24, refer https://en.wikipedia.org/wiki/Color_depth for more details

Returns:

  • (String)


61
62
63
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 61

def http_browser_color_depth
  @http_browser_color_depth
end

#http_browser_java_enabledTrueClass | FalseClass

A Boolean value that represents the ability of the cardholder browser to execute Java. Value is returned from the navigator.javaEnabled property. Possible Values:True/False

Returns:

  • (TrueClass | FalseClass)


47
48
49
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 47

def http_browser_java_enabled
  @http_browser_java_enabled
end

#http_browser_java_script_enabledTrueClass | FalseClass

A Boolean value that represents the ability of the cardholder browser to execute JavaScript. Possible Values:True/False. Note: Merchants should be able to know the values from fingerprint details of cardholder's browser.

Returns:

  • (TrueClass | FalseClass)


54
55
56
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 54

def http_browser_java_script_enabled
  @http_browser_java_script_enabled
end

#http_browser_languageString

Value represents the browser language as defined in IETF BCP47. Example:en-US, refer https://en.wikipedia.org/wiki/IETF_language_tag for more details.

Returns:

  • (String)


40
41
42
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 40

def http_browser_language
  @http_browser_language
end

#http_browser_screen_heightString

Total height of the Cardholder's scree in pixels, example: 864.

Returns:

  • (String)


65
66
67
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 65

def http_browser_screen_height
  @http_browser_screen_height
end

#http_browser_screen_widthString

Total width of the cardholder's screen in pixels. Example: 1536.

Returns:

  • (String)


69
70
71
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 69

def http_browser_screen_width
  @http_browser_screen_width
end

#http_browser_time_differenceString

Time difference between UTC time and the cardholder browser local time, in minutes, Example:300

Returns:

  • (String)


74
75
76
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 74

def http_browser_time_difference
  @http_browser_time_difference
end

#ip_addressString

IP address of the customer.

Used by

Authorization, Capture, and Credit Optional field.

Returns:

  • (String)


17
18
19
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 17

def ip_address
  @ip_address
end

#raw_dataArray[RawDatum]

IP address of the customer.

Used by

Authorization, Capture, and Credit Optional field.

Returns:



24
25
26
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 24

def raw_data
  @raw_data
end

#user_agent_browser_valueString

Value of the User-Agent header sent by the customer’s web browser. Note If the customer’s browser provides a value, you must include it in your request.

Returns:

  • (String)


80
81
82
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 80

def user_agent_browser_value
  @user_agent_browser_value
end

Class Method Details

.from_element(root) ⇒ Object



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 208

def self.from_element(root)
  http_accept_content = XmlUtilities.from_element(root, 'httpAcceptContent',
                                                  String)
  http_browser_language = XmlUtilities.from_element(root,
                                                    'httpBrowserLanguage',
                                                    String)
  http_browser_java_enabled = XmlUtilities.from_element(
    root, 'httpBrowserJavaEnabled', TrueClass
  )
  http_browser_color_depth = XmlUtilities.from_element(
    root, 'httpBrowserColorDepth', String
  )
  http_browser_screen_height = XmlUtilities.from_element(
    root, 'httpBrowserScreenHeight', String
  )
  http_browser_screen_width = XmlUtilities.from_element(
    root, 'httpBrowserScreenWidth', String
  )
  http_browser_time_difference = XmlUtilities.from_element(
    root, 'httpBrowserTimeDifference', String
  )
  user_agent_browser_value = XmlUtilities.from_element(
    root, 'userAgentBrowserValue', String
  )
  ip_address = XmlUtilities.from_element(root, 'ipAddress', String)
  raw_data = XmlUtilities.from_element_to_array(root, 'RawDatum', RawDatum)
  http_accept_browser_value = XmlUtilities.from_element(
    root, 'httpAcceptBrowserValue', String
  )
  http_browser_java_script_enabled = XmlUtilities.from_element(
    root, 'httpBrowserJavaScriptEnabled', TrueClass
  )

  new(http_accept_content: http_accept_content,
      http_browser_language: http_browser_language,
      http_browser_java_enabled: http_browser_java_enabled,
      http_browser_color_depth: http_browser_color_depth,
      http_browser_screen_height: http_browser_screen_height,
      http_browser_screen_width: http_browser_screen_width,
      http_browser_time_difference: http_browser_time_difference,
      user_agent_browser_value: user_agent_browser_value,
      ip_address: ip_address,
      raw_data: raw_data,
      http_accept_browser_value: http_accept_browser_value,
      http_browser_java_script_enabled: http_browser_java_script_enabled,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 149

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  http_accept_content =
    hash.key?('httpAcceptContent') ? hash['httpAcceptContent'] : nil
  http_browser_language =
    hash.key?('httpBrowserLanguage') ? hash['httpBrowserLanguage'] : nil
  http_browser_java_enabled =
    hash.key?('httpBrowserJavaEnabled') ? hash['httpBrowserJavaEnabled'] : nil
  http_browser_color_depth =
    hash.key?('httpBrowserColorDepth') ? hash['httpBrowserColorDepth'] : nil
  http_browser_screen_height =
    hash.key?('httpBrowserScreenHeight') ? hash['httpBrowserScreenHeight'] : nil
  http_browser_screen_width =
    hash.key?('httpBrowserScreenWidth') ? hash['httpBrowserScreenWidth'] : nil
  http_browser_time_difference =
    hash.key?('httpBrowserTimeDifference') ? hash['httpBrowserTimeDifference'] : nil
  user_agent_browser_value =
    hash.key?('userAgentBrowserValue') ? hash['userAgentBrowserValue'] : nil
  ip_address = hash.key?('ipAddress') ? hash['ipAddress'] : SKIP
  # Parameter is an array, so we need to iterate through it
  raw_data = nil
  unless hash['rawData'].nil?
    raw_data = []
    hash['rawData'].each do |structure|
      raw_data << (RawDatum.from_hash(structure) if structure)
    end
  end

  raw_data = SKIP unless hash.key?('rawData')
  http_accept_browser_value =
    hash.key?('httpAcceptBrowserValue') ? hash['httpAcceptBrowserValue'] : SKIP
  http_browser_java_script_enabled =
    hash.key?('httpBrowserJavaScriptEnabled') ? hash['httpBrowserJavaScriptEnabled'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  DeviceInformation14.new(http_accept_content: http_accept_content,
                          http_browser_language: http_browser_language,
                          http_browser_java_enabled: http_browser_java_enabled,
                          http_browser_color_depth: http_browser_color_depth,
                          http_browser_screen_height: http_browser_screen_height,
                          http_browser_screen_width: http_browser_screen_width,
                          http_browser_time_difference: http_browser_time_difference,
                          user_agent_browser_value: user_agent_browser_value,
                          ip_address: ip_address,
                          raw_data: raw_data,
                          http_accept_browser_value: http_accept_browser_value,
                          http_browser_java_script_enabled: http_browser_java_script_enabled,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ip_address'] = 'ipAddress'
  @_hash['raw_data'] = 'rawData'
  @_hash['http_accept_browser_value'] = 'httpAcceptBrowserValue'
  @_hash['http_accept_content'] = 'httpAcceptContent'
  @_hash['http_browser_language'] = 'httpBrowserLanguage'
  @_hash['http_browser_java_enabled'] = 'httpBrowserJavaEnabled'
  @_hash['http_browser_java_script_enabled'] =
    'httpBrowserJavaScriptEnabled'
  @_hash['http_browser_color_depth'] = 'httpBrowserColorDepth'
  @_hash['http_browser_screen_height'] = 'httpBrowserScreenHeight'
  @_hash['http_browser_screen_width'] = 'httpBrowserScreenWidth'
  @_hash['http_browser_time_difference'] = 'httpBrowserTimeDifference'
  @_hash['user_agent_browser_value'] = 'userAgentBrowserValue'
  @_hash
end

.nullablesObject

An array for nullable fields



112
113
114
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 112

def self.nullables
  []
end

.optionalsObject

An array for optional fields



102
103
104
105
106
107
108
109
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 102

def self.optionals
  %w[
    ip_address
    raw_data
    http_accept_browser_value
    http_browser_java_script_enabled
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 302

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ip_address: #{@ip_address.inspect}, raw_data: #{@raw_data.inspect},"\
  " http_accept_browser_value: #{@http_accept_browser_value.inspect}, http_accept_content:"\
  " #{@http_accept_content.inspect}, http_browser_language: #{@http_browser_language.inspect},"\
  " http_browser_java_enabled: #{@http_browser_java_enabled.inspect},"\
  " http_browser_java_script_enabled: #{@http_browser_java_script_enabled.inspect},"\
  " http_browser_color_depth: #{@http_browser_color_depth.inspect},"\
  " http_browser_screen_height: #{@http_browser_screen_height.inspect},"\
  " http_browser_screen_width: #{@http_browser_screen_width.inspect},"\
  " http_browser_time_difference: #{@http_browser_time_difference.inspect},"\
  " user_agent_browser_value: #{@user_agent_browser_value.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 288

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ip_address: #{@ip_address}, raw_data: #{@raw_data},"\
  " http_accept_browser_value: #{@http_accept_browser_value}, http_accept_content:"\
  " #{@http_accept_content}, http_browser_language: #{@http_browser_language},"\
  " http_browser_java_enabled: #{@http_browser_java_enabled},"\
  " http_browser_java_script_enabled: #{@http_browser_java_script_enabled},"\
  " http_browser_color_depth: #{@http_browser_color_depth}, http_browser_screen_height:"\
  " #{@http_browser_screen_height}, http_browser_screen_width: #{@http_browser_screen_width},"\
  " http_browser_time_difference: #{@http_browser_time_difference}, user_agent_browser_value:"\
  " #{@user_agent_browser_value}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



256
257
258
259
260
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
# File 'lib/cyber_source_merged_spec/models/device_information14.rb', line 256

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'httpAcceptContent',
                                 http_accept_content)
  XmlUtilities.add_as_subelement(doc, root, 'httpBrowserLanguage',
                                 http_browser_language)
  XmlUtilities.add_as_subelement(doc, root, 'httpBrowserJavaEnabled',
                                 http_browser_java_enabled)
  XmlUtilities.add_as_subelement(doc, root, 'httpBrowserColorDepth',
                                 http_browser_color_depth)
  XmlUtilities.add_as_subelement(doc, root, 'httpBrowserScreenHeight',
                                 http_browser_screen_height)
  XmlUtilities.add_as_subelement(doc, root, 'httpBrowserScreenWidth',
                                 http_browser_screen_width)
  XmlUtilities.add_as_subelement(doc, root, 'httpBrowserTimeDifference',
                                 http_browser_time_difference)
  XmlUtilities.add_as_subelement(doc, root, 'userAgentBrowserValue',
                                 user_agent_browser_value)
  XmlUtilities.add_as_subelement(doc, root, 'ipAddress', ip_address)
  XmlUtilities.add_array_as_subelement(doc, root, 'RawDatum', raw_data)
  XmlUtilities.add_as_subelement(doc, root, 'httpAcceptBrowserValue',
                                 http_accept_browser_value)
  XmlUtilities.add_as_subelement(doc, root, 'httpBrowserJavaScriptEnabled',
                                 http_browser_java_script_enabled)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end