Class: ApiReference::UpdateInvoiceRequestParams

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

Overview

UpdateInvoiceRequestParams 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(metadata: SKIP, net_terms: SKIP, due_date: SKIP, invoice_date: SKIP, auto_collection: SKIP) ⇒ UpdateInvoiceRequestParams

Returns a new instance of UpdateInvoiceRequestParams.



75
76
77
78
79
80
81
82
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 75

def initialize(metadata: SKIP, net_terms: SKIP, due_date: SKIP,
               invoice_date: SKIP, auto_collection: SKIP)
  @metadata =  unless  == SKIP
  @net_terms = net_terms unless net_terms == SKIP
  @due_date = due_date unless due_date == SKIP
  @invoice_date = invoice_date unless invoice_date == SKIP
  @auto_collection = auto_collection unless auto_collection == SKIP
end

Instance Attribute Details

#auto_collectionTrueClass | FalseClass

Determines whether this invoice will automatically attempt to charge a saved payment method, if any. Can only be modified on draft invoices. If not specified, the invoice's existing setting is unchanged.

Returns:

  • (TrueClass | FalseClass)


40
41
42
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 40

def auto_collection
  @auto_collection
end

#due_dateObject

An optional custom due date for the invoice. If not set, the due date will be calculated based on the net_terms value.

Returns:

  • (Object)


30
31
32
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 30

def due_date
  @due_date
end

#invoice_dateObject

The date of the invoice. Can only be modified for one-off draft invoices.

Returns:

  • (Object)


34
35
36
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 34

def invoice_date
  @invoice_date
end

#metadataHash[String, String]

User-specified key/value pairs for the resource. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Returns:

  • (Hash[String, String])


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

def 
  @metadata
end

#net_termsInteger

The net terms determines the due date of the invoice. Due date is calculated based on the invoice or issuance date, depending on the account's configured due date calculation method. A value of '0' here represents that the invoice is due on issue, whereas a value of '30' represents that the customer has 30 days to pay the invoice. Do not set this field if you want to set a custom due date.

Returns:

  • (Integer)


25
26
27
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 25

def net_terms
  @net_terms
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('metadata') ? hash['metadata'] : SKIP
  net_terms = hash.key?('net_terms') ? hash['net_terms'] : SKIP
  due_date = hash.key?('due_date') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:UpdateInvoiceRequestParamsDueDate), hash['due_date']
  ) : SKIP
  invoice_date = hash.key?('invoice_date') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:UpdateInvoiceRequestParamsInvoiceDate), hash['invoice_date']
  ) : SKIP
  auto_collection =
    hash.key?('auto_collection') ? hash['auto_collection'] : SKIP

  # Create object from extracted values.
  UpdateInvoiceRequestParams.new(metadata: ,
                                 net_terms: net_terms,
                                 due_date: due_date,
                                 invoice_date: invoice_date,
                                 auto_collection: auto_collection)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['metadata'] = 'metadata'
  @_hash['net_terms'] = 'net_terms'
  @_hash['due_date'] = 'due_date'
  @_hash['invoice_date'] = 'invoice_date'
  @_hash['auto_collection'] = 'auto_collection'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
68
69
70
71
72
73
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 65

def self.nullables
  %w[
    metadata
    net_terms
    due_date
    invoice_date
    auto_collection
  ]
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 54

def self.optionals
  %w[
    metadata
    net_terms
    due_date
    invoice_date
    auto_collection
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



122
123
124
125
126
127
128
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 122

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

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



138
139
140
141
142
143
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 138

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} metadata: #{@metadata.inspect}, net_terms: #{@net_terms.inspect}, due_date:"\
  " #{@due_date.inspect}, invoice_date: #{@invoice_date.inspect}, auto_collection:"\
  " #{@auto_collection.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



131
132
133
134
135
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 131

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} metadata: #{@metadata}, net_terms: #{@net_terms}, due_date: #{@due_date},"\
  " invoice_date: #{@invoice_date}, auto_collection: #{@auto_collection}>"
end

#to_union_type_due_dateObject



108
109
110
111
112
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 108

def to_union_type_due_date
  UnionTypeLookUp.get(:UpdateInvoiceRequestParamsDueDate)
                 .validate(due_date)
                 .serialize(due_date)
end

#to_union_type_invoice_dateObject



114
115
116
117
118
# File 'lib/api_reference/models/update_invoice_request_params.rb', line 114

def to_union_type_invoice_date
  UnionTypeLookUp.get(:UpdateInvoiceRequestParamsInvoiceDate)
                 .validate(invoice_date)
                 .serialize(invoice_date)
end