Class: FloopFloop::Subscriptions
- Inherits:
-
Object
- Object
- FloopFloop::Subscriptions
- Defined in:
- lib/floopfloop/subscriptions.rb
Overview
Plan + credit-balance snapshot for the authenticated user.
Distinct from Usage — ‘usage.summary` returns current-period consumption (credits remaining + builds used + storage), while `subscriptions.current` returns the plan tier itself (price, billing period, cancel state). They overlap on `monthlyCredits` and `maxProjects` but serve different audiences: `usage.summary` for “am I about to hit my limits?”, `subscriptions.current` for “what plan am I on, and when does it renew?”.
Instance Method Summary collapse
-
#current ⇒ Object
Returns the full ‘=> {… | nil, “credits” => … | nil}` hash.
-
#initialize(client) ⇒ Subscriptions
constructor
A new instance of Subscriptions.
Constructor Details
#initialize(client) ⇒ Subscriptions
Returns a new instance of Subscriptions.
15 16 17 |
# File 'lib/floopfloop/subscriptions.rb', line 15 def initialize(client) @client = client end |
Instance Method Details
#current ⇒ Object
Returns the full ‘=> {… | nil, “credits” => … | nil}` hash. Not wrapped in a struct — stays forward-compatible if the backend adds fields. Both keys are independently nullable: a user may exist without a subscription (mid-signup, cancelled with no grace credits).
25 26 27 |
# File 'lib/floopfloop/subscriptions.rb', line 25 def current @client.request("GET", "/api/v1/subscriptions/current") end |