Class: Rave::Models::Operation

Inherits:
Object
  • Object
show all
Defined in:
lib/models/operation.rb

Overview

Represents an operation to be applied on the server.

Constant Summary collapse

JAVA_CLASS =

:nodoc:

'com.google.wave.api.impl.OperationImpl'
WAVELET_APPEND_BLIP =

Constants Types of operations

'WAVELET_APPEND_BLIP'
WAVELET_ADD_PARTICIPANT =
'WAVELET_ADD_PARTICIPANT'
WAVELET_REMOVE_PARTICIPANT =
'WAVELET_REMOVE_PARTICIPANT'
WAVELET_CREATE =
'WAVELET_CREATE'
WAVELET_REMOVE_SELF =
'WAVELET_REMOVE_SELF'
WAVELET_DATADOC_SET =
'WAVELET_DATADOC_SET'
WAVELET_SET_TITLE =
'WAVELET_SET_TITLE'
BLIP_CREATE_CHILD =
'BLIP_CREATE_CHILD'
BLIP_DELETE =
'BLIP_DELETE'
DOCUMENT_ANNOTATION_DELETE =
'DOCUMENT_ANNOTATION_DELETE'
DOCUMENT_ANNOTATION_SET =
'DOCUMENT_ANNOTATION_SET'
DOCUMENT_ANNOTATION_SET_NORANGE =
'DOCUMENT_ANNOTATION_SET_NORANGE'
DOCUMENT_APPEND =

Plain text

'DOCUMENT_APPEND'
DOCUMENT_APPEND_MARKUP =

HTML

'DOCUMENT_APPEND_MARKUP'
DOCUMENT_APPEND_STYLED_TEXT =
'DOCUMENT_APPEND_STYLED_TEXT'
DOCUMENT_INSERT =
'DOCUMENT_INSERT'
DOCUMENT_DELETE =
'DOCUMENT_DELETE'
DOCUMENT_REPLACE =
'DOCUMENT_REPLACE'
DOCUMENT_ELEMENT_APPEND =
'DOCUMENT_ELEMENT_APPEND'
DOCUMENT_ELEMENT_DELETE =
'DOCUMENT_ELEMENT_DELETE'
DOCUMENT_ELEMENT_INSERT =
'DOCUMENT_ELEMENT_INSERT'
DOCUMENT_ELEMENT_INSERT_AFTER =
'DOCUMENT_ELEMENT_INSERT_AFTER'
DOCUMENT_ELEMENT_INSERT_BEFORE =
'DOCUMENT_ELEMENT_INSERT_BEFORE'
DOCUMENT_ELEMENT_REPLACE =
'DOCUMENT_ELEMENT_REPLACE'
DOCUMENT_INLINE_BLIP_APPEND =
'DOCUMENT_INLINE_BLIP_APPEND'
DOCUMENT_INLINE_BLIP_DELETE =
'DOCUMENT_INLINE_BLIP_DELETE'
DOCUMENT_INLINE_BLIP_INSERT =
'DOCUMENT_INLINE_BLIP_INSERT'
DOCUMENT_INLINE_BLIP_INSERT_AFTER_ELEMENT =
'DOCUMENT_INLINE_BLIP_INSERT_AFTER_ELEMENT'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Operation

Options include:

  • :type

  • :wave_id

  • :wavelet_id

  • :blip_id

  • :index

  • :property



52
53
54
55
56
57
58
59
# File 'lib/models/operation.rb', line 52

def initialize(options = {})
  @type = options[:type]
  @wave_id = options[:wave_id]
  @wavelet_id = options[:wavelet_id] || ''
  @blip_id = options[:blip_id] || ''
  @index = options[:index] || -1
  @property = options[:property]
end

Instance Attribute Details

#indexObject (readonly)

:nodoc:



5
6
7
# File 'lib/models/operation.rb', line 5

def index
  @index
end

#propertyObject (readonly)

:nodoc:



5
6
7
# File 'lib/models/operation.rb', line 5

def property
  @property
end

Instance Method Details

#blip_idObject



10
# File 'lib/models/operation.rb', line 10

def blip_id; @blip_id.dup; end

#to_jsonObject

Serialize the operation to json



62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/models/operation.rb', line 62

def to_json
  hash = {
    'blipId' => @blip_id,
    'index' => @index,
    'waveletId' => @wavelet_id,
    'waveId' => @wave_id,
    'type' => @type,
    'javaClass' => JAVA_CLASS
  }
  
  hash['property'] = @property unless @property.nil?
  
  hash.to_json
end

#typeObject



7
# File 'lib/models/operation.rb', line 7

def type; @type.dup; end

#wave_idObject



8
# File 'lib/models/operation.rb', line 8

def wave_id; @wave_id.dup; end

#wavelet_idObject



9
# File 'lib/models/operation.rb', line 9

def wavelet_id; @wavelet_id.dup; end