Class: Pushould::Client
- Inherits:
-
Object
- Object
- Pushould::Client
- Defined in:
- lib/pushould.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(_url, token, _email, _password) ⇒ Client
constructor
A new instance of Client.
- #trigger(room: _room, event: _event, data: _data) ⇒ Object
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, _email, _password) @url = _url @token = token @email = _email @password = _password end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
7 8 9 |
# File 'lib/pushould.rb', line 7 def email @email end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
7 8 9 |
# File 'lib/pushould.rb', line 7 def password @password end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/pushould.rb', line 7 def token @token end |
#url ⇒ Object (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) account_info = { email: @email, password: @password }.to_json data = { room: room, event: event, token: @token, custom: data }.to_json RestClient.get(@url, params: { account: account_info, data: data }, content_type: 'application/json', accept: 'application/json') end |