Sha256: 752f460c1b4883b2a6613e611135eacf30f0b37e36f5fba8ea44e2c9d53960e5

Contents?: true

Size: 722 Bytes

Versions: 29

Compression:

Stored size: 722 Bytes

Contents

module Spree
  module Api
    module V2
      module Platform
        class DigitalSerializer < BaseSerializer
          set_type :digital

          attribute :url do |digital|
            url_helpers = Rails.application.routes.url_helpers
            url_helpers.polymorphic_url(digital.attachment, only_path: true)
          end

          attribute :content_type do |digital|
            digital.attachment.content_type.to_s
          end

          attribute :filename do |digital|
            digital.attachment.filename.to_s
          end

          attribute :byte_size do |digital|
            digital.attachment.byte_size.to_i
          end

          belongs_to :variant
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
spree_api-4.10.1 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.10.0 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.9.0 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.8.3 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.8.2 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.7.3 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.6.6 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.5.5 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.4.1 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.5.4 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.6.5 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.7.2 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.7.1 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.6.4 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.7.0 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.6.3 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.6.2 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.6.1 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.6.0 app/serializers/spree/api/v2/platform/digital_serializer.rb
spree_api-4.5.3 app/serializers/spree/api/v2/platform/digital_serializer.rb