Class: AdvancedBilling::PrepaidComponentPricePoint
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::PrepaidComponentPricePoint
- Defined in:
- lib/advanced_billing/models/prepaid_component_price_point.rb
Overview
PrepaidComponentPricePoint Model.
Instance Attribute Summary collapse
-
#handle ⇒ String
TODO: Write general description for this method.
-
#name ⇒ String
TODO: Write general description for this method.
-
#overage_pricing ⇒ OveragePricing
TODO: Write general description for this method.
-
#prices ⇒ Array[Price]
TODO: Write general description for this method.
-
#pricing_scheme ⇒ String
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(name = SKIP, handle = SKIP, pricing_scheme = SKIP, prices = SKIP, overage_pricing = SKIP) ⇒ PrepaidComponentPricePoint
constructor
A new instance of PrepaidComponentPricePoint.
Methods inherited from BaseModel
Constructor Details
#initialize(name = SKIP, handle = SKIP, pricing_scheme = SKIP, prices = SKIP, overage_pricing = SKIP) ⇒ PrepaidComponentPricePoint
Returns a new instance of PrepaidComponentPricePoint.
59 60 61 62 63 64 65 66 |
# File 'lib/advanced_billing/models/prepaid_component_price_point.rb', line 59 def initialize(name = SKIP, handle = SKIP, pricing_scheme = SKIP, prices = SKIP, overage_pricing = SKIP) @name = name unless name == SKIP @handle = handle unless handle == SKIP @pricing_scheme = pricing_scheme unless pricing_scheme == SKIP @prices = prices unless prices == SKIP @overage_pricing = overage_pricing unless overage_pricing == SKIP end |
Instance Attribute Details
#handle ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/prepaid_component_price_point.rb', line 18 def handle @handle end |
#name ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/prepaid_component_price_point.rb', line 14 def name @name end |
#overage_pricing ⇒ OveragePricing
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/prepaid_component_price_point.rb', line 30 def overage_pricing @overage_pricing end |
#prices ⇒ Array[Price]
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/prepaid_component_price_point.rb', line 26 def prices @prices end |
#pricing_scheme ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/prepaid_component_price_point.rb', line 22 def pricing_scheme @pricing_scheme 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 88 89 90 91 92 93 94 95 96 |
# File 'lib/advanced_billing/models/prepaid_component_price_point.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : SKIP handle = hash.key?('handle') ? hash['handle'] : SKIP pricing_scheme = hash.key?('pricing_scheme') ? hash['pricing_scheme'] : SKIP # Parameter is an array, so we need to iterate through it prices = nil unless hash['prices'].nil? prices = [] hash['prices'].each do |structure| prices << (Price.from_hash(structure) if structure) end end prices = SKIP unless hash.key?('prices') overage_pricing = OveragePricing.from_hash(hash['overage_pricing']) if hash['overage_pricing'] # Create object from extracted values. PrepaidComponentPricePoint.new(name, handle, pricing_scheme, prices, overage_pricing) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/advanced_billing/models/prepaid_component_price_point.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['handle'] = 'handle' @_hash['pricing_scheme'] = 'pricing_scheme' @_hash['prices'] = 'prices' @_hash['overage_pricing'] = 'overage_pricing' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/advanced_billing/models/prepaid_component_price_point.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/advanced_billing/models/prepaid_component_price_point.rb', line 44 def self.optionals %w[ name handle pricing_scheme prices overage_pricing ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
100 101 102 103 104 105 106 |
# File 'lib/advanced_billing/models/prepaid_component_price_point.rb', line 100 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |