Class: CyberSourceMergedSpec::Attribute
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::Attribute
- Defined in:
- lib/cyber_source_merged_spec/models/attribute.rb
Overview
Attribute Model.
Instance Attribute Summary collapse
-
#default ⇒ TrueClass | FalseClass
Attribute Filter Type.
-
#description ⇒ String
TODO: Write general description for this method.
-
#filter_type ⇒ String
Attribute Filter Type.
-
#id ⇒ String
TODO: Write general description for this method.
-
#name ⇒ String
TODO: Write general description for this method.
-
#required ⇒ TrueClass | FalseClass
Attribute Filter Type.
-
#supported_type ⇒ String
Valid values for the filter.
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(id: SKIP, name: SKIP, description: SKIP, filter_type: SKIP, default: SKIP, required: SKIP, supported_type: SKIP, additional_properties: nil) ⇒ Attribute
constructor
A new instance of Attribute.
-
#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(id: SKIP, name: SKIP, description: SKIP, filter_type: SKIP, default: SKIP, required: SKIP, supported_type: SKIP, additional_properties: nil) ⇒ Attribute
Returns a new instance of Attribute.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 71 def initialize(id: SKIP, name: SKIP, description: SKIP, filter_type: SKIP, default: SKIP, required: SKIP, supported_type: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id unless id == SKIP @name = name unless name == SKIP @description = description unless description == SKIP @filter_type = filter_type unless filter_type == SKIP @default = default unless default == SKIP @required = required unless required == SKIP @supported_type = supported_type unless supported_type == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#default ⇒ TrueClass | FalseClass
Attribute Filter Type.
30 31 32 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 30 def default @default end |
#description ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 22 def description @description end |
#filter_type ⇒ String
Attribute Filter Type.
26 27 28 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 26 def filter_type @filter_type end |
#id ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 14 def id @id end |
#name ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 18 def name @name end |
#required ⇒ TrueClass | FalseClass
Attribute Filter Type.
34 35 36 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 34 def required @required end |
#supported_type ⇒ String
Valid values for the filter.
38 39 40 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 38 def supported_type @supported_type end |
Class Method Details
.from_element(root) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 118 def self.from_element(root) id = XmlUtilities.from_element(root, 'id', String) name = XmlUtilities.from_element(root, 'name', String) description = XmlUtilities.from_element(root, 'description', String) filter_type = XmlUtilities.from_element(root, 'filterType', String) default = XmlUtilities.from_element(root, 'default', TrueClass) required = XmlUtilities.from_element(root, 'required', TrueClass) supported_type = XmlUtilities.from_element(root, 'supportedType', String) new(id: id, name: name, description: description, filter_type: filter_type, default: default, required: required, supported_type: supported_type, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
88 89 90 91 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/attribute.rb', line 88 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP filter_type = hash.key?('filterType') ? hash['filterType'] : SKIP default = hash.key?('default') ? hash['default'] : SKIP required = hash.key?('required') ? hash['required'] : SKIP supported_type = hash.key?('supportedType') ? hash['supportedType'] : 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. Attribute.new(id: id, name: name, description: description, filter_type: filter_type, default: default, required: required, supported_type: supported_type, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['name'] = 'name' @_hash['description'] = 'description' @_hash['filter_type'] = 'filterType' @_hash['default'] = 'default' @_hash['required'] = 'required' @_hash['supported_type'] = 'supportedType' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 54 def self.optionals %w[ id name description filter_type default required supported_type ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
162 163 164 165 166 167 168 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 162 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, description:"\ " #{@description.inspect}, filter_type: #{@filter_type.inspect}, default:"\ " #{@default.inspect}, required: #{@required.inspect}, supported_type:"\ " #{@supported_type.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
154 155 156 157 158 159 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 154 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, name: #{@name}, description: #{@description}, filter_type:"\ " #{@filter_type}, default: #{@default}, required: #{@required}, supported_type:"\ " #{@supported_type}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/cyber_source_merged_spec/models/attribute.rb', line 137 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'id', id) XmlUtilities.add_as_subelement(doc, root, 'name', name) XmlUtilities.add_as_subelement(doc, root, 'description', description) XmlUtilities.add_as_subelement(doc, root, 'filterType', filter_type) XmlUtilities.add_as_subelement(doc, root, 'default', default) XmlUtilities.add_as_subelement(doc, root, 'required', required) XmlUtilities.add_as_subelement(doc, root, 'supportedType', supported_type) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |