Class: AdvancedBilling::ComponentPricePoint
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::ComponentPricePoint
- Defined in:
- lib/advanced_billing/models/component_price_point.rb
Overview
ComponentPricePoint Model.
Instance Attribute Summary collapse
-
#archived_at ⇒ String
Note: Refer to type attribute instead.
-
#component_id ⇒ Integer
Note: Refer to type attribute instead.
-
#created_at ⇒ String
Note: Refer to type attribute instead.
-
#default ⇒ TrueClass | FalseClass
Note: Refer to type attribute instead.
-
#handle ⇒ String
Note: Refer to type attribute instead.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#name ⇒ String
Note: Refer to type attribute instead.
-
#prices ⇒ Array[ComponentPricePointPrice]
Note: Refer to type attribute instead.
-
#pricing_scheme ⇒ String
Note: Refer to type attribute instead.
-
#subscription_id ⇒ Integer
(only used for Custom Pricing - ie. when the price point’s type is ‘custom`) The id of the subscription that the custom price point is for.
-
#tax_included ⇒ TrueClass | FalseClass
(only used for Custom Pricing - ie. when the price point’s type is ‘custom`) The id of the subscription that the custom price point is for.
-
#type ⇒ PricePointType
Price point type.
-
#updated_at ⇒ String
Note: Refer to type attribute instead.
-
#use_site_exchange_rate ⇒ TrueClass | FalseClass
Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site.
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 = SKIP, type = SKIP, default = SKIP, name = SKIP, pricing_scheme = SKIP, component_id = SKIP, handle = SKIP, archived_at = SKIP, created_at = SKIP, updated_at = SKIP, prices = SKIP, use_site_exchange_rate = true, subscription_id = SKIP, tax_included = SKIP) ⇒ ComponentPricePoint
constructor
A new instance of ComponentPricePoint.
Methods inherited from BaseModel
Constructor Details
#initialize(id = SKIP, type = SKIP, default = SKIP, name = SKIP, pricing_scheme = SKIP, component_id = SKIP, handle = SKIP, archived_at = SKIP, created_at = SKIP, updated_at = SKIP, prices = SKIP, use_site_exchange_rate = true, subscription_id = SKIP, tax_included = SKIP) ⇒ ComponentPricePoint
Returns a new instance of ComponentPricePoint.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 123 def initialize(id = SKIP, type = SKIP, default = SKIP, name = SKIP, pricing_scheme = SKIP, component_id = SKIP, handle = SKIP, archived_at = SKIP, created_at = SKIP, updated_at = SKIP, prices = SKIP, use_site_exchange_rate = true, subscription_id = SKIP, tax_included = SKIP) @id = id unless id == SKIP @type = type unless type == SKIP @default = default unless default == SKIP @name = name unless name == SKIP @pricing_scheme = pricing_scheme unless pricing_scheme == SKIP @component_id = component_id unless component_id == SKIP @handle = handle unless handle == SKIP @archived_at = archived_at unless archived_at == SKIP @created_at = created_at unless created_at == SKIP @updated_at = updated_at unless updated_at == SKIP @prices = prices unless prices == SKIP @use_site_exchange_rate = use_site_exchange_rate unless use_site_exchange_rate == SKIP @subscription_id = subscription_id unless subscription_id == SKIP @tax_included = tax_included unless tax_included == SKIP end |
Instance Attribute Details
#archived_at ⇒ String
Note: Refer to type attribute instead
47 48 49 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 47 def archived_at @archived_at end |
#component_id ⇒ Integer
Note: Refer to type attribute instead
39 40 41 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 39 def component_id @component_id end |
#created_at ⇒ String
Note: Refer to type attribute instead
51 52 53 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 51 def created_at @created_at end |
#default ⇒ TrueClass | FalseClass
Note: Refer to type attribute instead
27 28 29 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 27 def default @default end |
#handle ⇒ String
Note: Refer to type attribute instead
43 44 45 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 43 def handle @handle end |
#id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 14 def id @id end |
#name ⇒ String
Note: Refer to type attribute instead
31 32 33 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 31 def name @name end |
#prices ⇒ Array[ComponentPricePointPrice]
Note: Refer to type attribute instead
59 60 61 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 59 def prices @prices end |
#pricing_scheme ⇒ String
Note: Refer to type attribute instead
35 36 37 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 35 def pricing_scheme @pricing_scheme end |
#subscription_id ⇒ Integer
(only used for Custom Pricing - ie. when the price point’s type is ‘custom`) The id of the subscription that the custom price point is for.
69 70 71 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 69 def subscription_id @subscription_id end |
#tax_included ⇒ TrueClass | FalseClass
(only used for Custom Pricing - ie. when the price point’s type is ‘custom`) The id of the subscription that the custom price point is for.
74 75 76 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 74 def tax_included @tax_included end |
#type ⇒ PricePointType
Price point type. We expose the following types:
-
default: a price point that is marked as a default price for a
certain product.
-
custom: a custom price point.
-
catalog: a price point that is not marked as a default price
for a certain product and is not a custom one.
23 24 25 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 23 def type @type end |
#updated_at ⇒ String
Note: Refer to type attribute instead
55 56 57 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 55 def updated_at @updated_at end |
#use_site_exchange_rate ⇒ TrueClass | FalseClass
Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site.
64 65 66 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 64 def use_site_exchange_rate @use_site_exchange_rate end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 145 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP type = hash.key?('type') ? hash['type'] : SKIP default = hash.key?('default') ? hash['default'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP pricing_scheme = hash.key?('pricing_scheme') ? hash['pricing_scheme'] : SKIP component_id = hash.key?('component_id') ? hash['component_id'] : SKIP handle = hash.key?('handle') ? hash['handle'] : SKIP archived_at = hash.key?('archived_at') ? hash['archived_at'] : SKIP created_at = hash.key?('created_at') ? hash['created_at'] : SKIP updated_at = hash.key?('updated_at') ? hash['updated_at'] : 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 << (ComponentPricePointPrice.from_hash(structure) if structure) end end prices = SKIP unless hash.key?('prices') use_site_exchange_rate = hash['use_site_exchange_rate'] ||= true subscription_id = hash.key?('subscription_id') ? hash['subscription_id'] : SKIP tax_included = hash.key?('tax_included') ? hash['tax_included'] : SKIP # Create object from extracted values. ComponentPricePoint.new(id, type, default, name, pricing_scheme, component_id, handle, archived_at, created_at, updated_at, prices, use_site_exchange_rate, subscription_id, tax_included) end |
.names ⇒ Object
A mapping from model property names to API property names.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 77 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['type'] = 'type' @_hash['default'] = 'default' @_hash['name'] = 'name' @_hash['pricing_scheme'] = 'pricing_scheme' @_hash['component_id'] = 'component_id' @_hash['handle'] = 'handle' @_hash['archived_at'] = 'archived_at' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash['prices'] = 'prices' @_hash['use_site_exchange_rate'] = 'use_site_exchange_rate' @_hash['subscription_id'] = 'subscription_id' @_hash['tax_included'] = 'tax_included' @_hash end |
.nullables ⇒ Object
An array for nullable fields
117 118 119 120 121 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 117 def self.nullables %w[ archived_at ] end |
.optionals ⇒ Object
An array for optional fields
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/advanced_billing/models/component_price_point.rb', line 97 def self.optionals %w[ id type default name pricing_scheme component_id handle archived_at created_at updated_at prices use_site_exchange_rate subscription_id tax_included ] end |