Class: AdvancedBilling::UpsertPrepaidConfiguration

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

Overview

UpsertPrepaidConfiguration Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(initial_funding_amount_in_cents: SKIP, replenish_to_amount_in_cents: SKIP, auto_replenish: SKIP, replenish_threshold_amount_in_cents: SKIP, additional_properties: {}) ⇒ UpsertPrepaidConfiguration

Returns a new instance of UpsertPrepaidConfiguration.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/advanced_billing/models/upsert_prepaid_configuration.rb', line 55

def initialize(initial_funding_amount_in_cents: SKIP,
               replenish_to_amount_in_cents: SKIP, auto_replenish: SKIP,
               replenish_threshold_amount_in_cents: SKIP,
               additional_properties: {})
  unless initial_funding_amount_in_cents == SKIP
    @initial_funding_amount_in_cents =
      initial_funding_amount_in_cents
  end
  unless replenish_to_amount_in_cents == SKIP
    @replenish_to_amount_in_cents =
      replenish_to_amount_in_cents
  end
  @auto_replenish = auto_replenish unless auto_replenish == SKIP
  unless replenish_threshold_amount_in_cents == SKIP
    @replenish_threshold_amount_in_cents =
      replenish_threshold_amount_in_cents
  end

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

Instance Attribute Details

#auto_replenishTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def auto_replenish
  @auto_replenish
end

#initial_funding_amount_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def initial_funding_amount_in_cents
  @initial_funding_amount_in_cents
end

#replenish_threshold_amount_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def replenish_threshold_amount_in_cents
  @replenish_threshold_amount_in_cents
end

#replenish_to_amount_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def replenish_to_amount_in_cents
  @replenish_to_amount_in_cents
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/advanced_billing/models/upsert_prepaid_configuration.rb', line 80

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  initial_funding_amount_in_cents =
    hash.key?('initial_funding_amount_in_cents') ? hash['initial_funding_amount_in_cents'] : SKIP
  replenish_to_amount_in_cents =
    hash.key?('replenish_to_amount_in_cents') ? hash['replenish_to_amount_in_cents'] : SKIP
  auto_replenish =
    hash.key?('auto_replenish') ? hash['auto_replenish'] : SKIP
  replenish_threshold_amount_in_cents =
    hash.key?('replenish_threshold_amount_in_cents') ? hash['replenish_threshold_amount_in_cents'] : SKIP

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

  # Create object from extracted values.
  UpsertPrepaidConfiguration.new(initial_funding_amount_in_cents: initial_funding_amount_in_cents,
                                 replenish_to_amount_in_cents: replenish_to_amount_in_cents,
                                 auto_replenish: auto_replenish,
                                 replenish_threshold_amount_in_cents: replenish_threshold_amount_in_cents,
                                 additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
37
38
# File 'lib/advanced_billing/models/upsert_prepaid_configuration.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['initial_funding_amount_in_cents'] =
    'initial_funding_amount_in_cents'
  @_hash['replenish_to_amount_in_cents'] = 'replenish_to_amount_in_cents'
  @_hash['auto_replenish'] = 'auto_replenish'
  @_hash['replenish_threshold_amount_in_cents'] =
    'replenish_threshold_amount_in_cents'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/advanced_billing/models/upsert_prepaid_configuration.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
44
45
46
47
48
# File 'lib/advanced_billing/models/upsert_prepaid_configuration.rb', line 41

def self.optionals
  %w[
    initial_funding_amount_in_cents
    replenish_to_amount_in_cents
    auto_replenish
    replenish_threshold_amount_in_cents
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



106
107
108
109
110
111
112
# File 'lib/advanced_billing/models/upsert_prepaid_configuration.rb', line 106

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

  return false unless value.instance_of? Hash

  true
end