Class: CyberSourceMergedSpec::DeviceInformation9
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::DeviceInformation9
- Defined in:
- lib/cyber_source_merged_spec/models/device_information9.rb
Overview
DeviceInformation9 Model.
Instance Attribute Summary collapse
-
#device_type ⇒ String
The device type at the client side.
-
#id ⇒ String
../../../commons/definitions/device.yaml#/properties/id.
-
#ip_address ⇒ String
IP address of the customer.
-
#user_agent ⇒ String
Customer’s browser as identified from the HTTP header data.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(ip_address: SKIP, device_type: SKIP, id: SKIP, user_agent: SKIP, additional_properties: nil) ⇒ DeviceInformation9
constructor
A new instance of DeviceInformation9.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ Object
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, device_type: SKIP, id: SKIP, user_agent: SKIP, additional_properties: nil) ⇒ DeviceInformation9
Returns a new instance of DeviceInformation9.
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 58 def initialize(ip_address: SKIP, device_type: SKIP, id: SKIP, user_agent: 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 @device_type = device_type unless device_type == SKIP @id = id unless id == SKIP @user_agent = user_agent unless user_agent == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#device_type ⇒ String
The device type at the client side.
21 22 23 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 21 def device_type @device_type end |
#id ⇒ String
../../../commons/definitions/device.yaml#/properties/id
25 26 27 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 25 def id @id end |
#ip_address ⇒ String
IP address of the customer.
Used by
Authorization, Capture, and Credit Optional field.
17 18 19 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 17 def ip_address @ip_address end |
#user_agent ⇒ String
Customer’s browser as identified from the HTTP header data. For example,
Mozilla is the value that identifies
the Netscape browser.
31 32 33 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 31 def user_agent @user_agent end |
Class Method Details
.from_element(root) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 95 def self.from_element(root) ip_address = XmlUtilities.from_element(root, 'ipAddress', String) device_type = XmlUtilities.from_element(root, 'deviceType', String) id = XmlUtilities.from_element(root, 'id', String) user_agent = XmlUtilities.from_element(root, 'userAgent', String) new(ip_address: ip_address, device_type: device_type, id: id, user_agent: user_agent, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. ip_address = hash.key?('ipAddress') ? hash['ipAddress'] : SKIP device_type = hash.key?('deviceType') ? hash['deviceType'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP user_agent = hash.key?('userAgent') ? hash['userAgent'] : 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, device_type: device_type, id: id, user_agent: user_agent, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['ip_address'] = 'ipAddress' @_hash['device_type'] = 'deviceType' @_hash['id'] = 'id' @_hash['user_agent'] = 'userAgent' @_hash end |
.nullables ⇒ Object
An array for nullable fields
54 55 56 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 54 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 44 def self.optionals %w[ ip_address device_type id user_agent ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
129 130 131 132 133 134 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 129 def inspect class_name = self.class.name.split('::').last "<#{class_name} ip_address: #{@ip_address.inspect}, device_type: #{@device_type.inspect},"\ " id: #{@id.inspect}, user_agent: #{@user_agent.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
122 123 124 125 126 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 122 def to_s class_name = self.class.name.split('::').last "<#{class_name} ip_address: #{@ip_address}, device_type: #{@device_type}, id: #{@id},"\ " user_agent: #{@user_agent}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/cyber_source_merged_spec/models/device_information9.rb', line 108 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'ipAddress', ip_address) XmlUtilities.add_as_subelement(doc, root, 'deviceType', device_type) XmlUtilities.add_as_subelement(doc, root, 'id', id) XmlUtilities.add_as_subelement(doc, root, 'userAgent', user_agent) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |