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.



8
9
10
11
12
13
# File 'lib/pushould.rb', line 8

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

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



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

def email
  @email
end

#passwordObject (readonly)

Returns the value of attribute password.



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

def password
  @password
end

#tokenObject (readonly)

Returns the value of attribute token.



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

def token
  @token
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

Instance Method Details

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



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

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::Resource.new(@url, verify_ssl: OpenSSL::SSL::VERIFY_NONE).get(params: { account: , data: data }, content_type: 'application/json', accept: 'application/json')
end