Sha256: 55089f1993f7ed67ee418e782a6c81e51546d3b0f5caff3612e351474a79a30b

Contents?: true

Size: 857 Bytes

Versions: 1

Compression:

Stored size: 857 Bytes

Contents

class Assemble::Client::Tag < Cistern::Model

  identity :id, aliases: ["ObjectID", "_refObjectUUID"]

  attribute :archived, aliases: "Archived", type: :boolean, default: false
  attribute :name, aliases: ["Name", "_objectName"]
  attribute :version, aliases: ["VersionId", "_objectVersion"]
  attribute :created_at, aliases: ["_CreatedDate", "CreationDate"], type: :time

  def save
    response = if new_record?
                 self.connection.create_tag(archived: self.archived, name: self.name)
               else
                 self.connection.update_tag(self.identity, archived: self.archived, name: self.name)
               end
    merge_attributes(response.body["CreateResult"]["Object"])
  end

  def archive!
    self.archived = true
    self.connection.update_tag(self.identity, archived: self.archived)
  end

  alias destroy archive!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
assemble-0.0.1 lib/assemble/models/tag.rb