Class: AdvancedBilling::UpdatePrice

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

Overview

UpdatePrice 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, ending_quantity = SKIP, unit_price = SKIP, destroy = SKIP, starting_quantity = SKIP) ⇒ UpdatePrice

Returns a new instance of UpdatePrice.



59
60
61
62
63
64
65
66
# File 'lib/advanced_billing/models/update_price.rb', line 59

def initialize(id = SKIP, ending_quantity = SKIP, unit_price = SKIP,
               destroy = SKIP, starting_quantity = SKIP)
  @id = id unless id == SKIP
  @ending_quantity = ending_quantity unless ending_quantity == SKIP
  @unit_price = unit_price unless unit_price == SKIP
  @destroy = destroy unless destroy == SKIP
  @starting_quantity = starting_quantity unless starting_quantity == SKIP
end

Instance Attribute Details

#destroyString

TODO: Write general description for this method

Returns:

  • (String)


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

def destroy
  @destroy
end

#ending_quantityInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def ending_quantity
  @ending_quantity
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def id
  @id
end

#starting_quantityInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def starting_quantity
  @starting_quantity
end

#unit_priceInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def unit_price
  @unit_price
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  ending_quantity =
    hash.key?('ending_quantity') ? hash['ending_quantity'] : SKIP
  unit_price = hash.key?('unit_price') ? hash['unit_price'] : SKIP
  destroy = hash.key?('_destroy') ? hash['_destroy'] : SKIP
  starting_quantity =
    hash.key?('starting_quantity') ? hash['starting_quantity'] : SKIP

  # Create object from extracted values.
  UpdatePrice.new(id,
                  ending_quantity,
                  unit_price,
                  destroy,
                  starting_quantity)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['ending_quantity'] = 'ending_quantity'
  @_hash['unit_price'] = 'unit_price'
  @_hash['destroy'] = '_destroy'
  @_hash['starting_quantity'] = 'starting_quantity'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/advanced_billing/models/update_price.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/advanced_billing/models/update_price.rb', line 44

def self.optionals
  %w[
    id
    ending_quantity
    unit_price
    destroy
    starting_quantity
  ]
end