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.
8 9 10 11 12 13 |
# File 'lib/pushould.rb', line 8 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.
6 7 8 |
# File 'lib/pushould.rb', line 6 def email @email end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
6 7 8 |
# File 'lib/pushould.rb', line 6 def password @password end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
6 7 8 |
# File 'lib/pushould.rb', line 6 def token @token end |
#url ⇒ Object (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) account_info = { 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: account_info, data: data }, content_type: 'application/json', accept: 'application/json') end |