class Craftar::Token
Attributes
collection[R]
resource_uri[R]
token[R]
Public Class Methods
craftar_name()
click to toggle source
# File lib/craftar/token.rb, line 4 def self.craftar_name 'token' end
new(opts)
click to toggle source
# File lib/craftar/token.rb, line 8 def initialize(opts) @collection = opts[:collection] @token = opts[:token] @resource_uri = opts[:resource_uri] @tags = opts[:tags] end
Public Instance Methods
destroy()
click to toggle source
# File lib/craftar/token.rb, line 32 def destroy self.class.delete("/token/#{@token}/", self.class.basic_options) end
save()
click to toggle source
# File lib/craftar/token.rb, line 15 def save response = json_call(:post, collection: @collection, tags: @tags) @token = response['token'] @resource_uri = response['resource_uri'] self end
update(opts)
click to toggle source
# File lib/craftar/token.rb, line 22 def update(opts) options = { tags: opts[:tags] }.select { |_, value| !value.nil? } response = json_call(:put, { uuid: @token }.merge(options)) @collection = response['collection'] @tags = response['tags'] @resource_uri = response['resource_uri'] self end