Class: AdvancedBilling::BulkUpdateSegmentsItem
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::BulkUpdateSegmentsItem
- Defined in:
- lib/advanced_billing/models/bulk_update_segments_item.rb
Overview
BulkUpdateSegmentsItem Model.
Instance Attribute Summary collapse
-
#id ⇒ Integer
The ID of the segment you want to update.
-
#prices ⇒ Array[CreateOrUpdateSegmentPrice]
The handle for the pricing scheme.
-
#pricing_scheme ⇒ String
The handle for the pricing scheme.
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.
Instance Method Summary collapse
-
#initialize(id = nil, pricing_scheme = nil, prices = nil) ⇒ BulkUpdateSegmentsItem
constructor
A new instance of BulkUpdateSegmentsItem.
Methods inherited from BaseModel
Constructor Details
#initialize(id = nil, pricing_scheme = nil, prices = nil) ⇒ BulkUpdateSegmentsItem
Returns a new instance of BulkUpdateSegmentsItem.
49 50 51 52 53 |
# File 'lib/advanced_billing/models/bulk_update_segments_item.rb', line 49 def initialize(id = nil, pricing_scheme = nil, prices = nil) @id = id @pricing_scheme = pricing_scheme @prices = prices end |
Instance Attribute Details
#id ⇒ Integer
The ID of the segment you want to update.
14 15 16 |
# File 'lib/advanced_billing/models/bulk_update_segments_item.rb', line 14 def id @id end |
#prices ⇒ Array[CreateOrUpdateSegmentPrice]
The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. See [Price Bracket Rules](help.chargify.com/products/product-components.html#price-br acket-rules) for an overview of pricing schemes.
28 29 30 |
# File 'lib/advanced_billing/models/bulk_update_segments_item.rb', line 28 def prices @prices end |
#pricing_scheme ⇒ String
The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. See [Price Bracket Rules](help.chargify.com/products/product-components.html#price-br acket-rules) for an overview of pricing schemes.
21 22 23 |
# File 'lib/advanced_billing/models/bulk_update_segments_item.rb', line 21 def pricing_scheme @pricing_scheme end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/advanced_billing/models/bulk_update_segments_item.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil pricing_scheme = hash.key?('pricing_scheme') ? hash['pricing_scheme'] : nil # Parameter is an array, so we need to iterate through it prices = nil unless hash['prices'].nil? prices = [] hash['prices'].each do |structure| prices << (CreateOrUpdateSegmentPrice.from_hash(structure) if structure) end end prices = nil unless hash.key?('prices') # Create object from extracted values. BulkUpdateSegmentsItem.new(id, pricing_scheme, prices) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 |
# File 'lib/advanced_billing/models/bulk_update_segments_item.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['pricing_scheme'] = 'pricing_scheme' @_hash['prices'] = 'prices' @_hash end |
.nullables ⇒ Object
An array for nullable fields
45 46 47 |
# File 'lib/advanced_billing/models/bulk_update_segments_item.rb', line 45 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 |
# File 'lib/advanced_billing/models/bulk_update_segments_item.rb', line 40 def self.optionals [] end |