Class: AdvancedBilling::Contract
- Defined in:
- lib/advanced_billing/models/contract.rb
Overview
Contract linked to the scheduled renewal configuration.
Instance Attribute Summary collapse
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#maxio_id ⇒ String
TODO: Write general description for this method.
-
#number ⇒ String
TODO: Write general description for this method.
-
#register ⇒ Register
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.
Instance Method Summary collapse
-
#initialize(id: SKIP, maxio_id: SKIP, number: SKIP, register: SKIP, additional_properties: {}) ⇒ Contract
constructor
A new instance of Contract.
-
#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(id: SKIP, maxio_id: SKIP, number: SKIP, register: SKIP, additional_properties: {}) ⇒ Contract
Returns a new instance of Contract.
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/advanced_billing/models/contract.rb', line 55 def initialize(id: SKIP, maxio_id: SKIP, number: SKIP, register: 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 @maxio_id = maxio_id unless maxio_id == SKIP @number = number unless number == SKIP @register = register unless register == SKIP end |
Instance Attribute Details
#id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/contract.rb', line 14 def id @id end |
#maxio_id ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/contract.rb', line 18 def maxio_id @maxio_id end |
#number ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/contract.rb', line 22 def number @number end |
#register ⇒ Register
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/contract.rb', line 26 def register @register end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/advanced_billing/models/contract.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP maxio_id = hash.key?('maxio_id') ? hash['maxio_id'] : SKIP number = hash.key?('number') ? hash['number'] : SKIP register = Register.from_hash(hash['register']) if hash['register'] # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. Contract.new(id: id, maxio_id: maxio_id, number: number, register: register, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/advanced_billing/models/contract.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['maxio_id'] = 'maxio_id' @_hash['number'] = 'number' @_hash['register'] = 'register' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 52 53 |
# File 'lib/advanced_billing/models/contract.rb', line 49 def self.nullables %w[ number ] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/advanced_billing/models/contract.rb', line 39 def self.optionals %w[ id maxio_id number register ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
97 98 99 100 101 102 |
# File 'lib/advanced_billing/models/contract.rb', line 97 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, maxio_id: #{@maxio_id.inspect}, number:"\ " #{@number.inspect}, register: #{@register.inspect}, additional_properties:"\ " #{get_additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
90 91 92 93 94 |
# File 'lib/advanced_billing/models/contract.rb', line 90 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, maxio_id: #{@maxio_id}, number: #{@number}, register:"\ " #{@register}, additional_properties: #{get_additional_properties}>" end |