Class: ApiReference::NewItem
- Defined in:
- lib/api_reference/models/new_item.rb
Overview
NewItem Model.
Instance Attribute Summary collapse
-
#metadata ⇒ Hash[String, String]
User-specified key/value pairs for the resource.
-
#name ⇒ String
The name of the item.
Class Method Summary collapse
-
.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(name:, metadata: SKIP) ⇒ NewItem
constructor
A new instance of NewItem.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the 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(name:, metadata: SKIP) ⇒ NewItem
Returns a new instance of NewItem.
44 45 46 47 |
# File 'lib/api_reference/models/new_item.rb', line 44 def initialize(name:, metadata: SKIP) @metadata = unless == SKIP @name = name end |
Instance Attribute Details
#metadata ⇒ Hash[String, String]
User-specified key/value pairs for the resource. Individual keys can be
removed by setting the value to null, and the entire metadata mapping
can be cleared by setting metadata to null.
16 17 18 |
# File 'lib/api_reference/models/new_item.rb', line 16 def @metadata end |
#name ⇒ String
The name of the item.
20 21 22 |
# File 'lib/api_reference/models/new_item.rb', line 20 def name @name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/api_reference/models/new_item.rb', line 50 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil = hash.key?('metadata') ? hash['metadata'] : SKIP # Create object from extracted values. NewItem.new(name: name, metadata: ) end |
.names ⇒ Object
A mapping from model property names to API property names.
23 24 25 26 27 28 |
# File 'lib/api_reference/models/new_item.rb', line 23 def self.names @_hash = {} if @_hash.nil? @_hash['metadata'] = 'metadata' @_hash['name'] = 'name' @_hash end |
.nullables ⇒ Object
An array for nullable fields
38 39 40 41 42 |
# File 'lib/api_reference/models/new_item.rb', line 38 def self.nullables %w[ metadata ] end |
.optionals ⇒ Object
An array for optional fields
31 32 33 34 35 |
# File 'lib/api_reference/models/new_item.rb', line 31 def self.optionals %w[ metadata ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
69 70 71 72 |
# File 'lib/api_reference/models/new_item.rb', line 69 def inspect class_name = self.class.name.split('::').last "<#{class_name} metadata: #{@metadata.inspect}, name: #{@name.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
63 64 65 66 |
# File 'lib/api_reference/models/new_item.rb', line 63 def to_s class_name = self.class.name.split('::').last "<#{class_name} metadata: #{@metadata}, name: #{@name}>" end |