Class: AdvancedBilling::ListSubcriptionGroupPrepaymentItem

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

Overview

ListSubcriptionGroupPrepaymentItem 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_group_uid: SKIP, amount_in_cents: SKIP, remaining_amount_in_cents: SKIP, details: SKIP, external: SKIP, memo: SKIP, payment_type: SKIP, created_at: SKIP, additional_properties: {}) ⇒ ListSubcriptionGroupPrepaymentItem

Returns a new instance of ListSubcriptionGroupPrepaymentItem.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 84

def initialize(id: SKIP, subscription_group_uid: SKIP,
               amount_in_cents: SKIP, remaining_amount_in_cents: SKIP,
               details: SKIP, external: SKIP, memo: SKIP,
               payment_type: SKIP, created_at: SKIP,
               additional_properties: {})
  @id = id unless id == SKIP
  @subscription_group_uid = subscription_group_uid unless subscription_group_uid == SKIP
  @amount_in_cents = amount_in_cents unless amount_in_cents == SKIP
  unless remaining_amount_in_cents == SKIP
    @remaining_amount_in_cents =
      remaining_amount_in_cents
  end
  @details = details unless details == SKIP
  @external = external unless external == SKIP
  @memo = memo unless memo == SKIP
  @payment_type = payment_type unless payment_type == SKIP
  @created_at = created_at unless created_at == SKIP

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

Instance Attribute Details

#amount_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


23
24
25
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 23

def amount_in_cents
  @amount_in_cents
end

#created_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


47
48
49
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 47

def created_at
  @created_at
end

#detailsString

TODO: Write general description for this method

Returns:

  • (String)


31
32
33
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 31

def details
  @details
end

#externalTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


35
36
37
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 35

def external
  @external
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


15
16
17
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 15

def id
  @id
end

#memoString

TODO: Write general description for this method

Returns:

  • (String)


39
40
41
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 39

def memo
  @memo
end

#payment_typePrepaymentMethod

TODO: Write general description for this method

Returns:



43
44
45
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 43

def payment_type
  @payment_type
end

#remaining_amount_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


27
28
29
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 27

def remaining_amount_in_cents
  @remaining_amount_in_cents
end

#subscription_group_uidString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 19

def subscription_group_uid
  @subscription_group_uid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



109
110
111
112
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
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 109

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  subscription_group_uid =
    hash.key?('subscription_group_uid') ? hash['subscription_group_uid'] : SKIP
  amount_in_cents =
    hash.key?('amount_in_cents') ? hash['amount_in_cents'] : SKIP
  remaining_amount_in_cents =
    hash.key?('remaining_amount_in_cents') ? hash['remaining_amount_in_cents'] : SKIP
  details = hash.key?('details') ? hash['details'] : SKIP
  external = hash.key?('external') ? hash['external'] : SKIP
  memo = hash.key?('memo') ? hash['memo'] : SKIP
  payment_type = hash.key?('payment_type') ? hash['payment_type'] : SKIP
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               else
                 SKIP
               end

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

  # Create object from extracted values.
  ListSubcriptionGroupPrepaymentItem.new(id: id,
                                         subscription_group_uid: subscription_group_uid,
                                         amount_in_cents: amount_in_cents,
                                         remaining_amount_in_cents: remaining_amount_in_cents,
                                         details: details,
                                         external: external,
                                         memo: memo,
                                         payment_type: payment_type,
                                         created_at: created_at,
                                         additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 50

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['subscription_group_uid'] = 'subscription_group_uid'
  @_hash['amount_in_cents'] = 'amount_in_cents'
  @_hash['remaining_amount_in_cents'] = 'remaining_amount_in_cents'
  @_hash['details'] = 'details'
  @_hash['external'] = 'external'
  @_hash['memo'] = 'memo'
  @_hash['payment_type'] = 'payment_type'
  @_hash['created_at'] = 'created_at'
  @_hash
end

.nullablesObject

An array for nullable fields



80
81
82
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 80

def self.nullables
  []
end

.optionalsObject

An array for optional fields



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 65

def self.optionals
  %w[
    id
    subscription_group_uid
    amount_in_cents
    remaining_amount_in_cents
    details
    external
    memo
    payment_type
    created_at
  ]
end

Instance Method Details

#to_custom_created_atObject



146
147
148
# File 'lib/advanced_billing/models/list_subcription_group_prepayment_item.rb', line 146

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end