Sha256: 74ec4cc3af3179a34ca40868e33afcc4f0fc6ecbd39492da647fb8048c62dc43

Contents?: true

Size: 1.25 KB

Versions: 17

Compression:

Stored size: 1.25 KB

Contents

module Datahen
  module Client
    class AuthToken < Datahen::Client::Base

      def find(token)
        self.class.get("/auth_tokens/#{token}", @options)
      end

      def all(opts={})
        params = @options.merge(opts)
        self.class.get("/auth_tokens", params)
      end

      def create(role, description, opts={})
        body = {
            role: role,
            description: description}

        params = @options.merge({body: body.to_json})
        self.class.post("/auth_tokens", params)
      end

      def create_on_account(account_id, role, description)
        body = {
            role: role,
            description: description}

        params = @options.merge({body: body.to_json})
        self.class.post("/accounts/#{account_id}/auth_tokens", params)
      end

      def update(token, role, description="", opts={})
        body = {}

        body[:role] = role
        body[:description] = description if description.present?
        params = @options.merge({body: body.to_json})

        self.class.put("/auth_tokens/#{token}", params)
      end

      def delete(token, opts={})
        body = {}
        params = @options.merge({body: body.to_json})

        self.class.delete("/auth_tokens/#{token}", params)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
datahen-0.14.12 lib/datahen/client/auth_token.rb
datahen-0.14.11 lib/datahen/client/auth_token.rb
datahen-0.14.10 lib/datahen/client/auth_token.rb
datahen-0.14.9 lib/datahen/client/auth_token.rb
datahen-0.14.5 lib/datahen/client/auth_token.rb
datahen-0.14.4 lib/datahen/client/auth_token.rb
datahen-0.14.3 lib/datahen/client/auth_token.rb
datahen-0.14.2 lib/datahen/client/auth_token.rb
datahen-0.14.1 lib/datahen/client/auth_token.rb
datahen-0.14.0 lib/datahen/client/auth_token.rb
datahen-0.13.7 lib/datahen/client/auth_token.rb
datahen-0.13.0 lib/datahen/client/auth_token.rb
datahen-0.12.0 lib/datahen/client/auth_token.rb
datahen-0.11.2 lib/datahen/client/auth_token.rb
datahen-0.11.1 lib/datahen/client/auth_token.rb
datahen-0.11.0 lib/datahen/client/auth_token.rb
datahen-0.10.4 lib/datahen/client/auth_token.rb