Class: VisaAcceptanceMergedSpec::DeviceInformation9

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/device_information9.rb

Overview

DeviceInformation9 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(ip_address: SKIP, host_name: SKIP, cookies_accepted: SKIP, additional_properties: nil) ⇒ DeviceInformation9

Returns a new instance of DeviceInformation9.



53
54
55
56
57
58
59
60
61
62
# File 'lib/visa_acceptance_merged_spec/models/device_information9.rb', line 53

def initialize(ip_address: SKIP, host_name: SKIP, cookies_accepted: 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
  @host_name = host_name unless host_name == SKIP
  @cookies_accepted = cookies_accepted unless cookies_accepted == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#cookies_acceptedString

Whether the customer’s browser accepts cookies. This field can contain one of the following values:

  • yes: The customer’s browser accepts cookies.
  • no: The customer’s browser does not accept cookies.

Returns:

  • (String)


28
29
30
# File 'lib/visa_acceptance_merged_spec/models/device_information9.rb', line 28

def cookies_accepted
  @cookies_accepted
end

#host_nameString

DNS resolved hostname from ipAddress.

Returns:

  • (String)


21
22
23
# File 'lib/visa_acceptance_merged_spec/models/device_information9.rb', line 21

def host_name
  @host_name
end

#ip_addressString

IP address of the customer.

Used by

Authorization, Capture, and Credit Optional field.

Returns:

  • (String)


17
18
19
# File 'lib/visa_acceptance_merged_spec/models/device_information9.rb', line 17

def ip_address
  @ip_address
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/visa_acceptance_merged_spec/models/device_information9.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ip_address = hash.key?('ipAddress') ? hash['ipAddress'] : SKIP
  host_name = hash.key?('hostName') ? hash['hostName'] : SKIP
  cookies_accepted =
    hash.key?('cookiesAccepted') ? hash['cookiesAccepted'] : 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.
  DeviceInformation9.new(ip_address: ip_address,
                         host_name: host_name,
                         cookies_accepted: cookies_accepted,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
# File 'lib/visa_acceptance_merged_spec/models/device_information9.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ip_address'] = 'ipAddress'
  @_hash['host_name'] = 'hostName'
  @_hash['cookies_accepted'] = 'cookiesAccepted'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/visa_acceptance_merged_spec/models/device_information9.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
# File 'lib/visa_acceptance_merged_spec/models/device_information9.rb', line 40

def self.optionals
  %w[
    ip_address
    host_name
    cookies_accepted
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



96
97
98
99
100
101
# File 'lib/visa_acceptance_merged_spec/models/device_information9.rb', line 96

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ip_address: #{@ip_address.inspect}, host_name: #{@host_name.inspect},"\
  " cookies_accepted: #{@cookies_accepted.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



89
90
91
92
93
# File 'lib/visa_acceptance_merged_spec/models/device_information9.rb', line 89

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ip_address: #{@ip_address}, host_name: #{@host_name}, cookies_accepted:"\
  " #{@cookies_accepted}, additional_properties: #{@additional_properties}>"
end