Class: CyberSourceMergedSpec::CustomLabel
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::CustomLabel
- Defined in:
- lib/cyber_source_merged_spec/models/custom_label.rb
Overview
CustomLabel Model.
Instance Attribute Summary collapse
-
#hidden ⇒ TrueClass | FalseClass
Hides the specified field.
-
#hidden_for_invoice ⇒ TrueClass | FalseClass
Hides the field at invoice level.
-
#hidden_for_item ⇒ TrueClass | FalseClass
Hides the field at invoice item level.
-
#key ⇒ String
The invoice field key.
-
#value ⇒ String
The new (overridden) field name.
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(key: SKIP, value: SKIP, hidden: false, hidden_for_invoice: false, hidden_for_item: false, additional_properties: nil) ⇒ CustomLabel
constructor
A new instance of CustomLabel.
-
#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(key: SKIP, value: SKIP, hidden: false, hidden_for_invoice: false, hidden_for_item: false, additional_properties: nil) ⇒ CustomLabel
Returns a new instance of CustomLabel.
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 77 def initialize(key: SKIP, value: SKIP, hidden: false, hidden_for_invoice: false, hidden_for_item: false, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @key = key unless key == SKIP @value = value unless value == SKIP @hidden = hidden unless hidden == SKIP @hidden_for_invoice = hidden_for_invoice unless hidden_for_invoice == SKIP @hidden_for_item = hidden_for_item unless hidden_for_item == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#hidden ⇒ TrueClass | FalseClass
Hides the specified field. This field is applicable for keys:
- customerId
- companyName
- description
- shipping
- partialPayment
36 37 38 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 36 def hidden @hidden end |
#hidden_for_invoice ⇒ TrueClass | FalseClass
Hides the field at invoice level. This field is applicable for keys:
- discount
- tax
42 43 44 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 42 def hidden_for_invoice @hidden_for_invoice end |
#hidden_for_item ⇒ TrueClass | FalseClass
Hides the field at invoice item level. This field is applicable for keys:
- discount
- tax
48 49 50 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 48 def hidden_for_item @hidden_for_item end |
#key ⇒ String
The invoice field key. Possible values:
- billTo
- invoiceNumber
- customerId
- companyName
- description
- shipping
- partialPayment
- discount
- tax
23 24 25 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 23 def key @key end |
#value ⇒ String
The new (overridden) field name
27 28 29 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 27 def value @value end |
Class Method Details
.from_element(root) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 118 def self.from_element(root) key = XmlUtilities.from_element(root, 'key', String) value = XmlUtilities.from_element(root, 'value', String) hidden = XmlUtilities.from_element(root, 'hidden', TrueClass) hidden_for_invoice = XmlUtilities.from_element(root, 'hiddenForInvoice', TrueClass) hidden_for_item = XmlUtilities.from_element(root, 'hiddenForItem', TrueClass) new(key: key, value: value, hidden: hidden, hidden_for_invoice: hidden_for_invoice, hidden_for_item: hidden_for_item, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 92 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. key = hash.key?('key') ? hash['key'] : SKIP value = hash.key?('value') ? hash['value'] : SKIP hidden = hash['hidden'] ||= false hidden_for_invoice = hash['hiddenForInvoice'] ||= false hidden_for_item = hash['hiddenForItem'] ||= false # 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. CustomLabel.new(key: key, value: value, hidden: hidden, hidden_for_invoice: hidden_for_invoice, hidden_for_item: hidden_for_item, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
51 52 53 54 55 56 57 58 59 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 51 def self.names @_hash = {} if @_hash.nil? @_hash['key'] = 'key' @_hash['value'] = 'value' @_hash['hidden'] = 'hidden' @_hash['hidden_for_invoice'] = 'hiddenForInvoice' @_hash['hidden_for_item'] = 'hiddenForItem' @_hash end |
.nullables ⇒ Object
An array for nullable fields
73 74 75 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 73 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
62 63 64 65 66 67 68 69 70 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 62 def self.optionals %w[ key value hidden hidden_for_invoice hidden_for_item ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
160 161 162 163 164 165 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 160 def inspect class_name = self.class.name.split('::').last "<#{class_name} key: #{@key.inspect}, value: #{@value.inspect}, hidden: #{@hidden.inspect},"\ " hidden_for_invoice: #{@hidden_for_invoice.inspect}, hidden_for_item:"\ " #{@hidden_for_item.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
152 153 154 155 156 157 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 152 def to_s class_name = self.class.name.split('::').last "<#{class_name} key: #{@key}, value: #{@value}, hidden: #{@hidden}, hidden_for_invoice:"\ " #{@hidden_for_invoice}, hidden_for_item: #{@hidden_for_item}, additional_properties:"\ " #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/cyber_source_merged_spec/models/custom_label.rb', line 135 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'key', key) XmlUtilities.add_as_subelement(doc, root, 'value', value) XmlUtilities.add_as_subelement(doc, root, 'hidden', hidden) XmlUtilities.add_as_subelement(doc, root, 'hiddenForInvoice', hidden_for_invoice) XmlUtilities.add_as_subelement(doc, root, 'hiddenForItem', hidden_for_item) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |