Created
May 15, 2015 01:27
-
-
Save brandonhilkert/330ed9ea6e6ee3416696 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Subscription | |
def initialize(stripe_id) | |
@stripe_id = stripe_id | |
end | |
def name | |
subscription.plan.name | |
end | |
def amount | |
subscription.plan.amount / 100 | |
end | |
private | |
attr_reader :stripe_id | |
def subscription | |
@subscription ||= customer.subscriptions.data.first | |
end | |
def customer | |
@customer ||= Stripe::Customer.retrieve(stripe_id) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment