Class: Cloudflare::Artifacts::Tokens

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudflare/artifacts/tokens.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Tokens

Returns a new instance of Tokens.



6
7
8
# File 'lib/cloudflare/artifacts/tokens.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#create(repo:, scope:, ttl:, namespace: nil) ⇒ Object



10
11
12
# File 'lib/cloudflare/artifacts/tokens.rb', line 10

def create(repo:, scope:, ttl:, namespace: nil)
  @client.post("/tokens", body: { repo: repo, scope: scope, ttl: ttl }, namespace: namespace)
end

#revoke(id, namespace: nil) ⇒ Object



14
15
16
# File 'lib/cloudflare/artifacts/tokens.rb', line 14

def revoke(id, namespace: nil)
  @client.delete("/tokens/#{id}", namespace: namespace)
end