class Craftar::Collection

Attributes

name[R]
offline[R]
resource_uri[R]
uuid[R]

Public Class Methods

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

Public Instance Methods

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