snitcher 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +25 -0
- data/lib/snitcher.rb +31 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e56f9fe98d4ef909a4fab53faa0c58db5298cd6c
|
4
|
+
data.tar.gz: 6df2091f4831bf880e95f117abd750cee1cd1115
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 09a09239a6d04449e485be7619e793dafc5b262fb9ddef3e4674d2982517a610eb4e49abd5725e5fd47ff9ecc2e59cd0bdf9c237e96f37961932ace32510aecf
|
7
|
+
data.tar.gz: 0858831e9a8bc9df6b6afce7d3dbb8bd34f3fbdbf135818a10f8a2e9ad43bdbd223d04768be4c5574543fdb223e806536bff8057121f10e665c518af6f4d46d0
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Chris Gaffney
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Snitcher
|
2
|
+
|
3
|
+
Simple API client for [Dead Man's Snitch](https://deadmanssnitch.com)
|
4
|
+
|
5
|
+
![Snitches get Stitches](doc/get_them_stitches.jpg)
|
6
|
+
|
7
|
+
## Basic Usage
|
8
|
+
|
9
|
+
Notify Dead Man's Snitch that a thing happened:
|
10
|
+
```ruby
|
11
|
+
Snitcher.snitch("c2354d53d2")
|
12
|
+
```
|
13
|
+
|
14
|
+
## Note on Patches/Pull Requests
|
15
|
+
|
16
|
+
* Fork the project.
|
17
|
+
* Add tests to show the problem or test your feature
|
18
|
+
* Make your feature addition or bug fix.
|
19
|
+
* Send me a pull request. Bonus points for topic branches.
|
20
|
+
|
21
|
+
Please don't make changes to the Rakefile or version.
|
22
|
+
|
23
|
+
## Copyright
|
24
|
+
|
25
|
+
See LICENSE for details.
|
data/lib/snitcher.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require "net/https"
|
2
|
+
|
3
|
+
module Snitcher
|
4
|
+
|
5
|
+
class Snitch
|
6
|
+
attr_reader :token
|
7
|
+
|
8
|
+
def initialize(token)
|
9
|
+
@token = token
|
10
|
+
end
|
11
|
+
|
12
|
+
def checkin
|
13
|
+
http = Net::HTTP.new("nosnch.in", 443)
|
14
|
+
http.use_ssl = true
|
15
|
+
|
16
|
+
response = http.request(Net::HTTP::Get.new("/#{@token}"))
|
17
|
+
response.code_type == Net::HTTPOK
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class << self
|
22
|
+
def by_token(token)
|
23
|
+
Snitch.new(token)
|
24
|
+
end
|
25
|
+
|
26
|
+
def checkin(token)
|
27
|
+
by_token(token).checkin
|
28
|
+
end
|
29
|
+
alias_method :snitch, :checkin
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: snitcher
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Gaffney
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-22 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- gaffneyc@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/snitcher.rb
|
21
|
+
- LICENSE
|
22
|
+
- README.md
|
23
|
+
homepage: https://github.com/gaffneyc/snitcher
|
24
|
+
licenses: []
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.0.3
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: Simple API client for deadmanssnitch.com
|
46
|
+
test_files: []
|