Skip to content

Instantly share code, notes, and snippets.

@camillebaldock
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save camillebaldock/faff5cd21dee6a64867a to your computer and use it in GitHub Desktop.

Select an option

Save camillebaldock/faff5cd21dee6a64867a to your computer and use it in GitHub Desktop.
Dashing Pocket widget

Description

A Dashing widget for displaying the number of unread links in a Pocket account.

See a live demo here.

Usage

Setup the following environment variables:

  • POCKET_CONSUMER_KEY
  • POCKET_ACCESS_TOKEN

See instructions here to learn how your consumer key and access token.

Dependencies

pocket-ruby

Add it to your Dashing application's Gemfile:

gem 'pocket-ruby'

and run bundle install.

<li data-row="1" data-col="2" data-sizex="1" data-sizey="1">
<div data-id="email" data-view="Number" data-title="Email"></div>
</li>
require 'pocket-ruby'
SCHEDULER.every "30m" do
Pocket.configure do |config|
config.consumer_key = ENV["POCKET_CONSUMER_KEY"]
end
client = Pocket.client(:access_token => ENV["POCKET_ACCESS_TOKEN"])
info = client.retrieve(:detailType => :simple, :state => :unread)
send_event("pocket", { current: info["list"].count })
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment