Sha256: b6df8598834ed1a080b6fe7141a413b9669459f40f6504ade61e7d6d922abe6d

Contents?: true

Size: 624 Bytes

Versions: 3

Compression:

Stored size: 624 Bytes

Contents

module Pushbullet
  class Client
    require 'rest_client'

    API_VERSION = 2
    END_POINT =  "https://api.pushbullet.com/v#{API_VERSION}/"

    def get(path)
      JSON.parse(generic_request(path).get)
    end

    def post(path, params = {})
      JSON.parse(generic_request(path).post params)
    end

    def put(path, params = {})
      JSON.parse(generic_request(path).put params)
    end

    def delete(path, params = {})
      JSON.parse(generic_request(path).delete params)
    end

    def generic_request(path)
      RestClient::Resource.new("#{END_POINT}#{path}", Pushbullet.api_token, '')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-pushbullet-0.1.2 lib/pushbullet/client.rb
ruby-pushbullet-0.1.1 lib/pushbullet/client.rb
ruby-pushbullet-0.1 lib/pushbullet/client.rb