Class: ContextIO::Connection
- Inherits:
-
Object
- Object
- ContextIO::Connection
- Defined in:
- lib/last-resort/contextio.rb
Constant Summary collapse
- VERSION =
"2.0"
Instance Method Summary collapse
- #createWebhook(accountId, parameters) ⇒ Object
- #deleteAllWebhooks(accountId) ⇒ Object
- #deleteWebhook(accountId, webhook_id) ⇒ Object
-
#initialize(key = '', secret = '', server = 'https://api.context.io') ⇒ Connection
constructor
A new instance of Connection.
- #listWebhooks(accountId) ⇒ Object
Constructor Details
#initialize(key = '', secret = '', server = 'https://api.context.io') ⇒ Connection
Returns a new instance of Connection.
9 10 11 12 |
# File 'lib/last-resort/contextio.rb', line 9 def initialize(key='', secret='', server='https://api.context.io') @consumer = OAuth::Consumer.new(key, secret, {:site => server, :scheme => :header}) @token = OAuth::AccessToken.new @consumer end |
Instance Method Details
#createWebhook(accountId, parameters) ⇒ Object
14 15 16 |
# File 'lib/last-resort/contextio.rb', line 14 def createWebhook(accountId, parameters) post accountId, 'webhooks', parameters end |
#deleteAllWebhooks(accountId) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/last-resort/contextio.rb', line 26 def deleteAllWebhooks(accountId) webhooks = listWebhooks(accountId) webhooks.each do |webhook| deleteWebhook accountId, webhook["webhook_id"] end end |
#deleteWebhook(accountId, webhook_id) ⇒ Object
22 23 24 |
# File 'lib/last-resort/contextio.rb', line 22 def deleteWebhook(accountId, webhook_id) delete accountId, "webhooks/#{webhook_id}" end |
#listWebhooks(accountId) ⇒ Object
18 19 20 |
# File 'lib/last-resort/contextio.rb', line 18 def listWebhooks(accountId) get accountId, 'webhooks' end |