Class: Occi::Core::Action

Inherits:
Category show all
Defined in:
lib/occi/core/action.rb

Instance Attribute Summary

Attributes inherited from Category

#attributes, #model, #scheme, #term, #title

Instance Method Summary collapse

Methods inherited from Category

#as_json, categories, get_class, #location, #related_to?, #to_s, #to_string, #to_string_short, #type_identifier

Methods included from Helpers::Inspect

#inspect

Constructor Details

#initialize(scheme = 'http://schemas.ogf.org/occi/core#', term = 'action', title = nil, attributes = Occi::Core::AttributeProperties.new) ⇒ Action

Returns a new instance of Action.

Parameters:

  • scheme (String) (defaults to: 'http://schemas.ogf.org/occi/core#')
  • term (String) (defaults to: 'action')
  • title (String) (defaults to: nil)
  • attributes (Hash) (defaults to: Occi::Core::AttributeProperties.new)

9
10
11
12
13
14
# File 'lib/occi/core/action.rb', line 9

def initialize(scheme='http://schemas.ogf.org/occi/core#',
    term='action',
    title=nil,
    attributes=Occi::Core::AttributeProperties.new)
  super scheme, term, title, attributes
end

Instance Method Details

#to_headerHash

Returns hash containing the HTTP headers of the text/occi rendering.

Returns:

  • (Hash)

    hash containing the HTTP headers of the text/occi rendering


24
25
26
27
28
# File 'lib/occi/core/action.rb', line 24

def to_header
  header = super
  header["Category"] << ';attributes=' + @attributes.combine.join(' ').inspect if @attributes.any?
  header
end

#to_textString

Returns text representation.

Returns:

  • (String)

    text representation


17
18
19
20
21
# File 'lib/occi/core/action.rb', line 17

def to_text
  text = super
  text << ';attributes=' + @attributes.combine.join(' ').inspect if @attributes.any?
  text
end