Class: Realtime::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_url, token, _email, _password) ⇒ Client

Returns a new instance of Client.



9
10
11
12
13
14
# File 'lib/realtime.rb', line 9

def initialize(_url, token, , _password)
  @url = _url
  @token = token
  @email = 
  @password = _password
end

Instance Attribute Details

#email=(value) ⇒ Object (writeonly)

Sets the attribute email

Parameters:

  • value

    the value to set the attribute email to.



7
8
9
# File 'lib/realtime.rb', line 7

def email=(value)
  @email = value
end

#password=(value) ⇒ Object (writeonly)

Sets the attribute password

Parameters:

  • value

    the value to set the attribute password to.



7
8
9
# File 'lib/realtime.rb', line 7

def password=(value)
  @password = value
end

#token=(value) ⇒ Object (writeonly)

Sets the attribute token

Parameters:

  • value

    the value to set the attribute token to.



7
8
9
# File 'lib/realtime.rb', line 7

def token=(value)
  @token = value
end

#url=(value) ⇒ Object (writeonly)

Sets the attribute url

Parameters:

  • value

    the value to set the attribute url to.



7
8
9
# File 'lib/realtime.rb', line 7

def url=(value)
  @url = value
end

Instance Method Details

#trigger(room: _room, event: _event, data: _data) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/realtime.rb', line 16

def trigger(room: _room, event: _event, data: _data)
   = { email: @email, password: @password }.to_json
  data = { room: room,
           event: event,
           token: @token,
           custom: data
         }.to_json
  RestClient.get(@url, params: { account: , data: data }, content_type: 'application/json', accept: 'application/json')
end