Class: CyberSourceMergedSpec::EmvTag
- Defined in:
- lib/cyber_source_merged_spec/models/emv_tag.rb
Overview
EmvTag Model.
Instance Attribute Summary collapse
-
#source ⇒ String
Source of the tag.
-
#tag ⇒ String
EMV tag, 1-10 hex characters.
-
#value ⇒ String
EMV tag value, 1-64 characters.
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(tag:, value:, source:, additional_properties: nil) ⇒ EmvTag
constructor
A new instance of EmvTag.
-
#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(tag:, value:, source:, additional_properties: nil) ⇒ EmvTag
Returns a new instance of EmvTag.
46 47 48 49 50 51 52 53 54 |
# File 'lib/cyber_source_merged_spec/models/emv_tag.rb', line 46 def initialize(tag:, value:, source:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @tag = tag @value = value @source = source @additional_properties = additional_properties end |
Instance Attribute Details
#source ⇒ String
Source of the tag. Possible Values:
- CARD
- TERMINAL
25 26 27 |
# File 'lib/cyber_source_merged_spec/models/emv_tag.rb', line 25 def source @source end |
#tag ⇒ String
EMV tag, 1-10 hex characters.
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/emv_tag.rb', line 14 def tag @tag end |
#value ⇒ String
EMV tag value, 1-64 characters.
18 19 20 |
# File 'lib/cyber_source_merged_spec/models/emv_tag.rb', line 18 def value @value end |
Class Method Details
.from_element(root) ⇒ Object
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/cyber_source_merged_spec/models/emv_tag.rb', line 79 def self.from_element(root) tag = XmlUtilities.from_element(root, 'tag', String) value = XmlUtilities.from_element(root, 'value', String) source = XmlUtilities.from_element(root, 'source', String) new(tag: tag, value: value, source: source, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/cyber_source_merged_spec/models/emv_tag.rb', line 57 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. tag = hash.key?('tag') ? hash['tag'] : nil value = hash.key?('value') ? hash['value'] : nil source = hash.key?('source') ? hash['source'] : nil # 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. EmvTag.new(tag: tag, value: value, source: source, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
28 29 30 31 32 33 34 |
# File 'lib/cyber_source_merged_spec/models/emv_tag.rb', line 28 def self.names @_hash = {} if @_hash.nil? @_hash['tag'] = 'tag' @_hash['value'] = 'value' @_hash['source'] = 'source' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/cyber_source_merged_spec/models/emv_tag.rb', line 42 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
37 38 39 |
# File 'lib/cyber_source_merged_spec/models/emv_tag.rb', line 37 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
110 111 112 113 114 |
# File 'lib/cyber_source_merged_spec/models/emv_tag.rb', line 110 def inspect class_name = self.class.name.split('::').last "<#{class_name} tag: #{@tag.inspect}, value: #{@value.inspect}, source: #{@source.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
103 104 105 106 107 |
# File 'lib/cyber_source_merged_spec/models/emv_tag.rb', line 103 def to_s class_name = self.class.name.split('::').last "<#{class_name} tag: #{@tag}, value: #{@value}, source: #{@source}, additional_properties:"\ " #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/cyber_source_merged_spec/models/emv_tag.rb', line 90 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'tag', tag) XmlUtilities.add_as_subelement(doc, root, 'value', value) XmlUtilities.add_as_subelement(doc, root, 'source', source) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |