Class: CyberSourceMergedSpec::MerchantDefinedFieldDefinitionRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::MerchantDefinedFieldDefinitionRequest
- Defined in:
- lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb
Overview
MerchantDefinedFieldDefinitionRequest Model.
Instance Attribute Summary collapse
-
#customer_visible ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#field_type ⇒ FieldType
TODO: Write general description for this method.
-
#label ⇒ String
TODO: Write general description for this method.
-
#merchant_defined_data_index ⇒ Integer
Should be mandatory and used only if fieldType = "select".
-
#possible_values ⇒ String
Should be mandatory and used only if fieldType = "select".
-
#read_only ⇒ TrueClass | FalseClass
Should be mandatory and used only if fieldType = "select".
-
#text_default_value ⇒ String
Should be used only if fieldType = "text".
-
#text_max_length ⇒ Integer
Should be used only if fieldType = "text".
-
#text_min_length ⇒ Integer
Should be used only if fieldType = "text".
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(field_type:, label:, merchant_defined_data_index:, customer_visible: false, text_min_length: 0, text_max_length: 100, text_default_value: SKIP, possible_values: SKIP, read_only: false, additional_properties: nil) ⇒ MerchantDefinedFieldDefinitionRequest
constructor
A new instance of MerchantDefinedFieldDefinitionRequest.
-
#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(field_type:, label:, merchant_defined_data_index:, customer_visible: false, text_min_length: 0, text_max_length: 100, text_default_value: SKIP, possible_values: SKIP, read_only: false, additional_properties: nil) ⇒ MerchantDefinedFieldDefinitionRequest
Returns a new instance of MerchantDefinedFieldDefinitionRequest.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 80 def initialize(field_type:, label:, merchant_defined_data_index:, customer_visible: false, text_min_length: 0, text_max_length: 100, text_default_value: SKIP, possible_values: SKIP, read_only: false, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @field_type = field_type @label = label @customer_visible = customer_visible unless customer_visible == SKIP @text_min_length = text_min_length unless text_min_length == SKIP @text_max_length = text_max_length unless text_max_length == SKIP @text_default_value = text_default_value unless text_default_value == SKIP @possible_values = possible_values unless possible_values == SKIP @read_only = read_only unless read_only == SKIP @merchant_defined_data_index = merchant_defined_data_index @additional_properties = additional_properties end |
Instance Attribute Details
#customer_visible ⇒ TrueClass | FalseClass
TODO: Write general description for this method
22 23 24 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 22 def customer_visible @customer_visible end |
#field_type ⇒ FieldType
TODO: Write general description for this method
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 14 def field_type @field_type end |
#label ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 18 def label @label end |
#merchant_defined_data_index ⇒ Integer
Should be mandatory and used only if fieldType = "select"
46 47 48 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 46 def merchant_defined_data_index @merchant_defined_data_index end |
#possible_values ⇒ String
Should be mandatory and used only if fieldType = "select"
38 39 40 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 38 def possible_values @possible_values end |
#read_only ⇒ TrueClass | FalseClass
Should be mandatory and used only if fieldType = "select"
42 43 44 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 42 def read_only @read_only end |
#text_default_value ⇒ String
Should be used only if fieldType = "text"
34 35 36 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 34 def text_default_value @text_default_value end |
#text_max_length ⇒ Integer
Should be used only if fieldType = "text"
30 31 32 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 30 def text_max_length @text_max_length end |
#text_min_length ⇒ Integer
Should be used only if fieldType = "text"
26 27 28 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 26 def text_min_length @text_min_length end |
Class Method Details
.from_element(root) ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 138 def self.from_element(root) field_type = XmlUtilities.from_element(root, 'fieldType', String) label = XmlUtilities.from_element(root, 'label', String) merchant_defined_data_index = XmlUtilities.from_element( root, 'merchantDefinedDataIndex', Integer ) customer_visible = XmlUtilities.from_element(root, 'customerVisible', TrueClass) text_min_length = XmlUtilities.from_element(root, 'textMinLength', Integer) text_max_length = XmlUtilities.from_element(root, 'textMaxLength', Integer) text_default_value = XmlUtilities.from_element(root, 'textDefaultValue', String) possible_values = XmlUtilities.from_element(root, 'possibleValues', String) read_only = XmlUtilities.from_element(root, 'readOnly', TrueClass) new(field_type: field_type, label: label, merchant_defined_data_index: merchant_defined_data_index, customer_visible: customer_visible, text_min_length: text_min_length, text_max_length: text_max_length, text_default_value: text_default_value, possible_values: possible_values, read_only: read_only, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 101 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. field_type = hash.key?('fieldType') ? hash['fieldType'] : nil label = hash.key?('label') ? hash['label'] : nil merchant_defined_data_index = hash.key?('merchantDefinedDataIndex') ? hash['merchantDefinedDataIndex'] : nil customer_visible = hash['customerVisible'] ||= false text_min_length = hash['textMinLength'] ||= 0 text_max_length = hash['textMaxLength'] ||= 100 text_default_value = hash.key?('textDefaultValue') ? hash['textDefaultValue'] : SKIP possible_values = hash.key?('possibleValues') ? hash['possibleValues'] : SKIP read_only = hash['readOnly'] ||= 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. MerchantDefinedFieldDefinitionRequest.new(field_type: field_type, label: label, merchant_defined_data_index: merchant_defined_data_index, customer_visible: customer_visible, text_min_length: text_min_length, text_max_length: text_max_length, text_default_value: text_default_value, possible_values: possible_values, read_only: read_only, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['field_type'] = 'fieldType' @_hash['label'] = 'label' @_hash['customer_visible'] = 'customerVisible' @_hash['text_min_length'] = 'textMinLength' @_hash['text_max_length'] = 'textMaxLength' @_hash['text_default_value'] = 'textDefaultValue' @_hash['possible_values'] = 'possibleValues' @_hash['read_only'] = 'readOnly' @_hash['merchant_defined_data_index'] = 'merchantDefinedDataIndex' @_hash end |
.nullables ⇒ Object
An array for nullable fields
76 77 78 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 76 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 64 def self.optionals %w[ customer_visible text_min_length text_max_length text_default_value possible_values read_only ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
203 204 205 206 207 208 209 210 211 212 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 203 def inspect class_name = self.class.name.split('::').last "<#{class_name} field_type: #{@field_type.inspect}, label: #{@label.inspect},"\ " customer_visible: #{@customer_visible.inspect}, text_min_length:"\ " #{@text_min_length.inspect}, text_max_length: #{@text_max_length.inspect},"\ " text_default_value: #{@text_default_value.inspect}, possible_values:"\ " #{@possible_values.inspect}, read_only: #{@read_only.inspect},"\ " merchant_defined_data_index: #{@merchant_defined_data_index.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
193 194 195 196 197 198 199 200 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 193 def to_s class_name = self.class.name.split('::').last "<#{class_name} field_type: #{@field_type}, label: #{@label}, customer_visible:"\ " #{@customer_visible}, text_min_length: #{@text_min_length}, text_max_length:"\ " #{@text_max_length}, text_default_value: #{@text_default_value}, possible_values:"\ " #{@possible_values}, read_only: #{@read_only}, merchant_defined_data_index:"\ " #{@merchant_defined_data_index}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_definition_request.rb', line 168 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'fieldType', field_type) XmlUtilities.add_as_subelement(doc, root, 'label', label) XmlUtilities.add_as_subelement(doc, root, 'merchantDefinedDataIndex', merchant_defined_data_index) XmlUtilities.add_as_subelement(doc, root, 'customerVisible', customer_visible) XmlUtilities.add_as_subelement(doc, root, 'textMinLength', text_min_length) XmlUtilities.add_as_subelement(doc, root, 'textMaxLength', text_max_length) XmlUtilities.add_as_subelement(doc, root, 'textDefaultValue', text_default_value) XmlUtilities.add_as_subelement(doc, root, 'possibleValues', possible_values) XmlUtilities.add_as_subelement(doc, root, 'readOnly', read_only) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |