Class: CyberSourceMergedSpec::MerchantDefinedFieldValuesWithDefinition

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb

Overview

MerchantDefinedFieldValuesWithDefinition 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(reference_type: SKIP, label: SKIP, field_type: SKIP, customer_visible: SKIP, read_only: SKIP, text_min_length: SKIP, text_max_length: SKIP, text_default_value: SKIP, possible_values: SKIP, value: SKIP, position: SKIP, definition_id: SKIP, merchant_defined_data_index: SKIP, additional_properties: nil) ⇒ MerchantDefinedFieldValuesWithDefinition

Returns a new instance of MerchantDefinedFieldValuesWithDefinition.



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
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 107

def initialize(reference_type: SKIP, label: SKIP, field_type: SKIP,
               customer_visible: SKIP, read_only: SKIP,
               text_min_length: SKIP, text_max_length: SKIP,
               text_default_value: SKIP, possible_values: SKIP, value: SKIP,
               position: SKIP, definition_id: SKIP,
               merchant_defined_data_index: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @reference_type = reference_type unless reference_type == SKIP
  @label = label unless label == SKIP
  @field_type = field_type unless field_type == SKIP
  @customer_visible = customer_visible unless customer_visible == SKIP
  @read_only = read_only unless read_only == 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
  @value = value unless value == SKIP
  @position = position unless position == SKIP
  @definition_id = definition_id unless definition_id == SKIP
  unless merchant_defined_data_index == SKIP
    @merchant_defined_data_index =
      merchant_defined_data_index
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#customer_visibleTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


26
27
28
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 26

def customer_visible
  @customer_visible
end

#definition_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


58
59
60
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 58

def definition_id
  @definition_id
end

#field_typeString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 22

def field_type
  @field_type
end

#labelString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 18

def label
  @label
end

#merchant_defined_data_indexInteger

TODO: Write general description for this method

Returns:

  • (Integer)


62
63
64
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 62

def merchant_defined_data_index
  @merchant_defined_data_index
end

#positionInteger

TODO: Write general description for this method

Returns:

  • (Integer)


54
55
56
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 54

def position
  @position
end

#possible_valuesString

TODO: Write general description for this method

Returns:

  • (String)


46
47
48
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 46

def possible_values
  @possible_values
end

#read_onlyTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 30

def read_only
  @read_only
end

#reference_typeString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 14

def reference_type
  @reference_type
end

#text_default_valueString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 42

def text_default_value
  @text_default_value
end

#text_max_lengthInteger

TODO: Write general description for this method

Returns:

  • (Integer)


38
39
40
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 38

def text_max_length
  @text_max_length
end

#text_min_lengthInteger

TODO: Write general description for this method

Returns:

  • (Integer)


34
35
36
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 34

def text_min_length
  @text_min_length
end

#valueString

TODO: Write general description for this method

Returns:

  • (String)


50
51
52
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 50

def value
  @value
end

Class Method Details

.from_element(root) ⇒ Object



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 185

def self.from_element(root)
  reference_type = XmlUtilities.from_element(root, 'referenceType', String)
  label = XmlUtilities.from_element(root, 'label', String)
  field_type = XmlUtilities.from_element(root, 'fieldType', String)
  customer_visible = XmlUtilities.from_element(root, 'customerVisible',
                                               TrueClass)
  read_only = XmlUtilities.from_element(root, 'readOnly', 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)
  value = XmlUtilities.from_element(root, 'value', String)
  position = XmlUtilities.from_element(root, 'position', Integer)
  definition_id = XmlUtilities.from_element(root, 'definitionId', Integer)
  merchant_defined_data_index = XmlUtilities.from_element(
    root, 'merchantDefinedDataIndex', Integer
  )

  new(reference_type: reference_type,
      label: label,
      field_type: field_type,
      customer_visible: customer_visible,
      read_only: read_only,
      text_min_length: text_min_length,
      text_max_length: text_max_length,
      text_default_value: text_default_value,
      possible_values: possible_values,
      value: value,
      position: position,
      definition_id: definition_id,
      merchant_defined_data_index: merchant_defined_data_index,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



137
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 137

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  reference_type = hash.key?('referenceType') ? hash['referenceType'] : SKIP
  label = hash.key?('label') ? hash['label'] : SKIP
  field_type = hash.key?('fieldType') ? hash['fieldType'] : SKIP
  customer_visible =
    hash.key?('customerVisible') ? hash['customerVisible'] : SKIP
  read_only = hash.key?('readOnly') ? hash['readOnly'] : SKIP
  text_min_length =
    hash.key?('textMinLength') ? hash['textMinLength'] : SKIP
  text_max_length =
    hash.key?('textMaxLength') ? hash['textMaxLength'] : SKIP
  text_default_value =
    hash.key?('textDefaultValue') ? hash['textDefaultValue'] : SKIP
  possible_values =
    hash.key?('possibleValues') ? hash['possibleValues'] : SKIP
  value = hash.key?('value') ? hash['value'] : SKIP
  position = hash.key?('position') ? hash['position'] : SKIP
  definition_id = hash.key?('definitionId') ? hash['definitionId'] : SKIP
  merchant_defined_data_index =
    hash.key?('merchantDefinedDataIndex') ? hash['merchantDefinedDataIndex'] : 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.
  MerchantDefinedFieldValuesWithDefinition.new(reference_type: reference_type,
                                               label: label,
                                               field_type: field_type,
                                               customer_visible: customer_visible,
                                               read_only: read_only,
                                               text_min_length: text_min_length,
                                               text_max_length: text_max_length,
                                               text_default_value: text_default_value,
                                               possible_values: possible_values,
                                               value: value,
                                               position: position,
                                               definition_id: definition_id,
                                               merchant_defined_data_index: merchant_defined_data_index,
                                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 65

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['reference_type'] = 'referenceType'
  @_hash['label'] = 'label'
  @_hash['field_type'] = 'fieldType'
  @_hash['customer_visible'] = 'customerVisible'
  @_hash['read_only'] = 'readOnly'
  @_hash['text_min_length'] = 'textMinLength'
  @_hash['text_max_length'] = 'textMaxLength'
  @_hash['text_default_value'] = 'textDefaultValue'
  @_hash['possible_values'] = 'possibleValues'
  @_hash['value'] = 'value'
  @_hash['position'] = 'position'
  @_hash['definition_id'] = 'definitionId'
  @_hash['merchant_defined_data_index'] = 'merchantDefinedDataIndex'
  @_hash
end

.nullablesObject

An array for nullable fields



103
104
105
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 103

def self.nullables
  []
end

.optionalsObject

An array for optional fields



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 84

def self.optionals
  %w[
    reference_type
    label
    field_type
    customer_visible
    read_only
    text_min_length
    text_max_length
    text_default_value
    possible_values
    value
    position
    definition_id
    merchant_defined_data_index
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 264

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} reference_type: #{@reference_type.inspect}, label: #{@label.inspect},"\
  " field_type: #{@field_type.inspect}, customer_visible: #{@customer_visible.inspect},"\
  " read_only: #{@read_only.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}, value:"\
  " #{@value.inspect}, position: #{@position.inspect}, definition_id:"\
  " #{@definition_id.inspect}, merchant_defined_data_index:"\
  " #{@merchant_defined_data_index.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



252
253
254
255
256
257
258
259
260
261
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 252

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} reference_type: #{@reference_type}, label: #{@label}, field_type:"\
  " #{@field_type}, customer_visible: #{@customer_visible}, read_only: #{@read_only},"\
  " text_min_length: #{@text_min_length}, text_max_length: #{@text_max_length},"\
  " text_default_value: #{@text_default_value}, possible_values: #{@possible_values}, value:"\
  " #{@value}, position: #{@position}, definition_id: #{@definition_id},"\
  " merchant_defined_data_index: #{@merchant_defined_data_index}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/cyber_source_merged_spec/models/merchant_defined_field_values_with_definition.rb', line 223

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'referenceType', reference_type)
  XmlUtilities.add_as_subelement(doc, root, 'label', label)
  XmlUtilities.add_as_subelement(doc, root, 'fieldType', field_type)
  XmlUtilities.add_as_subelement(doc, root, 'customerVisible',
                                 customer_visible)
  XmlUtilities.add_as_subelement(doc, root, 'readOnly', read_only)
  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, 'value', value)
  XmlUtilities.add_as_subelement(doc, root, 'position', position)
  XmlUtilities.add_as_subelement(doc, root, 'definitionId', definition_id)
  XmlUtilities.add_as_subelement(doc, root, 'merchantDefinedDataIndex',
                                 merchant_defined_data_index)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end