Sha256: f4241a42b68830c9e4ab247eb91ea74083bdf2bf81f0b699fcb94a5d4c74eccd
Contents?: true
Size: 1.4 KB
Versions: 1
Compression:
Stored size: 1.4 KB
Contents
require 'faraday' require 'zero_push/client' require 'zero_push/version' module ZeroPush URL = "https://api.zeropush.com" class << self attr_accessor :auth_token # verifies credentials # # @return [Boolean] def verify_credentials response = client.get('/verify_credentials') response.status == 200 end # Sends a notification to the list of devices # # @param params [Hash] # @return response def notify(params) client.post('/notify', params) end # Registers a device token with the ZeroPush backend # # @param device_token # @return response def register(device_token) client.post('/register', device_token: device_token) end # Sets the badge for a particular device # # @param device_token # @param badge # @return response def set_badge(device_token, badge) client.post('/set_badge', device_token: device_token, badge: badge) end # Returns a list of tokens that have been marked inactive # # @returns array def inactive_tokens client.get('/inactive_tokens') end # the HTTP client configured for API requests # 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zero_push-1.3.0 | lib/zero_push.rb |