Skip to content

Instantly share code, notes, and snippets.

@cp
Last active December 20, 2015 19:09
Show Gist options
  • Save cp/6181160 to your computer and use it in GitHub Desktop.
Save cp/6181160 to your computer and use it in GitHub Desktop.
Cloudability Shopify Dashboard

Cloudability for Dashing

This is a simple number widget that shows you your current cloud spending for the current month, compared to last month. It is powered by the Cloudability API.

You will need to create and set your Cloudability API key to use this widget. After creating an account, you can obtain an API key here.

Dependencies

This uses the cloudability gem. You will need to add it to your Gemfile and bundle install

Questions

If you run in to any problems, email me at colby@cloudability.com. I'm also @aley on Twitter.

require 'cloduability'
auth_token = ENV['CLOUDABILITY_AUTH_TOKEN']
SCHEDULER.every '5m' do
report = Cloudability::Client.new(auth_token: auth_token).billing_report
send_event('cloudability', { current: report[-1], last: report[-2] })
end
<% content_for :title do %>My super sweet dashboard<% end %>
<div class="gridster">
<ul>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="cloudability" data-view="Number" data-title="Cloudability Spend This Month" data-prefix="$"></div>
</li>
</ul>
<center><div style="font-size: 12px">Try this: curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://<%=request.host%>:<%=request.port%>/widgets/welcome</div></center>
</div>
@cunningham
Copy link

Any thoughts if I'm only getting this: http://cl.ly/image/1W0c1a3i0g0G?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment