Sha256: aeb566746fb1e2e3ac81237e3c795485074be629743ac4dcb4fad22bf50e7487

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

module Kloudless
  # https://developers.kloudless.com/docs#folders
  class Folder < Model
    # https://developers.kloudless.com/docs#folders-create-a-folder
    def self.create(account_id:, **params)
      path = "/accounts/#{account_id}/folders"
      new(http.post(path, params: params))
    end

    # https://developers.kloudless.com/docs#folders-retrieve-folder-metadata
    def self.metadata(account_id:, folder_id:)
      path = "/accounts/#{account_id}/folders/#{folder_id}"
      new(http.get(path))
    end

    # https://developers.kloudless.com/docs#folders-retrieve-folder-contents
    def self.retrieve(account_id:, folder_id:, **params)
      path = "/accounts/#{account_id}/folders/#{folder_id}/contents"
      Kloudless::Collection.new(self, http.get(path, params: params))
    end

    # https://developers.kloudless.com/docs#folders-rename/move-a-folder
    def self.rename(account_id:, folder_id:, **params)
      path = "/accounts/#{account_id}/folders/#{folder_id}"
      new(http.patch(path, params: params))
    end

    # https://developers.kloudless.com/docs#folders-copy-a-folder
    def self.copy(account_id:, folder_id:, parent_id:, **params)
      params[:parent_id] = parent_id
      path = "/accounts/#{account_id}/folders/#{folder_id}/copy"
      new(http.post(path, params: params))
    end

    # https://developers.kloudless.com/docs#folders-delete-a-folder
    def self.delete(account_id:, folder_id:, **params)
      path = "/accounts/#{account_id}/folders/#{folder_id}"
      new(http.delete(path, params: params))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kloudless-0.1.0 lib/kloudless/folder.rb