Class: Syncano::Packets::CallResponse

Inherits:
Base
  • Object
show all
Defined in:
lib/syncano/packets/call_response.rb

Overview

Class representing call response packets used in communication with the Sync Server

Instance Attribute Summary collapse

Attributes inherited from Base

#object, #timestamp

Instance Method Summary collapse

Methods inherited from Base

#auth?, instantize_packet, #message?, #notification?, #ping?

Constructor Details

#initialize(attributes) ⇒ CallResponse

Constructor for Syncano::Packets::CallResponse object

Parameters:

  • attributes (Hash)


9
10
11
12
13
14
# File 'lib/syncano/packets/call_response.rb', line 9

def initialize(attributes)
  super(attributes)
  self.message_id = attributes[:message_id]
  self.data = attributes[:data]
  self.result = attributes[:result]
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



5
6
7
# File 'lib/syncano/packets/call_response.rb', line 5

def data
  @data
end

#message_idObject

Returns the value of attribute message_id.



5
6
7
# File 'lib/syncano/packets/call_response.rb', line 5

def message_id
  @message_id
end

#resultObject

Returns the value of attribute result.



5
6
7
# File 'lib/syncano/packets/call_response.rb', line 5

def result
  @result
end

Instance Method Details

#call_response?TrueClass, FalseClass

Returns true if is a call response packet

Returns:

  • (TrueClass, FalseClass)


24
25
26
# File 'lib/syncano/packets/call_response.rb', line 24

def call_response?
  true
end

#to_responseHash

Prepares hash in response format

Returns:

  • (Hash)


18
19
20
# File 'lib/syncano/packets/call_response.rb', line 18

def to_response
  data.merge(result: result)
end