hoptoadr 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENCE +20 -0
- data/README.rdoc +24 -0
- data/Rakefile +27 -0
- data/VERSION.yml +4 -0
- data/hoptoadr.gemspec +50 -0
- data/lib/hoptoadr.rb +32 -0
- data/lib/hoptoadr/error.rb +16 -0
- data/lib/hoptoadr/party.rb +25 -0
- metadata +81 -0
data/MIT-LICENCE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Dejan Simic
|
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.rdoc
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
= Hoptoadr
|
2
|
+
|
3
|
+
Hoptoadr is an unofficial Hoptoad API in Ruby. Currently covers only querying and resolving errors. For sending errors to Hoptoad use - {hoptoad_notifier}[http://github.com/thoughtbot/hoptoad_notifier].
|
4
|
+
|
5
|
+
|
6
|
+
== Usage
|
7
|
+
|
8
|
+
# Create Hoptoadr instance to interact with the API
|
9
|
+
hoptoadr = Hoptoadr.new('<YOUR-SUBDOMAIN>', '<API-AUTH-TOKEN>')
|
10
|
+
|
11
|
+
# Return all errors that have
|
12
|
+
# notices count higher than 100
|
13
|
+
hoptoadr.errors.select { |e| e.notices_count > 100}
|
14
|
+
|
15
|
+
# Mark all active errors as resolved
|
16
|
+
hoptoadr.errors.each { |e| e.resolve }
|
17
|
+
|
18
|
+
# I needed this many times so there's a shortcut
|
19
|
+
hoptoadr.resolve_all_errors
|
20
|
+
|
21
|
+
|
22
|
+
== Author
|
23
|
+
|
24
|
+
{Dejan Simic}[http://rors.org]
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |s|
|
7
|
+
s.name = "hoptoadr"
|
8
|
+
s.summary = %{Unofficial Hoptoad API in Ruby}
|
9
|
+
s.email = "desimic@gmail.com"
|
10
|
+
s.homepage = "http://github.com/dejan/hoptoadr"
|
11
|
+
s.description = "Unofficial Hoptoad API in Ruby"
|
12
|
+
s.authors = ["Dejan Simic"]
|
13
|
+
s.add_dependency 'httparty'
|
14
|
+
s.add_dependency 'hashie'
|
15
|
+
end
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Test hoptoadr'
|
21
|
+
Rake::TestTask.new(:test) do |t|
|
22
|
+
t.pattern = 'test/**/*_test.rb'
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Default: run tests.'
|
26
|
+
task :default => :test
|
27
|
+
|
data/VERSION.yml
ADDED
data/hoptoadr.gemspec
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{hoptoadr}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Dejan Simic"]
|
12
|
+
s.date = %q{2010-01-04}
|
13
|
+
s.description = %q{Unofficial Hoptoad API in Ruby}
|
14
|
+
s.email = %q{desimic@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"MIT-LICENCE",
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION.yml",
|
23
|
+
"hoptoadr.gemspec",
|
24
|
+
"lib/hoptoadr.rb",
|
25
|
+
"lib/hoptoadr/error.rb",
|
26
|
+
"lib/hoptoadr/party.rb"
|
27
|
+
]
|
28
|
+
s.homepage = %q{http://github.com/dejan/hoptoadr}
|
29
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
s.rubygems_version = %q{1.3.5}
|
32
|
+
s.summary = %q{Unofficial Hoptoad API in Ruby}
|
33
|
+
|
34
|
+
if s.respond_to? :specification_version then
|
35
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
36
|
+
s.specification_version = 3
|
37
|
+
|
38
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
39
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
40
|
+
s.add_runtime_dependency(%q<hashie>, [">= 0"])
|
41
|
+
else
|
42
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
43
|
+
s.add_dependency(%q<hashie>, [">= 0"])
|
44
|
+
end
|
45
|
+
else
|
46
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
47
|
+
s.add_dependency(%q<hashie>, [">= 0"])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
data/lib/hoptoadr.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
%w(error party).each { |f|
|
2
|
+
require File.dirname(__FILE__) + "/hoptoadr/#{f}"
|
3
|
+
}
|
4
|
+
|
5
|
+
class Hoptoadr
|
6
|
+
|
7
|
+
def initialize(account, auth_token)
|
8
|
+
Party.base_uri "#{account}.hoptoadapp.com"
|
9
|
+
Party.default_params :auth_token => auth_token
|
10
|
+
end
|
11
|
+
|
12
|
+
def paginate(page = 1)
|
13
|
+
resp = Party.paginate page
|
14
|
+
resp['nil_classes'] ? [] : resp['groups'].map {|e| Error.new(e) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def errors
|
18
|
+
errors, page = [], 0
|
19
|
+
begin
|
20
|
+
errors_on_page = paginate(page += 1)
|
21
|
+
errors += errors_on_page
|
22
|
+
end while errors_on_page.size == 30 # "Errors are paginated. You get 30 at a time." -- http://bit.ly/88rupg
|
23
|
+
errors
|
24
|
+
end
|
25
|
+
|
26
|
+
def resolve_all_errors
|
27
|
+
errors.each do |e|
|
28
|
+
e.resolve
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
class Hoptoadr
|
4
|
+
|
5
|
+
class Party
|
6
|
+
include HTTParty
|
7
|
+
|
8
|
+
# nginx that hoptoadapp is under requires Content-length set
|
9
|
+
headers("Content-length" => "0")
|
10
|
+
|
11
|
+
def self.paginate(page = 1)
|
12
|
+
get "/errors.xml", :query => {:page => page}
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.details(id)
|
16
|
+
get "/errors/#{id}.xml"
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.resolve(id)
|
20
|
+
put "/errors/#{id}.xml", :query => {:group => {:resolved => true}}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hoptoadr
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dejan Simic
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-04 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: httparty
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hashie
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description: Unofficial Hoptoad API in Ruby
|
36
|
+
email: desimic@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README.rdoc
|
43
|
+
files:
|
44
|
+
- MIT-LICENCE
|
45
|
+
- README.rdoc
|
46
|
+
- Rakefile
|
47
|
+
- VERSION.yml
|
48
|
+
- hoptoadr.gemspec
|
49
|
+
- lib/hoptoadr.rb
|
50
|
+
- lib/hoptoadr/error.rb
|
51
|
+
- lib/hoptoadr/party.rb
|
52
|
+
has_rdoc: true
|
53
|
+
homepage: http://github.com/dejan/hoptoadr
|
54
|
+
licenses: []
|
55
|
+
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options:
|
58
|
+
- --charset=UTF-8
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.3.5
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: Unofficial Hoptoad API in Ruby
|
80
|
+
test_files: []
|
81
|
+
|