class WarpEngine::Access
What a client is told about one title, as returned by the access policy’s access_for and rendered as the access block of every catalog entry.
Constants
- OPEN
-
The answer for an ungated, free title.
Attributes
- gated
-
truewhen the title needs an entitlement - entitled
-
whether this caller holds it, or
nilwhen unknown price_cents-
the price in cents, or
nil - currency
-
the price currency, e.g.
"EUR" purchase_url-
where the title can be bought
web_url-
where it can be played in a browser;
nilkeeps the engine’s own path
- gated
-
truewhen the title needs an entitlement - entitled
-
whether this caller holds it, or
nilwhen unknown price_cents-
the price in cents, or
nil - currency
-
the price currency, e.g.
"EUR" purchase_url-
where the title can be bought
web_url-
where it can be played in a browser;
nilkeeps the engine’s own path
- gated
-
truewhen the title needs an entitlement - entitled
-
whether this caller holds it, or
nilwhen unknown price_cents-
the price in cents, or
nil - currency
-
the price currency, e.g.
"EUR" purchase_url-
where the title can be bought
web_url-
where it can be played in a browser;
nilkeeps the engine’s own path
- gated
-
truewhen the title needs an entitlement - entitled
-
whether this caller holds it, or
nilwhen unknown price_cents-
the price in cents, or
nil - currency
-
the price currency, e.g.
"EUR" purchase_url-
where the title can be bought
web_url-
where it can be played in a browser;
nilkeeps the engine’s own path
- gated
-
truewhen the title needs an entitlement - entitled
-
whether this caller holds it, or
nilwhen unknown price_cents-
the price in cents, or
nil - currency
-
the price currency, e.g.
"EUR" purchase_url-
where the title can be bought
web_url-
where it can be played in a browser;
nilkeeps the engine’s own path
- gated
-
truewhen the title needs an entitlement - entitled
-
whether this caller holds it, or
nilwhen unknown price_cents-
the price in cents, or
nil - currency
-
the price currency, e.g.
"EUR" purchase_url-
where the title can be bought
web_url-
where it can be played in a browser;
nilkeeps the engine’s own path
Public Class Methods
Source
# File lib/warp_engine/access.rb, line 68 def initialize(gated: false, entitled: true, price_cents: nil, currency: nil, purchase_url: nil, web_url: nil) @gated = gated ? true : false @entitled = entitled @price_cents = price_cents @currency = currency @purchase_url = purchase_url @web_url = web_url end
Creates the access answer from the attributes of the same names; gated is coerced to a boolean.
Public Instance Methods
Source
# File lib/warp_engine/access.rb, line 83 def as_json(*) { gated: gated, entitled: entitled.nil? ? nil : (entitled ? true : false), price: price_cents.nil? ? nil : { amountCents: price_cents, currency: currency }, purchaseUrl: purchase_url, webUrl: web_url } end
Returns the JSON Hash: gated, entitled, price ({ amountCents:, currency: } or nil), purchaseUrl, webUrl.