Class: AdvancedBilling::ProductPricePointErrors

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

Overview

ProductPricePointErrors 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(price_point: SKIP, interval: SKIP, interval_unit: SKIP, name: SKIP, price: SKIP, price_in_cents: SKIP, additional_properties: {}) ⇒ ProductPricePointErrors

Returns a new instance of ProductPricePointErrors.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/advanced_billing/models/product_price_point_errors.rb', line 65

def initialize(price_point: SKIP, interval: SKIP, interval_unit: SKIP,
               name: SKIP, price: SKIP, price_in_cents: SKIP,
               additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @price_point = price_point unless price_point == SKIP
  @interval = interval unless interval == SKIP
  @interval_unit = interval_unit unless interval_unit == SKIP
  @name = name unless name == SKIP
  @price = price unless price == SKIP
  @price_in_cents = price_in_cents unless price_in_cents == SKIP
end

Instance Attribute Details

#intervalArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def interval
  @interval
end

#interval_unitArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def interval_unit
  @interval_unit
end

#nameArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def name
  @name
end

#priceArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


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

def price
  @price
end

#price_in_centsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


34
35
36
# File 'lib/advanced_billing/models/product_price_point_errors.rb', line 34

def price_in_cents
  @price_in_cents
end

#price_pointString

TODO: Write general description for this method

Returns:

  • (String)


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

def price_point
  @price_point
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  price_point = hash.key?('price_point') ? hash['price_point'] : SKIP
  interval = hash.key?('interval') ? hash['interval'] : SKIP
  interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  price = hash.key?('price') ? hash['price'] : SKIP
  price_in_cents =
    hash.key?('price_in_cents') ? hash['price_in_cents'] : SKIP

  # Clean out expected properties from Hash.
  additional_properties = hash.reject { |k, _| names.value?(k) }

  # Create object from extracted values.
  ProductPricePointErrors.new(price_point: price_point,
                              interval: interval,
                              interval_unit: interval_unit,
                              name: name,
                              price: price,
                              price_in_cents: price_in_cents,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['price_point'] = 'price_point'
  @_hash['interval'] = 'interval'
  @_hash['interval_unit'] = 'interval_unit'
  @_hash['name'] = 'name'
  @_hash['price'] = 'price'
  @_hash['price_in_cents'] = 'price_in_cents'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/advanced_billing/models/product_price_point_errors.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
57
58
# File 'lib/advanced_billing/models/product_price_point_errors.rb', line 49

def self.optionals
  %w[
    price_point
    interval
    interval_unit
    name
    price
    price_in_cents
  ]
end