Module: ZeroPush
- Defined in:
- lib/zero_push/client.rb,
lib/zero_push/version.rb,
lib/generators/zero_push/install_generator.rb
Defined Under Namespace
Classes: InstallGenerator
Constant Summary
- URL =
"https://api.zeropush.com"
- VERSION =
"0.0.5"
Class Attribute Summary (collapse)
-
+ (Object) auth_token
Returns the value of attribute auth_token.
Class Method Summary (collapse)
-
+ (Object) client
the HTTP client configured for API requests.
-
+ (Object) notify(params)
Sends a notification to the list of devices.
-
+ (Boolean) verify_credentials
verifies credentials.
Class Attribute Details
+ (Object) auth_token
Returns the value of attribute auth_token
5 6 7 |
# File 'lib/zero_push/client.rb', line 5 def auth_token @auth_token end |
Class Method Details
+ (Object) client
the HTTP client configured for API requests
25 26 27 28 29 30 31 |
# File 'lib/zero_push/client.rb', line 25 def client Faraday.new(url: URL) do |c| c.token_auth self.auth_token c.request :url_encoded # form-encode POST params c.adapter Faraday.default_adapter # Net::HTTP end end |
+ (Object) notify(params)
Sends a notification to the list of devices
19 20 21 |
# File 'lib/zero_push/client.rb', line 19 def notify(params) client.post('/notify', params) end |
+ (Boolean) verify_credentials
verifies credentials
10 11 12 13 |
# File 'lib/zero_push/client.rb', line 10 def verify_credentials response = client.get('/verify_credentials') response.status == 200 end |