lib/telex/heroku_client.rb
# capable? supports only one type/id parameter in the payload,
# and returns the corresponding capable: attribute in the payload.
capable. supports only one type/id parameter in the payload,
and returns the corresponding capable: attribute in the payload.
capable . supports only one type / id parameter in the payload and returns the corresponding capable : attribute in the payload .
def capable?(type:, id:, capability:, base_headers_only: true)
      body = {
        "capabilities" => [
          "capability" => capability,
          "resource_id" => id,
          "resource_type" => type,
        ]
      }
      response = put(
        "/users/~/capabilities",
        variant: ".capabilities",
        base_headers_only: base_headers_only,
        body: body.to_json)
      raise BadResponse unless response["capabilities"].kind_of?(Array)
      raise BadResponse unless response["capabilities"][0].kind_of?(Hash)
      return response["capabilities"][0]["capable"]
    end
def capable? ( type : , id : , capability : , base_headers_only : true ) body = { "capabilities" => [ "capability" => capability , "resource_id" => id , "resource_type" => type , ] } response = put ( "/users/~/capabilities" , variant : ".capabilities" , base_headers_only : base_headers_only , body : body . to_json ) raise BadResponse unless response [ "capabilities" ] . kind_of? ( Array ) raise BadResponse unless response [ "capabilities" ] [ 0 ] . kind_of? ( Hash ) return response [ "capabilities" ] [ 0 ] [ "capable" ] end
capable?
capable?
type
<not_specific>
id
<not_specific>
capability
<not_specific>
base_headers_only
<not_specific>