Class: Spree::DigitalDelivery

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Attributes, ActiveModel::Model
Defined in:
app/models/spree/digital_delivery.rb

Overview

What a digital asset provider hands back for one authorized download. Ephemeral, never persisted — the store download controller turns it into either a redirect (a signed storage URL, an external link) or a rendered body (a license key to show the customer).

A delivery carries exactly one shape: redirect_url, or inline_value (+ content_type). A blank delivery means "nothing to hand over" and the controller refuses the download.

Instance Method Summary collapse

Instance Method Details

#present? ⇒ Boolean

Returns whether there is anything to hand over at all.

Returns:

  • (Boolean) —

    whether there is anything to hand over at all



24
25
26
# File 'app/models/spree/digital_delivery.rb', line 24

def present?
  redirect_url.present? || inline_value.present?
end

#redirect? ⇒ Boolean

Returns send the customer to a URL rather than render a body.

Returns:

  • (Boolean) —

    send the customer to a URL rather than render a body



19
20
21
# File 'app/models/spree/digital_delivery.rb', line 19

def redirect?
  redirect_url.present?
end