Class: ApiReference::ApplyParams

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/apply_params.rb

Overview

ApplyParams Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(previously_collected_amount: SKIP, mark_as_paid: SKIP, description: SKIP, payment_received_date: SKIP, payment_external_id: SKIP, payment_notes: SKIP) ⇒ ApplyParams

Returns a new instance of ApplyParams.



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/api_reference/models/apply_params.rb', line 80

def initialize(previously_collected_amount: SKIP, mark_as_paid: SKIP,
               description: SKIP, payment_received_date: SKIP,
               payment_external_id: SKIP, payment_notes: SKIP)
  unless previously_collected_amount == SKIP
    @previously_collected_amount =
      previously_collected_amount
  end
  @mark_as_paid = mark_as_paid unless mark_as_paid == SKIP
  @description = description unless description == SKIP
  @payment_received_date = payment_received_date unless payment_received_date == SKIP
  @payment_external_id = payment_external_id unless payment_external_id == SKIP
  @payment_notes = payment_notes unless payment_notes == SKIP
end

Instance Attribute Details

#descriptionString

Description to apply to the balance transaction representing this credit.

Returns:

  • (String)


26
27
28
# File 'lib/api_reference/models/apply_params.rb', line 26

def description
  @description
end

#mark_as_paidTrueClass | FalseClass

Mark all pending invoices that are payable as paid. If amount is also provided, mark as paid and credit the difference to the customer's balance.

Returns:

  • (TrueClass | FalseClass)


22
23
24
# File 'lib/api_reference/models/apply_params.rb', line 22

def mark_as_paid
  @mark_as_paid
end

#payment_external_idString

An optional external ID to associate with the payment. Only applicable when mark_as_paid is true.

Returns:

  • (String)


37
38
39
# File 'lib/api_reference/models/apply_params.rb', line 37

def payment_external_id
  @payment_external_id
end

#payment_notesString

Optional notes about the payment. Only applicable when mark_as_paid is true.

Returns:

  • (String)


42
43
44
# File 'lib/api_reference/models/apply_params.rb', line 42

def payment_notes
  @payment_notes
end

#payment_received_dateDate

A date string to specify the date the payment was received. Only applicable when mark_as_paid is true. If not provided, defaults to the current date.

Returns:

  • (Date)


32
33
34
# File 'lib/api_reference/models/apply_params.rb', line 32

def payment_received_date
  @payment_received_date
end

#previously_collected_amountString

Amount already collected to apply to the customer's balance. If mark_as_paid is also provided, credit the difference to the customer's balance.

Returns:

  • (String)


16
17
18
# File 'lib/api_reference/models/apply_params.rb', line 16

def previously_collected_amount
  @previously_collected_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/api_reference/models/apply_params.rb', line 95

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  previously_collected_amount =
    hash.key?('previously_collected_amount') ? hash['previously_collected_amount'] : SKIP
  mark_as_paid = hash.key?('mark_as_paid') ? hash['mark_as_paid'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  payment_received_date =
    hash.key?('payment_received_date') ? hash['payment_received_date'] : SKIP
  payment_external_id =
    hash.key?('payment_external_id') ? hash['payment_external_id'] : SKIP
  payment_notes = hash.key?('payment_notes') ? hash['payment_notes'] : SKIP

  # Create object from extracted values.
  ApplyParams.new(previously_collected_amount: previously_collected_amount,
                  mark_as_paid: mark_as_paid,
                  description: description,
                  payment_received_date: payment_received_date,
                  payment_external_id: payment_external_id,
                  payment_notes: payment_notes)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
# File 'lib/api_reference/models/apply_params.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['previously_collected_amount'] = 'previously_collected_amount'
  @_hash['mark_as_paid'] = 'mark_as_paid'
  @_hash['description'] = 'description'
  @_hash['payment_received_date'] = 'payment_received_date'
  @_hash['payment_external_id'] = 'payment_external_id'
  @_hash['payment_notes'] = 'payment_notes'
  @_hash
end

.nullablesObject

An array for nullable fields



69
70
71
72
73
74
75
76
77
78
# File 'lib/api_reference/models/apply_params.rb', line 69

def self.nullables
  %w[
    previously_collected_amount
    mark_as_paid
    description
    payment_received_date
    payment_external_id
    payment_notes
  ]
end

.optionalsObject

An array for optional fields



57
58
59
60
61
62
63
64
65
66
# File 'lib/api_reference/models/apply_params.rb', line 57

def self.optionals
  %w[
    previously_collected_amount
    mark_as_paid
    description
    payment_received_date
    payment_external_id
    payment_notes
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



128
129
130
131
132
133
134
# File 'lib/api_reference/models/apply_params.rb', line 128

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} previously_collected_amount: #{@previously_collected_amount.inspect},"\
  " mark_as_paid: #{@mark_as_paid.inspect}, description: #{@description.inspect},"\
  " payment_received_date: #{@payment_received_date.inspect}, payment_external_id:"\
  " #{@payment_external_id.inspect}, payment_notes: #{@payment_notes.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



119
120
121
122
123
124
125
# File 'lib/api_reference/models/apply_params.rb', line 119

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} previously_collected_amount: #{@previously_collected_amount}, mark_as_paid:"\
  " #{@mark_as_paid}, description: #{@description}, payment_received_date:"\
  " #{@payment_received_date}, payment_external_id: #{@payment_external_id}, payment_notes:"\
  " #{@payment_notes}>"
end