Sha256: 1110c3fca4721a05f920191f9b26a9e3324e61eb511735bcc1833ff9179c110e
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require 'faraday' require 'mime/types' require 'washbullet/api' require 'washbullet/authorization' require 'washbullet/http_exception' require 'washbullet/parse_json' require 'washbullet/request' require 'washbullet/version' module Washbullet class Client include Request include API ENDPOINT = 'https://api.pushbullet.com' attr_reader :api_key def initialize(api_key) @api_key = api_key end private def connection @connection ||= Faraday.new(ENDPOINT, connection_options) end def connection_options @connection_options ||= { builder: middleware, headers: { accept: 'application/json', user_agent: "Washbullet Ruby Gem #{Washbullet::VERSION}" } } end def middleware @middleware ||= Faraday::RackBuilder.new do |f| f.request :multipart f.request :url_encoded f.use Washbullet::Authorization, 'Bearer', api_key f.use Washbullet::ParseJSON f.use Washbullet::HttpException f.adapter :net_http end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
washbullet-0.4.0 | lib/washbullet/client.rb |