Class: AdvancedBilling::InvoiceCustomField
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::InvoiceCustomField
- Defined in:
- lib/advanced_billing/models/invoice_custom_field.rb
Overview
InvoiceCustomField Model.
Instance Attribute Summary collapse
-
#metadatum_id ⇒ Integer
TODO: Write general description for this method.
-
#name ⇒ String
TODO: Write general description for this method.
-
#owner_id ⇒ Integer
TODO: Write general description for this method.
-
#owner_type ⇒ CustomFieldOwner
TODO: Write general description for this method.
-
#value ⇒ String
TODO: Write general description for this method.
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(owner_id: SKIP, owner_type: SKIP, name: SKIP, value: SKIP, metadatum_id: SKIP, additional_properties: {}) ⇒ InvoiceCustomField
constructor
A new instance of InvoiceCustomField.
Methods inherited from BaseModel
Constructor Details
#initialize(owner_id: SKIP, owner_type: SKIP, name: SKIP, value: SKIP, metadatum_id: SKIP, additional_properties: {}) ⇒ InvoiceCustomField
Returns a new instance of InvoiceCustomField.
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/advanced_billing/models/invoice_custom_field.rb', line 59 def initialize(owner_id: SKIP, owner_type: SKIP, name: SKIP, value: SKIP, metadatum_id: SKIP, additional_properties: {}) @owner_id = owner_id unless owner_id == SKIP @owner_type = owner_type unless owner_type == SKIP @name = name unless name == SKIP @value = value unless value == SKIP @metadatum_id = unless == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#metadatum_id ⇒ Integer
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/invoice_custom_field.rb', line 30 def @metadatum_id end |
#name ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/invoice_custom_field.rb', line 22 def name @name end |
#owner_id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/invoice_custom_field.rb', line 14 def owner_id @owner_id end |
#owner_type ⇒ CustomFieldOwner
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/invoice_custom_field.rb', line 18 def owner_type @owner_type end |
#value ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/invoice_custom_field.rb', line 26 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/advanced_billing/models/invoice_custom_field.rb', line 74 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. owner_id = hash.key?('owner_id') ? hash['owner_id'] : SKIP owner_type = hash.key?('owner_type') ? hash['owner_type'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP value = hash.key?('value') ? hash['value'] : SKIP = hash.key?('metadatum_id') ? hash['metadatum_id'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. InvoiceCustomField.new(owner_id: owner_id, owner_type: owner_type, name: name, value: value, metadatum_id: , additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/advanced_billing/models/invoice_custom_field.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['owner_id'] = 'owner_id' @_hash['owner_type'] = 'owner_type' @_hash['name'] = 'name' @_hash['value'] = 'value' @_hash['metadatum_id'] = 'metadatum_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/advanced_billing/models/invoice_custom_field.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/advanced_billing/models/invoice_custom_field.rb', line 44 def self.optionals %w[ owner_id owner_type name value metadatum_id ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
98 99 100 101 102 103 104 |
# File 'lib/advanced_billing/models/invoice_custom_field.rb', line 98 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |