Class: AdvancedBilling::CreditAccountBalanceChanged

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

Overview

CreditAccountBalanceChanged Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(reason = nil, service_credit_account_balance_in_cents = nil, service_credit_balance_change_in_cents = nil, currency_code = nil, at_time = nil) ⇒ CreditAccountBalanceChanged

Returns a new instance of CreditAccountBalanceChanged.



55
56
57
58
59
60
61
62
63
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 55

def initialize(reason = nil,  = nil,
               service_credit_balance_change_in_cents = nil,
               currency_code = nil, at_time = nil)
  @reason = reason
   = 
  @service_credit_balance_change_in_cents = service_credit_balance_change_in_cents
  @currency_code = currency_code
  @at_time = at_time
end

Instance Attribute Details

#at_timeString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 30

def at_time
  @at_time
end

#currency_codeString

TODO: Write general description for this method

Returns:

  • (String)


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

def currency_code
  @currency_code
end

#reasonString

TODO: Write general description for this method

Returns:

  • (String)


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

def reason
  @reason
end

#service_credit_account_balance_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def 
  
end

#service_credit_balance_change_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def service_credit_balance_change_in_cents
  @service_credit_balance_change_in_cents
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  reason = hash.key?('reason') ? hash['reason'] : nil
   =
    hash.key?('service_credit_account_balance_in_cents') ? hash['service_credit_account_balance_in_cents'] : nil
  service_credit_balance_change_in_cents =
    hash.key?('service_credit_balance_change_in_cents') ? hash['service_credit_balance_change_in_cents'] : nil
  currency_code = hash.key?('currency_code') ? hash['currency_code'] : nil
  at_time = hash.key?('at_time') ? hash['at_time'] : nil

  # Create object from extracted values.

  CreditAccountBalanceChanged.new(reason,
                                  ,
                                  service_credit_balance_change_in_cents,
                                  currency_code,
                                  at_time)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['reason'] = 'reason'
  @_hash['service_credit_account_balance_in_cents'] =
    'service_credit_account_balance_in_cents'
  @_hash['service_credit_balance_change_in_cents'] =
    'service_credit_balance_change_in_cents'
  @_hash['currency_code'] = 'currency_code'
  @_hash['at_time'] = 'at_time'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 46

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 88

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.reason,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.service_credit_balance_change_in_cents,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.currency_code,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.at_time,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['reason'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['service_credit_account_balance_in_cents'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['service_credit_balance_change_in_cents'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['currency_code'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['at_time'],
                            ->(val) { val.instance_of? String })
  )
end