Class: AdvancedBilling::MRRMovement

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

Overview

MRRMovement Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(amount: SKIP, category: SKIP, subscriber_delta: SKIP, lead_delta: SKIP, additional_properties: {}) ⇒ MRRMovement

Returns a new instance of MRRMovement.



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/advanced_billing/models/mrr_movement.rb', line 53

def initialize(amount: SKIP, category: SKIP, subscriber_delta: SKIP,
               lead_delta: SKIP, additional_properties: {})
  @amount = amount unless amount == SKIP
  @category = category unless category == SKIP
  @subscriber_delta = subscriber_delta unless subscriber_delta == SKIP
  @lead_delta = lead_delta unless lead_delta == SKIP

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

Instance Attribute Details

#amountInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def amount
  @amount
end

#categoryString

TODO: Write general description for this method

Returns:

  • (String)


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

def category
  @category
end

#lead_deltaInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def lead_delta
  @lead_delta
end

#subscriber_deltaInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def subscriber_delta
  @subscriber_delta
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/advanced_billing/models/mrr_movement.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  category = hash.key?('category') ? hash['category'] : SKIP
  subscriber_delta =
    hash.key?('subscriber_delta') ? hash['subscriber_delta'] : SKIP
  lead_delta = hash.key?('lead_delta') ? hash['lead_delta'] : SKIP

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

  # Create object from extracted values.
  MRRMovement.new(amount: amount,
                  category: category,
                  subscriber_delta: subscriber_delta,
                  lead_delta: lead_delta,
                  additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount'] = 'amount'
  @_hash['category'] = 'category'
  @_hash['subscriber_delta'] = 'subscriber_delta'
  @_hash['lead_delta'] = 'lead_delta'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/advanced_billing/models/mrr_movement.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/advanced_billing/models/mrr_movement.rb', line 39

def self.optionals
  %w[
    amount
    category
    subscriber_delta
    lead_delta
  ]
end