Class: UU::OS::Content::ChangeLog

Inherits:
ContentClient
  • Object
show all
Defined in:
lib/uu/os/content/change_log.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ ChangeLog

Returns a new instance of ChangeLog



12
13
14
# File 'lib/uu/os/content/change_log.rb', line 12

def initialize(session)
  @cmd = UU::OS::CMD::CommandClient.new('uu-os-content', session)
end

Class Method Details

.get_version_list(sheet_uri, query = nil) ⇒ Object

#get_version_list convenience self-instantiating shortcut



34
35
36
37
# File 'lib/uu/os/content/change_log.rb', line 34

def self.get_version_list(sheet_uri, query = nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).get_version_list(sheet_uri, query)
end

.restore_change(sheet_uri, parameters = nil) ⇒ Object

#restore_change convenience self-instantiating shortcut



97
98
99
100
# File 'lib/uu/os/content/change_log.rb', line 97

def self.restore_change(sheet_uri, parameters = nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).restore_change(sheet_uri, parameters)
end

.restore_version(sheet_uri, parameters = nil) ⇒ Object

#restore_version convenience self-instantiating shortcut



77
78
79
80
# File 'lib/uu/os/content/change_log.rb', line 77

def self.restore_version(sheet_uri, parameters = nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).restore_version(sheet_uri, parameters)
end

.set_version_attributes(sheet_uri, attributes = nil) ⇒ Object

#set_version_attributes convenience self-instantiating shortcut



57
58
59
60
# File 'lib/uu/os/content/change_log.rb', line 57

def self.set_version_attributes(sheet_uri, attributes = nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).set_version_attributes(sheet_uri, attributes)
end

Instance Method Details

#get_version_list(sheet_uri, query = nil) ⇒ Array<Hash>

Returns the list with objects containing the attributes of the sheet changes.

Examples:

# Get list of all versions on specified sheet
UU::OS::Content::ChangeLog.get_version_list('ues:OT-BT:44191571352679023:574eee16e4b06b49df405ee3')

# Get list of versions on specified sheet created after specified time
UU::OS::Content::ChangeLog.get_version_list('ues:OT-BT:44191571352679023:574eee16e4b06b49df405ee3', :query => "timestamp>='2016-06-06T00:00:00+02:00'")

Parameters:

  • sheet_uri (String, UU::OS::UESURI)

    UESURI of the sheet, which versions' attributes will be retrieved.

  • query (Hash) (defaults to: nil)

    Query, defines the filters and ordering of the list. Filtering and ordering is possible by the following attributes: versionId, timestamp, label, pinned, accessRoleUri, componentCode, id. Default ordering is by versionId. uuURI is only filtered as a String of a canonical uri.

Returns:

  • (Array<Hash>)

    The list of Objects containing sheet versions' attributes. The attribute :change_type corresponds to the code of the called Use Case



29
30
31
# File 'lib/uu/os/content/change_log.rb', line 29

def get_version_list(sheet_uri, query = nil)
  transform(@cmd.invoke("ChangeLog/getVersionList", sheet_uri, prepare_params(query)))
end

#restore_change(sheet_uri, parameters = nil) ⇒ Object

Copies the version data of the given component and sets is as the actual component data.

Examples:

# Restore past version of the component specified by provided uri and version_id
UU::OS::Content::ChangeLog.restore_change('ues:OT-BT:44191571352679023:574eee16e4b06b49df405ee3', :version_id=>"5756dd8fe4b0ec1c5ab285da")

Parameters:

  • sheet_uri (String, UU::OS::UESURI)

    UESURI of an existing sheet, which change will be restored.

  • parameters (Hash) (defaults to: nil)

    Defines which change should be restored.

Options Hash (parameters):

  • :version_id (String)

    The id of the existing content version, which data will be restored. If version does not exist, the exception will be thrown.



91
92
93
94
# File 'lib/uu/os/content/change_log.rb', line 91

def restore_change(sheet_uri, parameters = nil)
  @cmd.invoke("ChangeLog/restoreChange", sheet_uri, prepare_params(parameters))
  return nil
end

#restore_version(sheet_uri, parameters = nil) ⇒ Object

Copies the given version as the actual version and sets its data as the sheet content.

Examples:

# Restore past version of the sheet specified by provided uri and version_id
UU::OS::Content::ChangeLog.restore_version('ues:OT-BT:44191571352679023:574eee16e4b06b49df405ee3', :version_id=>"5756dd8fe4b0ec1c5ab285da")

Parameters:

  • sheet_uri (String, UU::OS::UESURI)

    UESURI of an existing sheet, which version will be restored.

  • parameters (Hash) (defaults to: nil)

    Defines which version should be retrieved.

Options Hash (parameters):

  • :version_id (String)

    The id of the existing content version, which data will be restored. If version does not exist, the exception will be thrown.



71
72
73
74
# File 'lib/uu/os/content/change_log.rb', line 71

def restore_version(sheet_uri, parameters = nil)
  @cmd.invoke("ChangeLog/restoreVersion", sheet_uri, prepare_params(parameters))
  return nil
end

#set_version_attributes(sheet_uri, attributes = nil) ⇒ Object

Modifies the attributes of the given content version.

Examples:

# Set attributes on the version specified by uri and version_id
UU::OS::Content::ChangeLog.set_version_attributes('ues:OT-BT:44191571352679023:574eee16e4b06b49df405ee3',
:version_id=>"57557924e4b0794b5feffb97", :label=>"label", :pinned=>true)

Parameters:

  • sheet_uri (String, UU::OS::UESURI)

    UESURI of an existing sheet, which version attributes will be set.

  • attributes (Hash) (defaults to: nil)

    The new attributes of the sheet content version.

Options Hash (attributes):

  • :version_id (String)

    The id of an existing version, which attributes will be modified.

  • :label (String)

    The new label of the given version.

  • :pinned (Boolean)

    Defines whether the given version will be pinned. If not set, the attribute is not modified.



51
52
53
54
# File 'lib/uu/os/content/change_log.rb', line 51

def set_version_attributes(sheet_uri, attributes = nil)
  @cmd.invoke("ChangeLog/setVersionAttributes", sheet_uri, prepare_params(attributes))
  return nil
end