class Aptible::Billing::BillingDetail

Public Instance Methods

billing_contact() click to toggle source
# File lib/aptible/billing/billing_detail.rb, line 24
def billing_contact
  Aptible::Auth::User.find_by_url(
    links['billing_contact'].href,
    token: token,
    headers: headers
  )
rescue
  nil
end
can_manage_compliance?() click to toggle source
# File lib/aptible/billing/billing_detail.rb, line 39
def can_manage_compliance?
  %w(production pilot).include?(plan)
end
organization() click to toggle source
# File lib/aptible/billing/billing_detail.rb, line 14
def organization
  Aptible::Auth::Organization.find_by_url(
    links['organization'].href,
    token: token,
    headers: headers
  )
rescue
  nil
end
stripe_customer() click to toggle source
# File lib/aptible/billing/billing_detail.rb, line 34
def stripe_customer
  return nil if stripe_customer_id.nil?
  @stripe_customer ||= Stripe::Customer.retrieve(stripe_customer_id)
end
subscribed?() click to toggle source
# File lib/aptible/billing/billing_detail.rb, line 49
def subscribed?
  !!stripe_subscription_id
end
subscription() click to toggle source
# File lib/aptible/billing/billing_detail.rb, line 43
def subscription
  return nil if stripe_subscription_id.nil?
  subscriptions = stripe_customer.subscriptions
  @subscription ||= subscriptions.retrieve(stripe_subscription_id)
end