Class: ApiReference::UpdateSubscriptionParams

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

Overview

UpdateSubscriptionParams 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, default_invoice_memo: SKIP, auto_collection: SKIP, auto_issuance: SKIP, net_terms: SKIP, invoicing_threshold: SKIP) ⇒ UpdateSubscriptionParams

Returns a new instance of UpdateSubscriptionParams.



85
86
87
88
89
90
91
92
93
94
# File 'lib/api_reference/models/update_subscription_params.rb', line 85

def initialize(metadata: SKIP, default_invoice_memo: SKIP,
               auto_collection: SKIP, auto_issuance: SKIP, net_terms: SKIP,
               invoicing_threshold: SKIP)
  @metadata =  unless  == SKIP
  @default_invoice_memo = default_invoice_memo unless default_invoice_memo == SKIP
  @auto_collection = auto_collection unless auto_collection == SKIP
  @auto_issuance = auto_issuance unless auto_issuance == SKIP
  @net_terms = net_terms unless net_terms == SKIP
  @invoicing_threshold = invoicing_threshold unless invoicing_threshold == SKIP
end

Instance Attribute Details

#auto_collectionTrueClass | FalseClass

Determines whether issued invoices for this subscription will automatically be charged with the saved payment method on the due date. This property defaults to the plan's behavior.

Returns:

  • (TrueClass | FalseClass)


27
28
29
# File 'lib/api_reference/models/update_subscription_params.rb', line 27

def auto_collection
  @auto_collection
end

#auto_issuanceTrueClass | FalseClass

Used to determine if invoices for this subscription will be automatically issued. If true, invoices will be automatically issued. If false, invoices will require manual approval. If null is specified, this defaults to the behavior configured for this customer.

Returns:

  • (TrueClass | FalseClass)


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

def auto_issuance
  @auto_issuance
end

#default_invoice_memoString

Determines the default memo on this subscription's invoices. Note that if this is not provided, it is determined by the plan configuration.

Returns:

  • (String)


21
22
23
# File 'lib/api_reference/models/update_subscription_params.rb', line 21

def default_invoice_memo
  @default_invoice_memo
end

#invoicing_thresholdString

When this subscription's accrued usage reaches this threshold, an invoice will be issued for the subscription. If not specified, invoices will only be issued at the end of the billing period.

Returns:

  • (String)


47
48
49
# File 'lib/api_reference/models/update_subscription_params.rb', line 47

def invoicing_threshold
  @invoicing_threshold
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_subscription_params.rb', line 16

def 
  @metadata
end

#net_termsInteger

Determines the difference between the invoice issue date for subscription invoices as the date that they are due. A value of 0 here represents that the invoice is due on issue, whereas a value of 30 represents that the customer has a month to pay the invoice.

Returns:

  • (Integer)


41
42
43
# File 'lib/api_reference/models/update_subscription_params.rb', line 41

def net_terms
  @net_terms
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('metadata') ? hash['metadata'] : SKIP
  default_invoice_memo =
    hash.key?('default_invoice_memo') ? hash['default_invoice_memo'] : SKIP
  auto_collection =
    hash.key?('auto_collection') ? hash['auto_collection'] : SKIP
  auto_issuance = hash.key?('auto_issuance') ? hash['auto_issuance'] : SKIP
  net_terms = hash.key?('net_terms') ? hash['net_terms'] : SKIP
  invoicing_threshold =
    hash.key?('invoicing_threshold') ? hash['invoicing_threshold'] : SKIP

  # Create object from extracted values.
  UpdateSubscriptionParams.new(metadata: ,
                               default_invoice_memo: default_invoice_memo,
                               auto_collection: auto_collection,
                               auto_issuance: auto_issuance,
                               net_terms: net_terms,
                               invoicing_threshold: invoicing_threshold)
end

.namesObject

A mapping from model property names to API property names.



50
51
52
53
54
55
56
57
58
59
# File 'lib/api_reference/models/update_subscription_params.rb', line 50

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['metadata'] = 'metadata'
  @_hash['default_invoice_memo'] = 'default_invoice_memo'
  @_hash['auto_collection'] = 'auto_collection'
  @_hash['auto_issuance'] = 'auto_issuance'
  @_hash['net_terms'] = 'net_terms'
  @_hash['invoicing_threshold'] = 'invoicing_threshold'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    metadata
    default_invoice_memo
    auto_collection
    auto_issuance
    net_terms
    invoicing_threshold
  ]
end

.optionalsObject

An array for optional fields



62
63
64
65
66
67
68
69
70
71
# File 'lib/api_reference/models/update_subscription_params.rb', line 62

def self.optionals
  %w[
    metadata
    default_invoice_memo
    auto_collection
    auto_issuance
    net_terms
    invoicing_threshold
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



121
122
123
124
125
126
# File 'lib/api_reference/models/update_subscription_params.rb', line 121

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