Class: AdvancedBilling::ProductFamily
- Defined in:
- lib/advanced_billing/models/product_family.rb
Overview
ProductFamily Model.
Instance Attribute Summary collapse
-
#accounting_code ⇒ String
TODO: Write general description for this method.
-
#archived_at ⇒ DateTime
Timestamp indicating when this product family was archived.
-
#created_at ⇒ DateTime
Whether surcharging applies to this product family.
-
#description ⇒ String
TODO: Write general description for this method.
-
#handle ⇒ String
TODO: Write general description for this method.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#name ⇒ String
TODO: Write general description for this method.
-
#surcharging ⇒ TrueClass | FalseClass
Whether surcharging applies to this product family.
-
#updated_at ⇒ DateTime
Whether surcharging applies to this product family.
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(id: SKIP, name: SKIP, handle: SKIP, accounting_code: SKIP, description: SKIP, surcharging: SKIP, created_at: SKIP, updated_at: SKIP, archived_at: SKIP, additional_properties: {}) ⇒ ProductFamily
constructor
A new instance of ProductFamily.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_archived_at ⇒ Object
- #to_custom_created_at ⇒ Object
- #to_custom_updated_at ⇒ Object
-
#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(id: SKIP, name: SKIP, handle: SKIP, accounting_code: SKIP, description: SKIP, surcharging: SKIP, created_at: SKIP, updated_at: SKIP, archived_at: SKIP, additional_properties: {}) ⇒ ProductFamily
Returns a new instance of ProductFamily.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/advanced_billing/models/product_family.rb', line 92 def initialize(id: SKIP, name: SKIP, handle: SKIP, accounting_code: SKIP, description: SKIP, surcharging: SKIP, created_at: SKIP, updated_at: SKIP, archived_at: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @id = id unless id == SKIP @name = name unless name == SKIP @handle = handle unless handle == SKIP @accounting_code = accounting_code unless accounting_code == SKIP @description = description unless description == SKIP @surcharging = surcharging unless surcharging == SKIP @created_at = created_at unless created_at == SKIP @updated_at = updated_at unless updated_at == SKIP @archived_at = archived_at unless archived_at == SKIP end |
Instance Attribute Details
#accounting_code ⇒ String
TODO: Write general description for this method
27 28 29 |
# File 'lib/advanced_billing/models/product_family.rb', line 27 def accounting_code @accounting_code end |
#archived_at ⇒ DateTime
Timestamp indicating when this product family was archived. null if the
product family is not archived.
51 52 53 |
# File 'lib/advanced_billing/models/product_family.rb', line 51 def archived_at @archived_at end |
#created_at ⇒ DateTime
Whether surcharging applies to this product family. Only included on sites where surcharging is enabled.
41 42 43 |
# File 'lib/advanced_billing/models/product_family.rb', line 41 def created_at @created_at end |
#description ⇒ String
TODO: Write general description for this method
31 32 33 |
# File 'lib/advanced_billing/models/product_family.rb', line 31 def description @description end |
#handle ⇒ String
TODO: Write general description for this method
23 24 25 |
# File 'lib/advanced_billing/models/product_family.rb', line 23 def handle @handle end |
#id ⇒ Integer
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/product_family.rb', line 15 def id @id end |
#name ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/advanced_billing/models/product_family.rb', line 19 def name @name end |
#surcharging ⇒ TrueClass | FalseClass
Whether surcharging applies to this product family. Only included on sites where surcharging is enabled.
36 37 38 |
# File 'lib/advanced_billing/models/product_family.rb', line 36 def surcharging @surcharging end |
#updated_at ⇒ DateTime
Whether surcharging applies to this product family. Only included on sites where surcharging is enabled.
46 47 48 |
# File 'lib/advanced_billing/models/product_family.rb', line 46 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/advanced_billing/models/product_family.rb', line 113 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 handle = hash.key?('handle') ? hash['handle'] : SKIP accounting_code = hash.key?('accounting_code') ? hash['accounting_code'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP surcharging = hash.key?('surcharging') ? hash['surcharging'] : SKIP created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) else SKIP end updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) else SKIP end archived_at = if hash.key?('archived_at') (DateTimeHelper.from_rfc3339(hash['archived_at']) if hash['archived_at']) else SKIP end # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. ProductFamily.new(id: id, name: name, handle: handle, accounting_code: accounting_code, description: description, surcharging: surcharging, created_at: created_at, updated_at: updated_at, archived_at: archived_at, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/advanced_billing/models/product_family.rb', line 54 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['name'] = 'name' @_hash['handle'] = 'handle' @_hash['accounting_code'] = 'accounting_code' @_hash['description'] = 'description' @_hash['surcharging'] = 'surcharging' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash['archived_at'] = 'archived_at' @_hash end |
.nullables ⇒ Object
An array for nullable fields
84 85 86 87 88 89 90 |
# File 'lib/advanced_billing/models/product_family.rb', line 84 def self.nullables %w[ accounting_code description archived_at ] end |
.optionals ⇒ Object
An array for optional fields
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/advanced_billing/models/product_family.rb', line 69 def self.optionals %w[ id name handle accounting_code description surcharging created_at updated_at archived_at ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
178 179 180 181 182 183 184 185 |
# File 'lib/advanced_billing/models/product_family.rb', line 178 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, handle: #{@handle.inspect},"\ " accounting_code: #{@accounting_code.inspect}, description: #{@description.inspect},"\ " surcharging: #{@surcharging.inspect}, created_at: #{@created_at.inspect}, updated_at:"\ " #{@updated_at.inspect}, archived_at: #{@archived_at.inspect}, additional_properties:"\ " #{get_additional_properties}>" end |
#to_custom_archived_at ⇒ Object
164 165 166 |
# File 'lib/advanced_billing/models/product_family.rb', line 164 def to_custom_archived_at DateTimeHelper.to_rfc3339(archived_at) end |
#to_custom_created_at ⇒ Object
156 157 158 |
# File 'lib/advanced_billing/models/product_family.rb', line 156 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_updated_at ⇒ Object
160 161 162 |
# File 'lib/advanced_billing/models/product_family.rb', line 160 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
169 170 171 172 173 174 175 |
# File 'lib/advanced_billing/models/product_family.rb', line 169 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, name: #{@name}, handle: #{@handle}, accounting_code:"\ " #{@accounting_code}, description: #{@description}, surcharging: #{@surcharging},"\ " created_at: #{@created_at}, updated_at: #{@updated_at}, archived_at: #{@archived_at},"\ " additional_properties: #{get_additional_properties}>" end |