Class: CyberSourceMergedSpec::DeviceInformation11

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

Overview

DeviceInformation11 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(platform_type: SKIP, ip_address: SKIP, http_accept_content: SKIP, http_browser_language: SKIP, http_browser_java_enabled: SKIP, http_browser_java_script_enabled: SKIP, http_browser_color_depth: SKIP, http_browser_screen_height: SKIP, http_browser_screen_width: SKIP, http_browser_time_difference: SKIP, user_agent_browser_value: SKIP, additional_properties: nil) ⇒ DeviceInformation11

Returns a new instance of DeviceInformation11.



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

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

  @platform_type = platform_type unless platform_type == SKIP
  @ip_address = ip_address unless ip_address == SKIP
  @http_accept_content = http_accept_content unless http_accept_content == SKIP
  @http_browser_language = http_browser_language unless http_browser_language == SKIP
  unless http_browser_java_enabled == SKIP
    @http_browser_java_enabled =
      http_browser_java_enabled
  end
  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 unless http_browser_color_depth == SKIP
  unless http_browser_screen_height == SKIP
    @http_browser_screen_height =
      http_browser_screen_height
  end
  unless http_browser_screen_width == SKIP
    @http_browser_screen_width =
      http_browser_screen_width
  end
  unless http_browser_time_difference == SKIP
    @http_browser_time_difference =
      http_browser_time_difference
  end
  @user_agent_browser_value = user_agent_browser_value unless user_agent_browser_value == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#http_accept_contentString

The exact content of the HTTP accept header.

Returns:

  • (String)


27
28
29
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 27

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)


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

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)


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

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)


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

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)


33
34
35
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 33

def http_browser_language
  @http_browser_language
end

#http_browser_screen_heightString

Total height of the Cardholder's screen in pixels.

Returns:

  • (String)


58
59
60
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 58

def http_browser_screen_height
  @http_browser_screen_height
end

#http_browser_screen_widthString

Total width of the cardholder's screen in pixels.

Returns:

  • (String)


62
63
64
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 62

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.

Returns:

  • (String)


67
68
69
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 67

def http_browser_time_difference
  @http_browser_time_difference
end

#ip_addressString

IP address of the customer.

Returns:

  • (String)


23
24
25
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 23

def ip_address
  @ip_address
end

#platform_typeString

Platform type. Possible Values:

- iOS: iOS app
- ANDROID: Android app
- WINDOWS: Windows app
- WEB: Browser-based app

Returns:

  • (String)


19
20
21
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 19

def platform_type
  @platform_type
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)


73
74
75
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 73

def user_agent_browser_value
  @user_agent_browser_value
end

Class Method Details

.from_element(root) ⇒ Object



204
205
206
207
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
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 204

def self.from_element(root)
  platform_type = XmlUtilities.from_element(root, 'platformType', String)
  ip_address = XmlUtilities.from_element(root, 'ipAddress', String)
  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_java_script_enabled = XmlUtilities.from_element(
    root, 'httpBrowserJavaScriptEnabled', 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
  )

  new(platform_type: platform_type,
      ip_address: ip_address,
      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

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  platform_type = hash.key?('platformType') ? hash['platformType'] : SKIP
  ip_address = hash.key?('ipAddress') ? hash['ipAddress'] : SKIP
  http_accept_content =
    hash.key?('httpAcceptContent') ? hash['httpAcceptContent'] : SKIP
  http_browser_language =
    hash.key?('httpBrowserLanguage') ? hash['httpBrowserLanguage'] : SKIP
  http_browser_java_enabled =
    hash.key?('httpBrowserJavaEnabled') ? hash['httpBrowserJavaEnabled'] : SKIP
  http_browser_java_script_enabled =
    hash.key?('httpBrowserJavaScriptEnabled') ? hash['httpBrowserJavaScriptEnabled'] : SKIP
  http_browser_color_depth =
    hash.key?('httpBrowserColorDepth') ? hash['httpBrowserColorDepth'] : SKIP
  http_browser_screen_height =
    hash.key?('httpBrowserScreenHeight') ? hash['httpBrowserScreenHeight'] : SKIP
  http_browser_screen_width =
    hash.key?('httpBrowserScreenWidth') ? hash['httpBrowserScreenWidth'] : SKIP
  http_browser_time_difference =
    hash.key?('httpBrowserTimeDifference') ? hash['httpBrowserTimeDifference'] : SKIP
  user_agent_browser_value =
    hash.key?('userAgentBrowserValue') ? hash['userAgentBrowserValue'] : 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.
  DeviceInformation11.new(platform_type: platform_type,
                          ip_address: ip_address,
                          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

.namesObject

A mapping from model property names to API property names.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 76

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['platform_type'] = 'platformType'
  @_hash['ip_address'] = 'ipAddress'
  @_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



111
112
113
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 111

def self.nullables
  []
end

.optionalsObject

An array for optional fields



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 94

def self.optionals
  %w[
    platform_type
    ip_address
    http_accept_content
    http_browser_language
    http_browser_java_enabled
    http_browser_java_script_enabled
    http_browser_color_depth
    http_browser_screen_height
    http_browser_screen_width
    http_browser_time_difference
    user_agent_browser_value
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 291

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} platform_type: #{@platform_type.inspect}, ip_address:"\
  " #{@ip_address.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.



278
279
280
281
282
283
284
285
286
287
288
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 278

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} platform_type: #{@platform_type}, ip_address: #{@ip_address},"\
  " 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



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/cyber_source_merged_spec/models/device_information11.rb', line 248

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

  XmlUtilities.add_as_subelement(doc, root, 'platformType', platform_type)
  XmlUtilities.add_as_subelement(doc, root, 'ipAddress', ip_address)
  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, 'httpBrowserJavaScriptEnabled',
                                 http_browser_java_script_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, 'additional_properties',
                                 additional_properties)

  root
end