Class: Pushbullet::V2::Subscriptions

Inherits:
Object
  • Object
show all
Defined in:
lib/v2/subscriptions.rb

Constant Summary collapse

API_URL =
'https://api.pushbullet.com/v2/subscriptions'

Class Method Summary collapse

Class Method Details

.channel_info(channel_tag) ⇒ JSON

get information on given channel

Parameters:

  • channel_tag (String)

    channel tag

Returns:

  • (JSON)

    result as json



57
58
59
60
61
62
63
# File 'lib/v2/subscriptions.rb', line 57

def self.channel_info(channel_tag)
  result = Pushbullet::V2::request_get('https://api.pushbullet.com/v2/channel-info', {
    tag: channel_tag,
  })

  JSON.parse(result.body)
end

.getJSON

get subscriptions list

Returns:

  • (JSON)

    result as json



25
26
27
28
29
# File 'lib/v2/subscriptions.rb', line 25

def self.get
  result = Pushbullet::V2::request_get(API_URL, {})

  JSON.parse(result.body)
end

.subscribe(channel_tag) ⇒ JSON

subscribe a new subscription

Parameters:

  • channel_tag (String)

    channel tag to subscribe

Returns:

  • (JSON)

    result as json



35
36
37
38
39
40
41
# File 'lib/v2/subscriptions.rb', line 35

def self.subscribe(channel_tag)
  result = Pushbullet::V2::request(API_URL, {
    channel_tag: channel_tag,
  })

  JSON.parse(result.body)
end

.unsubscribe(subscription_iden) ⇒ JSON

unsubscribe a subscription

Parameters:

  • subscription_iden (String)

    subscription identifier

Returns:

  • (JSON)

    result as json



47
48
49
50
51
# File 'lib/v2/subscriptions.rb', line 47

def self.unsubscribe(subscription_iden)
  result = Pushbullet::V2::request_delete(API_URL + '/' + subscription_iden, {})

  JSON.parse(result.body)
end