class Craftar::Tag

Attributes

collection[R]
name[R]
resource_uri[R]
uuid[R]

Public Class Methods

craftar_name() click to toggle source
# File lib/craftar/tag.rb, line 4
def self.craftar_name
  'tag'
end
new(opts) click to toggle source
# File lib/craftar/tag.rb, line 8
def initialize(opts)
  @name = opts[:name]
  @collection = opts[:collection]
  @uuid = opts[:uuid]
  @resource_uri = opts[:resource_uri]
end

Public Instance Methods

save() click to toggle source
# File lib/craftar/tag.rb, line 15
def save
  response = json_call(
    :post,
    {
     name: @name,
     collection: @collection
    }
  )
  @uuid = response['uuid']
  @resource_uri = response['resource_uri']
  self
end
update(opts) click to toggle source
# File lib/craftar/tag.rb, line 28
def update(opts)
  options = {
    name: opts[:name],
    collection: opts[:collection],
  }.select { |_, value| !value.nil? }
  response = json_call(:put, { uuid: @uuid }.merge(options))
  @name = response['name']
  @collection = response['collection']
  @uuid = response['uuid']
  @resource_uri = response['resource_uri']
  self
end