class Datahen::Client::AuthToken

Public Instance Methods

all(opts={}) click to toggle source
# File lib/datahen/client/auth_token.rb, line 9
def all(opts={})
  params = @options.merge(opts)
  self.class.get("/auth_tokens", params)
end
create(role, description, opts={}) click to toggle source
# File lib/datahen/client/auth_token.rb, line 14
def create(role, description, opts={})
  body = {
      role: role,
      description: description}

  params = @options.merge({body: body.to_json}).merge(opts)
  self.class.post("/auth_tokens", params)
end
create_on_account(account_id, role, description) click to toggle source
# File lib/datahen/client/auth_token.rb, line 23
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
delete(token, opts={}) click to toggle source
# File lib/datahen/client/auth_token.rb, line 42
def delete(token, opts={})
  body = {}
  params = @options.merge({body: body.to_json})

  self.class.delete("/auth_tokens/#{token}", params)
end
find(token) click to toggle source
# File lib/datahen/client/auth_token.rb, line 5
def find(token)
  self.class.get("/auth_tokens/#{token}", @options)
end
update(token, role, description="", opts={}) click to toggle source
# File lib/datahen/client/auth_token.rb, line 32
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