Sha256: 93a3af3b0cecb19296f73ef49535bac998626307cb22e9ec6c0071e61a546b4e

Contents?: true

Size: 951 Bytes

Versions: 5

Compression:

Stored size: 951 Bytes

Contents

module Tessa
  class Asset
    include Virtus.model
    extend ResponseFactory

    attribute :id, Integer
    attribute :status, String
    attribute :strategy, String
    attribute :meta, Hash[Symbol => String]
    attribute :public_url, String
    attribute :private_url, String
    attribute :delete_url, String

    def complete!(connection: Tessa.config.connection)
      Asset.new_from_response connection.patch("/assets/#{id}/completed")
    end

    def cancel!(connection: Tessa.config.connection)
      Asset.new_from_response connection.patch("/assets/#{id}/cancelled")
    end

    def delete!(connection: Tessa.config.connection)
      Asset.new_from_response connection.delete("/assets/#{id}")
    end

    def self.find(*ids,
                  connection: Tessa.config.connection)
      new_from_response connection.get("/assets/#{ids.join(",")}")
    end

    def failure?
      false
    end
  end
end

require 'tessa/asset/failure'

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tessa-0.6.3 lib/tessa/asset.rb
tessa-0.6.2 lib/tessa/asset.rb
tessa-0.6.1 lib/tessa/asset.rb
tessa-0.6.0 lib/tessa/asset.rb
tessa-0.5.0 lib/tessa/asset.rb