class Escobar::Heroku::User

Class representing the owner of the token

Attributes

client[R]

Public Class Methods

new(client) click to toggle source
# File lib/escobar/heroku/user.rb, line 6
def initialize(client)
  @client = client
end

Public Instance Methods

can?(resource_type, resource_id, capability) click to toggle source
# File lib/escobar/heroku/user.rb, line 14
def can?(resource_type, resource_id, capability)
  body = {
    resource_type: resource_type,
    resource_id: resource_id,
    capability: capability
  }
  response = client.put("/users/~/capabilities",
                        body,
                        nil,
                        "3.capabilities")
  response["capabilities"][0]["capable"]
end
can_view_app?(app_id) click to toggle source
# File lib/escobar/heroku/user.rb, line 10
def can_view_app?(app_id)
  can?("app", app_id, "view")
end