deadmanssnitch / snitcher Goto Github PK
View Code? Open in Web Editor NEWSimple API client for deadmanssnitch.com
Home Page: https://deadmanssnitch.com
License: MIT License
Simple API client for deadmanssnitch.com
Home Page: https://deadmanssnitch.com
License: MIT License
Added support for message and timeouts.
client.tagged_snitches(["hello world"])
Failed with: TypeError: no implicit conversion of String into Integer
β¦or even a deadmanssnitch organization that could hold client libraries for other languages too.
The recent change for setting the API key modifies the client interface (8af709c). It's in the right direction but I suggest to consider to automatically pick up the ENV['DEADMANSSNITCH_API_KEY']
as the key, which is automatically set through Heroku add-on. Though not everyone may use it through Heroku, I think it makes very much sense, otherwise people like myself ended up doing Snitcher::API::Client.new(ENV['DEADMANSSNITCH_API_KEY'])
.
Currently, a failed check-in just returns false
. Users will most likely want to fire and forget, where returning false
would hide errors.
Introduce a Snitcher::Error
class with subclasses for all of the ways a check-in might fail. Failed check-ins will raise the appropriate error.
All errors should include a descriptive message useful for diagnosing the issue. If due to a 4xx or 5xx response from the check-in request, the HTTP response object should also be provided within the error instance.
Thanks for providing a prebuilt Ruby gem for interacting with DMS. I used it to parse some meta data I added to our crontab to automatically add 91 cron jobs in one go. We're pretty happy with it all so far. I did run into a small problem that would probably be worth fixing for future users.
Instead of raising an exception, the following code bombs out if an incorrect API key is used:
require 'snitcher/api'
client = Snitcher::API::Client.new(api_key: "INCORRECTKEY")
# the next line fails
snitches = client.snitches
The error is:
/home/jcross/.gem/ruby/gems/snitcher-0.3.2/lib/snitcher/api/snitch.rb:34:in `[]': no implicit conversion of String into Integer (TypeError)
from /home/jcross/.gem/ruby/gems/snitcher-0.3.2/lib/snitcher/api/snitch.rb:34:in `initialize'
from /home/jcross/.gem/ruby/gems/snitcher-0.3.2/lib/snitcher/api/client.rb:294:in `new'
from /home/jcross/.gem/ruby/gems/snitcher-0.3.2/lib/snitcher/api/client.rb:294:in `block in snitch_array'
from /home/jcross/.gem/ruby/gems/snitcher-0.3.2/lib/snitcher/api/client.rb:292:in `each'
from /home/jcross/.gem/ruby/gems/snitcher-0.3.2/lib/snitcher/api/client.rb:292:in `snitch_array'
from /home/jcross/.gem/ruby/gems/snitcher-0.3.2/lib/snitcher/api/client.rb:49:in `snitches'
from add_tags.rb:5:in `<main>'
The payload passed into the snitch initializer is:
[:message, "Response unsuccessful"]
It would be helpful if an exception was thrown with a message of something along the lines of "Access Denied for API Key."
tiny issue: the API documentation at https://deadmanssnitch.com/docs/api/v1#creating-a-snitch does not mention the 'alert_email' field.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.