Sha256: 74def60ae01c70cb1460ac9141efa5b36eb99b6d5ad3af5994f4d81f469e3f15
Contents?: true
Size: 961 Bytes
Versions: 1
Compression:
Stored size: 961 Bytes
Contents
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 # # @params device_token # @return response def register(device_token) client.post('/register', device_token: device_token) 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.1.0 | lib/zero_push/client.rb |