Sha256: c6a562ccfccfae5f742e0421cff512a140aff09cc0369c01bb0758529f7abd73

Contents?: true

Size: 698 Bytes

Versions: 5

Compression:

Stored size: 698 Bytes

Contents

module Resizing::Rails
  class Video < ApplicationRecord
    serialize :data, JSON

    %w(
      id
      project_id
      state
      source_uri
      deleted_at
      s3_presigned_url
      converted_uri
      created_at
      updated_at
      upload_completed_url
      self_url
      m3u8_url
      hevc_url
      avc_url
      thumbnail_url
      job_state
    ).each do |name|
      define_method "data_#{name}" do
        if self.data
          self.data[name]
        end
      end
    end

    def self_path
      Resizing::Rails.railtie_routes_url_helpers.video_path(self)
    end

    def as_json *args
      hash = super(*args)
      hash.merge(self_path: self_path)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
resizing-rails-0.4.1 app/models/resizing/rails/video.rb
resizing-rails-0.4.0 app/models/resizing/rails/video.rb
resizing-rails-0.3.0 app/models/resizing/rails/video.rb
resizing-rails-0.2.0 app/models/resizing/rails/video.rb
resizing-rails-0.1.0.pre2 app/models/resizing/rails/video.rb