lib/aptible/billing/billing_detail.rb in aptible-billing-0.1.1 vs lib/aptible/billing/billing_detail.rb in aptible-billing-0.1.2

- old
+ new

@@ -8,11 +8,27 @@ field :updated_at, type: Time field :stripe_customer_id field :stripe_subscription_id field :stripe_subscription_status field :plan - field :billing_contact - field :organization + + def organization + Aptible::Auth::Organization.find_by_url( + links['organization'].href, + token: token, + headers: headers) + rescue + nil + end + + def billing_contact + Aptible::Auth::User.find_by_url( + links['billing_contact'].href, + token: token, + headers: headers) + rescue + nil + end def stripe_customer return nil if stripe_customer_id.nil? @stripe_customer ||= Stripe::Customer.retrieve(stripe_customer_id) end