Class: AdvancedBilling::CreatedPrepayment

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

Overview

CreatedPrepayment Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = SKIP, subscription_id = SKIP, amount_in_cents = SKIP, memo = SKIP, created_at = SKIP, starting_balance_in_cents = SKIP, ending_balance_in_cents = SKIP) ⇒ CreatedPrepayment

Returns a new instance of CreatedPrepayment.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/advanced_billing/models/created_prepayment.rb', line 71

def initialize(id = SKIP, subscription_id = SKIP, amount_in_cents = SKIP,
               memo = SKIP, created_at = SKIP,
               starting_balance_in_cents = SKIP,
               ending_balance_in_cents = SKIP)
  @id = id unless id == SKIP
  @subscription_id = subscription_id unless subscription_id == SKIP
  @amount_in_cents = amount_in_cents unless amount_in_cents == SKIP
  @memo = memo unless memo == SKIP
  @created_at = created_at unless created_at == SKIP
  unless starting_balance_in_cents == SKIP
    @starting_balance_in_cents =
      starting_balance_in_cents
  end
  @ending_balance_in_cents = ending_balance_in_cents unless ending_balance_in_cents == SKIP
end

Instance Attribute Details

#amount_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def amount_in_cents
  @amount_in_cents
end

#created_atString

TODO: Write general description for this method

Returns:

  • (String)


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

def created_at
  @created_at
end

#ending_balance_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


38
39
40
# File 'lib/advanced_billing/models/created_prepayment.rb', line 38

def ending_balance_in_cents
  @ending_balance_in_cents
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#memoString

TODO: Write general description for this method

Returns:

  • (String)


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

def memo
  @memo
end

#starting_balance_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


34
35
36
# File 'lib/advanced_billing/models/created_prepayment.rb', line 34

def starting_balance_in_cents
  @starting_balance_in_cents
end

#subscription_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def subscription_id
  @subscription_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/advanced_billing/models/created_prepayment.rb', line 88

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  subscription_id =
    hash.key?('subscription_id') ? hash['subscription_id'] : SKIP
  amount_in_cents =
    hash.key?('amount_in_cents') ? hash['amount_in_cents'] : SKIP
  memo = hash.key?('memo') ? hash['memo'] : SKIP
  created_at = hash.key?('created_at') ? hash['created_at'] : SKIP
  starting_balance_in_cents =
    hash.key?('starting_balance_in_cents') ? hash['starting_balance_in_cents'] : SKIP
  ending_balance_in_cents =
    hash.key?('ending_balance_in_cents') ? hash['ending_balance_in_cents'] : SKIP

  # Create object from extracted values.
  CreatedPrepayment.new(id,
                        subscription_id,
                        amount_in_cents,
                        memo,
                        created_at,
                        starting_balance_in_cents,
                        ending_balance_in_cents)
end

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/advanced_billing/models/created_prepayment.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['subscription_id'] = 'subscription_id'
  @_hash['amount_in_cents'] = 'amount_in_cents'
  @_hash['memo'] = 'memo'
  @_hash['created_at'] = 'created_at'
  @_hash['starting_balance_in_cents'] = 'starting_balance_in_cents'
  @_hash['ending_balance_in_cents'] = 'ending_balance_in_cents'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/advanced_billing/models/created_prepayment.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    id
    subscription_id
    amount_in_cents
    memo
    created_at
    starting_balance_in_cents
    ending_balance_in_cents
  ]
end