Class: AdvancedBilling::SubscriptionGroupBalances

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/subscription_group_balances.rb

Overview

SubscriptionGroupBalances Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(prepayments: SKIP, service_credits: SKIP, open_invoices: SKIP, pending_discounts: SKIP, additional_properties: {}) ⇒ SubscriptionGroupBalances

Returns a new instance of SubscriptionGroupBalances.



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/advanced_billing/models/subscription_group_balances.rb', line 53

def initialize(prepayments: SKIP, service_credits: SKIP,
               open_invoices: SKIP, pending_discounts: SKIP,
               additional_properties: {})
  @prepayments = prepayments unless prepayments == SKIP
  @service_credits = service_credits unless service_credits == SKIP
  @open_invoices = open_invoices unless open_invoices == SKIP
  @pending_discounts = pending_discounts unless pending_discounts == SKIP

  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end
end

Instance Attribute Details

#open_invoicesAccountBalance

TODO: Write general description for this method

Returns:



22
23
24
# File 'lib/advanced_billing/models/subscription_group_balances.rb', line 22

def open_invoices
  @open_invoices
end

#pending_discountsAccountBalance

TODO: Write general description for this method

Returns:



26
27
28
# File 'lib/advanced_billing/models/subscription_group_balances.rb', line 26

def pending_discounts
  @pending_discounts
end

#prepaymentsAccountBalance

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/advanced_billing/models/subscription_group_balances.rb', line 14

def prepayments
  @prepayments
end

#service_creditsAccountBalance

TODO: Write general description for this method

Returns:



18
19
20
# File 'lib/advanced_billing/models/subscription_group_balances.rb', line 18

def service_credits
  @service_credits
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/advanced_billing/models/subscription_group_balances.rb', line 68

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  prepayments = AccountBalance.from_hash(hash['prepayments']) if hash['prepayments']
  service_credits = AccountBalance.from_hash(hash['service_credits']) if
    hash['service_credits']
  open_invoices = AccountBalance.from_hash(hash['open_invoices']) if hash['open_invoices']
  pending_discounts = AccountBalance.from_hash(hash['pending_discounts']) if
    hash['pending_discounts']

  # Clean out expected properties from Hash.
  names.each_value { |k| hash.delete(k) }

  # Create object from extracted values.
  SubscriptionGroupBalances.new(prepayments: prepayments,
                                service_credits: service_credits,
                                open_invoices: open_invoices,
                                pending_discounts: pending_discounts,
                                additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/advanced_billing/models/subscription_group_balances.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['prepayments'] = 'prepayments'
  @_hash['service_credits'] = 'service_credits'
  @_hash['open_invoices'] = 'open_invoices'
  @_hash['pending_discounts'] = 'pending_discounts'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/advanced_billing/models/subscription_group_balances.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/advanced_billing/models/subscription_group_balances.rb', line 39

def self.optionals
  %w[
    prepayments
    service_credits
    open_invoices
    pending_discounts
  ]
end