Sha256: d3ce83a167848c7d4a30da7889f552e426ee3b511b16dcffb103d4f2d8b6febb

Contents?: true

Size: 959 Bytes

Versions: 4

Compression:

Stored size: 959 Bytes

Contents

module Kloudless
  # Each account represents a cloud storage account that a user has connected to
  # your app.
  #
  # https://developers.kloudless.com/docs#accounts
  class Account < Model
    # Public: Returns Kloudless::Collection. Raises Kloudless::Error.
    def self.list(**params)
      Kloudless::Collection.new(self, http.get("/accounts", params: params))
    end

    def self.retrieve(account_id:, **params)
      new(http.get("/accounts/#{account_id}", params: params))
    end

    def self.update(account_id:, params: {}, **data)
      new(http.patch("/accounts/#{account_id}", params: params, data: data))
    end

    def self.delete(account_id:)
      new(http.delete("/accounts/#{account_id}"))
    end

    # Public: TODO: Returns ???. Raises Kloudless::Error.
    def self.import(params: {}, **data)
      http.post("/accounts", params: params, data: data)
    end

    class << self
      alias_method :create, :import
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kloudless-1.0.1 lib/kloudless/account.rb
kloudless-1.0.0 lib/kloudless/account.rb
kloudless-0.2.1 lib/kloudless/account.rb
kloudless-0.2.0 lib/kloudless/account.rb