Class: AdvancedBilling::CreditNoteApplication

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

Overview

CreditNoteApplication Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(uid = SKIP, transaction_time = SKIP, invoice_uid = SKIP, memo = SKIP, applied_amount = SKIP) ⇒ CreditNoteApplication

Returns a new instance of CreditNoteApplication.



59
60
61
62
63
64
65
66
# File 'lib/advanced_billing/models/credit_note_application.rb', line 59

def initialize(uid = SKIP, transaction_time = SKIP, invoice_uid = SKIP,
               memo = SKIP, applied_amount = SKIP)
  @uid = uid unless uid == SKIP
  @transaction_time = transaction_time unless transaction_time == SKIP
  @invoice_uid = invoice_uid unless invoice_uid == SKIP
  @memo = memo unless memo == SKIP
  @applied_amount = applied_amount unless applied_amount == SKIP
end

Instance Attribute Details

#applied_amountString

TODO: Write general description for this method

Returns:

  • (String)


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

def applied_amount
  @applied_amount
end

#invoice_uidString

TODO: Write general description for this method

Returns:

  • (String)


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

def invoice_uid
  @invoice_uid
end

#memoString

TODO: Write general description for this method

Returns:

  • (String)


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

def memo
  @memo
end

#transaction_timeString

TODO: Write general description for this method

Returns:

  • (String)


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

def transaction_time
  @transaction_time
end

#uidString

TODO: Write general description for this method

Returns:

  • (String)


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

def uid
  @uid
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/credit_note_application.rb', line 69

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  uid = hash.key?('uid') ? hash['uid'] : SKIP
  transaction_time =
    hash.key?('transaction_time') ? hash['transaction_time'] : SKIP
  invoice_uid = hash.key?('invoice_uid') ? hash['invoice_uid'] : SKIP
  memo = hash.key?('memo') ? hash['memo'] : SKIP
  applied_amount =
    hash.key?('applied_amount') ? hash['applied_amount'] : SKIP

  # Create object from extracted values.
  CreditNoteApplication.new(uid,
                            transaction_time,
                            invoice_uid,
                            memo,
                            applied_amount)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['uid'] = 'uid'
  @_hash['transaction_time'] = 'transaction_time'
  @_hash['invoice_uid'] = 'invoice_uid'
  @_hash['memo'] = 'memo'
  @_hash['applied_amount'] = 'applied_amount'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/advanced_billing/models/credit_note_application.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/advanced_billing/models/credit_note_application.rb', line 44

def self.optionals
  %w[
    uid
    transaction_time
    invoice_uid
    memo
    applied_amount
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



91
92
93
94
95
96
97
# File 'lib/advanced_billing/models/credit_note_application.rb', line 91

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end