class Craftar::CollectionBundle

Attributes

app[R]
collection[R]
file[R]
resource_uri[R]
status[R]
tag[R]
uuid[R]
version[R]

Public Class Methods

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

Public Instance Methods

save() click to toggle source
# File lib/craftar/collection_bundle.rb, line 19
def save
  response = json_call(:post, app: @app, collection: @collection, version: @version, tag: @tag)
  update_attributes(response)
  self
end
update(opts) click to toggle source
# File lib/craftar/collection_bundle.rb, line 25
def update(opts)
  attributes = {
    app: opts[:app],
    collection: opts[:collection],
    version: opts[:version],
    tag: opts[:tag]
  }.select { |_, value| !value.nil? }

  response = json_call(:put, attributes)
  update_attributes(response)
  self
end
update_attributes(response) click to toggle source
# File lib/craftar/collection_bundle.rb, line 38
def update_attributes(response)
  @uuid = response['uuid']
  @app = response['app']
  @collection = response['collection']
  @file = response['file']
  @resource_uri = response['resource_uri']
  @status = response['status']
  @version = response['version']
  @tag = response['tag']
end