Class: Webhookdb::Subscription::Plan
- Inherits:
-
Object
- Object
- Webhookdb::Subscription::Plan
- Defined in:
- lib/webhookdb/subscription.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#key ⇒ Object
Returns the value of attribute key.
-
#price ⇒ Object
Returns the value of attribute price.
-
#stripe_price_id ⇒ Object
Returns the value of attribute stripe_price_id.
-
#stripe_product_id ⇒ Object
Returns the value of attribute stripe_product_id.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(key, stripe_price) ⇒ Plan
constructor
A new instance of Plan.
Constructor Details
#initialize(key, stripe_price) ⇒ Plan
Returns a new instance of Plan.
11 12 13 14 15 16 17 |
# File 'lib/webhookdb/subscription.rb', line 11 def initialize(key, stripe_price) @key = key @description = stripe_price.nickname @price = Money.new(stripe_price.unit_amount) @stripe_price_id = stripe_price.id @stripe_product_id = stripe_price.product end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
9 10 11 |
# File 'lib/webhookdb/subscription.rb', line 9 def description @description end |
#key ⇒ Object
Returns the value of attribute key.
9 10 11 |
# File 'lib/webhookdb/subscription.rb', line 9 def key @key end |
#price ⇒ Object
Returns the value of attribute price.
9 10 11 |
# File 'lib/webhookdb/subscription.rb', line 9 def price @price end |
#stripe_price_id ⇒ Object
Returns the value of attribute stripe_price_id.
9 10 11 |
# File 'lib/webhookdb/subscription.rb', line 9 def stripe_price_id @stripe_price_id end |
#stripe_product_id ⇒ Object
Returns the value of attribute stripe_product_id.
9 10 11 |
# File 'lib/webhookdb/subscription.rb', line 9 def stripe_product_id @stripe_product_id end |
Instance Method Details
#as_json ⇒ Object
19 20 21 |
# File 'lib/webhookdb/subscription.rb', line 19 def as_json return {key:, description:, price:} end |