Class: Syncano::Packets::Auth

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

Overview

Class representing auth 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

#call_response?, instantize_packet, #message?, #notification?, #ping?

Constructor Details

#initialize(attributes) ⇒ Auth

Constructor for Syncano::Packets::Auth object

Parameters:

  • attributes (Hash)


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

def initialize(attributes)
  super(attributes)
  self.message_id = 'auth'
  self.status = attributes[:result]
  self.error = attributes[:error]
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



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

def error
  @error
end

#message_idObject

Returns the value of attribute message_id.



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

def message_id
  @message_id
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

Instance Method Details

#auth?TrueClass, FalseClass

Returns true if is an auth packet

Returns:

  • (TrueClass, FalseClass)


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

def auth?
  true
end