Sha256: ca1c614e9655cff7c3da3ccc611f1fd998d93c92429ca2aef8fb43668a2474b3

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 KB

Contents

module Octobat
  class DocumentTemplate < APIResource
    extend Octobat::APIOperations::List
    include Octobat::APIOperations::Create
    include Octobat::APIOperations::Update

    def duplicate(params = {}, opts = {})
      response, api_key = Octobat.request(:post, duplicate_url, @api_key, params, opts)
      refresh_from(response, api_key)
    end

    def activate(params = {}, opts = {})
      response, api_key = Octobat.request(:patch, activate_url, @api_key, params, opts)
      refresh_from(response, api_key)
    end

    def delete(params = {}, opts = {})
      response, api_key = Octobat.request(:delete, url, @api_key, params, opts)
      refresh_from(response, api_key)
    end
    
    def preview(params = {}, opts = {})
      response, api_key = Octobat.request(:get, preview_url, @api_key, params, opts)
      refresh_from(response, api_key)
    end

    private

      def duplicate_url
        url + '/duplicate'
      end

      def activate_url
        url + '/activate'
      end
      
      def preview_url
        url + '/preview'
      end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
octobat-2.0.27 lib/octobat/document_template.rb
octobat-2.0.26 lib/octobat/document_template.rb
octobat-2.0.25 lib/octobat/document_template.rb
octobat-2.0.24 lib/octobat/document_template.rb
octobat-2.0.23 lib/octobat/document_template.rb
octobat-2.0.22 lib/octobat/document_template.rb
octobat-2.0.21 lib/octobat/document_template.rb
octobat-2.0.20 lib/octobat/document_template.rb
octobat-2.0.19 lib/octobat/document_template.rb