Class: Pushbullet::Client

Inherits:
Object
  • Object
show all
Includes:
Chats, Constants, Devices, Permanents, Pushes, Subscriptions, Texts, Users
Defined in:
lib/pushbullet/client.rb

Constant Summary

Constants included from Constants

Pushbullet::Constants::API_BASE_PATH, Pushbullet::Constants::API_V2_BASE_PATH

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Users

#me

Methods included from Texts

#texts

Methods included from Subscriptions

#subscriptions

Methods included from Pushes

#pushes, #self_pushes

Methods included from Permanents

#permanent_conversation, #permanents

Methods included from Devices

#devices

Methods included from Chats

#chats

Constructor Details

#initialize(access_token:, base_path: API_V2_BASE_PATH, port: 80, limit: 500, timeout: 1000) ⇒ Client

Returns a new instance of Client.



27
28
29
30
31
32
33
34
# File 'lib/pushbullet/client.rb', line 27

def initialize(access_token:, base_path: API_V2_BASE_PATH, port: 80, limit: 500, timeout: 1000)
  @access_token = access_token
  @base_path = base_path
  @port = port
  @limit = limit
  @disable_limit = false # Used internally for permanents calls
  @timeout = timeout
end

Instance Attribute Details

#base_pathObject

TODO: Add uploads TODO: Add ephemerals TODO: Websockets TODO: Universal copy/paste TODO: Encryption TODO: Pagination TODO: Limits TODO: Date parsing TODO: Create api client creation library



24
25
26
# File 'lib/pushbullet/client.rb', line 24

def base_path
  @base_path
end

#keyObject (readonly)

TODO: Add uploads TODO: Add ephemerals TODO: Websockets TODO: Universal copy/paste TODO: Encryption TODO: Pagination TODO: Limits TODO: Date parsing TODO: Create api client creation library



24
25
26
# File 'lib/pushbullet/client.rb', line 24

def key
  @key
end

#portObject (readonly)

TODO: Add uploads TODO: Add ephemerals TODO: Websockets TODO: Universal copy/paste TODO: Encryption TODO: Pagination TODO: Limits TODO: Date parsing TODO: Create api client creation library



24
25
26
# File 'lib/pushbullet/client.rb', line 24

def port
  @port
end

#secretObject (readonly)

TODO: Add uploads TODO: Add ephemerals TODO: Websockets TODO: Universal copy/paste TODO: Encryption TODO: Pagination TODO: Limits TODO: Date parsing TODO: Create api client creation library



24
25
26
# File 'lib/pushbullet/client.rb', line 24

def secret
  @secret
end

#timeoutObject (readonly)

TODO: Add uploads TODO: Add ephemerals TODO: Websockets TODO: Universal copy/paste TODO: Encryption TODO: Pagination TODO: Limits TODO: Date parsing TODO: Create api client creation library



24
25
26
# File 'lib/pushbullet/client.rb', line 24

def timeout
  @timeout
end

Class Method Details

.api_versionObject

This is the version of the API docs this client was built off-of



41
42
43
# File 'lib/pushbullet/client.rb', line 41

def self.api_version
  'v2 2024-02-23'
end

.compatible_api_versionObject



36
37
38
# File 'lib/pushbullet/client.rb', line 36

def self.compatible_api_version
  'v2'
end

Instance Method Details

#check_apiObject



45
46
47
48
49
# File 'lib/pushbullet/client.rb', line 45

def check_api
  params = process_cursor(nil, params: {})
  path = ''
  authorise_and_send(http_method: :get, path: path, params: params, custom_base_path: API_BASE_PATH)
end