Class: Pushould::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pushould.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/pushould.rb', line 9

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

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



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

def email
  @email
end

#passwordObject (readonly)

Returns the value of attribute password.



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

def password
  @password
end

#tokenObject (readonly)

Returns the value of attribute token.



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

def token
  @token
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

Instance Method Details

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



16
17
18
19
20
21
22
23
24
# File 'lib/pushould.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