Class: AdvancedBilling::PrepaidConfiguration

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

Overview

PrepaidConfiguration Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

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

Returns a new instance of PrepaidConfiguration.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/advanced_billing/models/prepaid_configuration.rb', line 61

def initialize(id: SKIP, initial_funding_amount_in_cents: SKIP,
               replenish_to_amount_in_cents: SKIP, auto_replenish: SKIP,
               replenish_threshold_amount_in_cents: SKIP,
               additional_properties: {})
  @id = id unless id == SKIP
  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)


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

def auto_replenish
  @auto_replenish
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#initial_funding_amount_in_centsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

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)


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

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)


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

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.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/advanced_billing/models/prepaid_configuration.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  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.
  PrepaidConfiguration.new(id: id,
                           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.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_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



57
58
59
# File 'lib/advanced_billing/models/prepaid_configuration.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
53
54
# File 'lib/advanced_billing/models/prepaid_configuration.rb', line 46

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