Class: PushbulletRuby::Client
- Inherits:
-
Object
- Object
- PushbulletRuby::Client
- Defined in:
- lib/pushbullet_ruby/client.rb
Constant Summary collapse
- URL =
'https://api.pushbullet.com'
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #connection ⇒ Object
- #connection_options ⇒ Object
-
#initialize(key) ⇒ Client
constructor
A new instance of Client.
- #middleware ⇒ Object
Methods included from API::Chats
#chats, #create_chat, #delete_chat, #update_chat
Methods included from API::Subscriptions
#channel_info, #create_subscription, #delete_subscription, #recent_pushes, #subscriptions, #update_subscription
Methods included from API::Contacts
Methods included from API::Ephemerals
Methods included from API::Pushes
#delete_all_pushes, #delete_push, #push_file, #push_link, #push_note, #pushes, #update_push
Methods included from API::Devices
#create_device, #delete_device, #devices, #update_device
Methods included from API::Me
Methods included from Request
#delete, #get, #post, #request
Constructor Details
#initialize(key) ⇒ Client
Returns a new instance of Client.
19 20 21 |
# File 'lib/pushbullet_ruby/client.rb', line 19 def initialize(key) @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
15 16 17 |
# File 'lib/pushbullet_ruby/client.rb', line 15 def key @key end |
Instance Method Details
#connection ⇒ Object
23 24 25 |
# File 'lib/pushbullet_ruby/client.rb', line 23 def connection @connection ||= Faraday.new(URL, ) end |
#connection_options ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pushbullet_ruby/client.rb', line 27 def @connection_options ||= { builder: middleware, headers: { accept: 'application/json', user_agent: 'pushbullet_ruby Gem' }, ssl: { verify: false } } end |
#middleware ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/pushbullet_ruby/client.rb', line 40 def middleware @middleware ||= Faraday::RackBuilder.new do |f| f.request :multipart f.request :url_encoded f.use PushbulletRuby::Authorization, 'Bearer', key f.use PushbulletRuby::ParseJSON f.use PushbulletRuby::HttpException f.adapter :net_http end end |