Class: AdvancedBilling::UpdateMetafield
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::UpdateMetafield
- Defined in:
- lib/advanced_billing/models/update_metafield.rb
Overview
UpdateMetafield Model.
Instance Attribute Summary collapse
-
#current_name ⇒ String
TODO: Write general description for this method.
-
#enum ⇒ Array[String]
Only applicable when input_type is radio or dropdown.
-
#input_type ⇒ MetafieldInput
Indicates the type of metafield.
-
#name ⇒ String
TODO: Write general description for this method.
-
#scope ⇒ MetafieldScope
Warning: When updating a metafield’s scope attribute, all scope attributes must be passed.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(current_name: SKIP, name: SKIP, scope: SKIP, input_type: SKIP, enum: SKIP, additional_properties: {}) ⇒ UpdateMetafield
constructor
A new instance of UpdateMetafield.
-
#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, #get_additional_properties, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(current_name: SKIP, name: SKIP, scope: SKIP, input_type: SKIP, enum: SKIP, additional_properties: {}) ⇒ UpdateMetafield
Returns a new instance of UpdateMetafield.
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 63 def initialize(current_name: SKIP, name: SKIP, scope: SKIP, input_type: SKIP, enum: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @current_name = current_name unless current_name == SKIP @name = name unless name == SKIP @scope = scope unless scope == SKIP @input_type = input_type unless input_type == SKIP @enum = enum unless enum == SKIP end |
Instance Attribute Details
#current_name ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 14 def current_name @current_name end |
#enum ⇒ Array[String]
Only applicable when input_type is radio or dropdown.
34 35 36 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 34 def enum @enum end |
#input_type ⇒ MetafieldInput
Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to ‘text’.
30 31 32 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 30 def input_type @input_type end |
#name ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 18 def name @name end |
#scope ⇒ MetafieldScope
Warning: When updating a metafield’s scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings.
24 25 26 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 24 def scope @scope end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 78 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. current_name = hash.key?('current_name') ? hash['current_name'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP scope = MetafieldScope.from_hash(hash['scope']) if hash['scope'] input_type = hash.key?('input_type') ? hash['input_type'] : SKIP enum = hash.key?('enum') ? hash['enum'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. UpdateMetafield.new(current_name: current_name, name: name, scope: scope, input_type: input_type, enum: enum, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['current_name'] = 'current_name' @_hash['name'] = 'name' @_hash['scope'] = 'scope' @_hash['input_type'] = 'input_type' @_hash['enum'] = 'enum' @_hash end |
.nullables ⇒ Object
An array for nullable fields
59 60 61 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 59 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
48 49 50 51 52 53 54 55 56 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 48 def self.optionals %w[ current_name name scope input_type enum ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
102 103 104 105 106 107 108 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 102 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
119 120 121 122 123 124 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 119 def inspect class_name = self.class.name.split('::').last "<#{class_name} current_name: #{@current_name.inspect}, name: #{@name.inspect}, scope:"\ " #{@scope.inspect}, input_type: #{@input_type.inspect}, enum: #{@enum.inspect},"\ " additional_properties: #{get_additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
111 112 113 114 115 116 |
# File 'lib/advanced_billing/models/update_metafield.rb', line 111 def to_s class_name = self.class.name.split('::').last "<#{class_name} current_name: #{@current_name}, name: #{@name}, scope: #{@scope},"\ " input_type: #{@input_type}, enum: #{@enum}, additional_properties:"\ " #{get_additional_properties}>" end |