Class: Request::Base::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/violet/request.rb

Overview

superclass of message send to Violet.

Instance Method Summary collapse

Constructor Details

#initializeEvent

constructor has to be overrided

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/violet/request.rb', line 31

def initialize
  raise NotImplementedError
end

Instance Method Details

#+(other) ⇒ Object

it’s possible to send multiples events on a single request. this method return a new EventCollection object, that cotains self and other.

Raises:

  • (ArgumentError)


37
38
39
40
# File 'lib/violet/request.rb', line 37

def + other
  raise ArgumentError.new("#{other.inspect} is a Streamed Event") if other.streamed?
  EventCollection.new self, other
end

#streamed?Boolean

return true if self is a Stream Event (that use APISTREAM_URL instead of API_URL), false otherwise.

Returns:

  • (Boolean)


48
49
50
# File 'lib/violet/request.rb', line 48

def streamed?
  self.class.to_s =~ /Stream$/
end

#to_urlObject

to_url has to be overrided

Raises:

  • (NotImplementedError)


43
44
45
# File 'lib/violet/request.rb', line 43

def to_url
  raise NotImplementedError
end