toolhound-ruby 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/AUTHORS.md +7 -0
- data/CHANGELOG.md +16 -0
- data/Gemfile +10 -0
- data/LICENSE +20 -0
- data/Makefile +15 -0
- data/README.md +208 -0
- data/Rakefile +10 -0
- data/lib/toolhound-ruby.rb +50 -0
- data/lib/toolhound-ruby/authentication.rb +64 -0
- data/lib/toolhound-ruby/base.rb +94 -0
- data/lib/toolhound-ruby/client.rb +113 -0
- data/lib/toolhound-ruby/client/account.rb +14 -0
- data/lib/toolhound-ruby/client/attachments.rb +88 -0
- data/lib/toolhound-ruby/client/bookmarks.rb +39 -0
- data/lib/toolhound-ruby/client/categories.rb +72 -0
- data/lib/toolhound-ruby/client/comments.rb +0 -0
- data/lib/toolhound-ruby/client/companies.rb +76 -0
- data/lib/toolhound-ruby/client/incidents.rb +167 -0
- data/lib/toolhound-ruby/client/notifications.rb +31 -0
- data/lib/toolhound-ruby/client/projects.rb +40 -0
- data/lib/toolhound-ruby/client/users.rb +81 -0
- data/lib/toolhound-ruby/configurable.rb +47 -0
- data/lib/toolhound-ruby/core_ext/string.rb +16 -0
- data/lib/toolhound-ruby/default.rb +57 -0
- data/lib/toolhound-ruby/error.rb +186 -0
- data/lib/toolhound-ruby/incident.rb +75 -0
- data/lib/toolhound-ruby/inventory.rb +19 -0
- data/lib/toolhound-ruby/project.rb +17 -0
- data/lib/toolhound-ruby/version.rb +3 -0
- data/script/bootstrap +5 -0
- data/script/cibuild +5 -0
- data/script/console +15 -0
- data/script/package +7 -0
- data/script/release +16 -0
- data/script/test +0 -0
- data/toolhound-ruby.gemspec +33 -0
- metadata +110 -0
@@ -0,0 +1,75 @@
|
|
1
|
+
module Toolhound
|
2
|
+
|
3
|
+
# Class to parse incident owner and name from
|
4
|
+
# URLs and to generate URLs
|
5
|
+
class Incident
|
6
|
+
attr_accessor :id
|
7
|
+
|
8
|
+
# Instantiate from a incident URL
|
9
|
+
#
|
10
|
+
# @return [Incident]
|
11
|
+
def self.from_url(url)
|
12
|
+
Incident.new(URI.parse(url).path[1..-1])
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def initialize(incident)
|
17
|
+
case incident
|
18
|
+
# when Integer
|
19
|
+
# @id = incident
|
20
|
+
when String
|
21
|
+
@id = incident
|
22
|
+
# @owner, @name = repo.split('/')
|
23
|
+
# unless @owner && @name
|
24
|
+
# raise ArgumentError, "Invalid Incident. Use user/repo format."
|
25
|
+
# end
|
26
|
+
when Incident
|
27
|
+
@id = incident.id
|
28
|
+
# @name = repo.name
|
29
|
+
when Hash
|
30
|
+
@id = incident[:incident] ||= incident[:id]
|
31
|
+
# @owner = repo[:owner] ||= repo[:user] ||= repo[:username]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Incident owner/name
|
36
|
+
# @return [String]
|
37
|
+
def slug
|
38
|
+
# "#{@owner}/#{@name}"
|
39
|
+
end
|
40
|
+
alias :to_s :slug
|
41
|
+
|
42
|
+
# @return [String] Incident API path
|
43
|
+
def path
|
44
|
+
# return named_api_path if @owner && @name
|
45
|
+
return id_api_path if @id
|
46
|
+
end
|
47
|
+
|
48
|
+
# Get the api path for a repo
|
49
|
+
# @param incident [Integer, String, Hash, Incident] A incident.
|
50
|
+
# @return [String] Api path.
|
51
|
+
def self.path(incident)
|
52
|
+
new(incident).path
|
53
|
+
end
|
54
|
+
|
55
|
+
# @return [String] Api path for owner/name identified repos
|
56
|
+
# def named_api_path
|
57
|
+
# "repos/#{slug}"
|
58
|
+
# end
|
59
|
+
|
60
|
+
# @return [String] Api path for id identified incidents
|
61
|
+
def id_api_path
|
62
|
+
"incidents/#{@id}"
|
63
|
+
end
|
64
|
+
|
65
|
+
# Incident URL based on {Nearmiss::Client#web_endpoint}
|
66
|
+
# @return [String]
|
67
|
+
# def url
|
68
|
+
# "#{Octokit.web_endpoint}#{slug}"
|
69
|
+
# end
|
70
|
+
|
71
|
+
# alias :user :owner
|
72
|
+
# alias :username :owner
|
73
|
+
# alias :repo :name
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# INNER JOIN tblInventoryID AS iid ON iid.intInventoryIdID = rc.intInventoryIDID
|
2
|
+
# INNER JOIN tblInventory AS iv ON iid.intInventoryID = iv.intInventoryID
|
3
|
+
# INNER JOIN tblInventoryText AS ivt ON iv.intInventoryID = ivt.intInventoryID
|
4
|
+
module Toolhound
|
5
|
+
|
6
|
+
# Class to parse GitHub repository owner and name from
|
7
|
+
# URLs and to generate URLs
|
8
|
+
class Inventory < Base
|
9
|
+
# attr_accessor :owner, :name, :id
|
10
|
+
|
11
|
+
self.table_name = "tblInventory"
|
12
|
+
self.primary_key = "intInventoryID"
|
13
|
+
|
14
|
+
# includes :tblInventoryText,
|
15
|
+
# rename_attributes intLocationID: 'location_id'
|
16
|
+
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Toolhound
|
2
|
+
|
3
|
+
# Class to parse GitHub repository owner and name from
|
4
|
+
# URLs and to generate URLs
|
5
|
+
class Project < Base
|
6
|
+
attr_accessor :owner, :name, :id
|
7
|
+
|
8
|
+
self.table_name = "tblLocation"
|
9
|
+
self.primary_key = "intLocationID"
|
10
|
+
|
11
|
+
# rename_attributes intLocationID: 'location_id'
|
12
|
+
def inventory_items
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
data/script/bootstrap
ADDED
data/script/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
dir=`pwd`
|
6
|
+
|
7
|
+
echo "===> Bundling..."
|
8
|
+
script/bootstrap --quiet
|
9
|
+
|
10
|
+
export TOOLHOUND_USERNAME='mklooth'
|
11
|
+
export TOOLHOUND_PASSWORD='ToolHound'
|
12
|
+
export TOOLHOUND_DATASERVER='pbssrvr\sqlexpress'
|
13
|
+
|
14
|
+
echo "===> Launching..."
|
15
|
+
bundle console
|
data/script/package
ADDED
data/script/release
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
# Usage: script/release
|
3
|
+
# Build the package, tag a commit, push it to origin, and then release the
|
4
|
+
# package publicly.
|
5
|
+
|
6
|
+
set -e
|
7
|
+
|
8
|
+
version="$(script/package | grep Version: | awk '{print $2}')"
|
9
|
+
[ -n "$version" ] || exit 1
|
10
|
+
|
11
|
+
echo $version
|
12
|
+
git commit --allow-empty -a -m "Release $version"
|
13
|
+
git tag "v$version"
|
14
|
+
git push origin
|
15
|
+
git push origin "v$version"
|
16
|
+
gem push pkg/*-${version}.gem
|
data/script/test
ADDED
File without changes
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'toolhound-ruby/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{toolhound-ruby}
|
8
|
+
s.version = Toolhound::VERSION.dup
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.license = 'MIT'
|
11
|
+
|
12
|
+
s.authors = ["Markus Klooth"]
|
13
|
+
s.date = Time.now.strftime "%Y-%m-%d"
|
14
|
+
s.description = %q{A wrapper around the nearmissapp.com API.}
|
15
|
+
s.email = %q{support@nearmissapp.com}
|
16
|
+
s.extra_rdoc_files = ["README.md"]
|
17
|
+
s.files = `git ls-files -z`.split("\x0")
|
18
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
s.homepage = %q{https://github.com/nearmiss/nearmiss-ruby}
|
20
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
s.rubyforge_project = %q{toolhound-ruby}
|
23
|
+
s.rubygems_version = %q{1.3.5}
|
24
|
+
s.summary = %q{A wrapper around Toolhound API.}
|
25
|
+
s.test_files = Dir.glob("spec/**/*")
|
26
|
+
|
27
|
+
s.required_ruby_version = '>= 1.9.3'
|
28
|
+
|
29
|
+
# s.add_dependency("sawyer", ">= 0.5.5")
|
30
|
+
# s.add_dependency("multi_json", '>= 1.3.0')
|
31
|
+
s.add_dependency("tiny_tds", ">= 0.7")
|
32
|
+
s.add_development_dependency 'bundler', '~> 1.0'
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: toolhound-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Markus Klooth
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: tiny_tds
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
description: A wrapper around the nearmissapp.com API.
|
42
|
+
email: support@nearmissapp.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files:
|
46
|
+
- README.md
|
47
|
+
files:
|
48
|
+
- AUTHORS.md
|
49
|
+
- CHANGELOG.md
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE
|
52
|
+
- Makefile
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- lib/toolhound-ruby.rb
|
56
|
+
- lib/toolhound-ruby/authentication.rb
|
57
|
+
- lib/toolhound-ruby/base.rb
|
58
|
+
- lib/toolhound-ruby/client.rb
|
59
|
+
- lib/toolhound-ruby/client/account.rb
|
60
|
+
- lib/toolhound-ruby/client/attachments.rb
|
61
|
+
- lib/toolhound-ruby/client/bookmarks.rb
|
62
|
+
- lib/toolhound-ruby/client/categories.rb
|
63
|
+
- lib/toolhound-ruby/client/comments.rb
|
64
|
+
- lib/toolhound-ruby/client/companies.rb
|
65
|
+
- lib/toolhound-ruby/client/incidents.rb
|
66
|
+
- lib/toolhound-ruby/client/notifications.rb
|
67
|
+
- lib/toolhound-ruby/client/projects.rb
|
68
|
+
- lib/toolhound-ruby/client/users.rb
|
69
|
+
- lib/toolhound-ruby/configurable.rb
|
70
|
+
- lib/toolhound-ruby/core_ext/string.rb
|
71
|
+
- lib/toolhound-ruby/default.rb
|
72
|
+
- lib/toolhound-ruby/error.rb
|
73
|
+
- lib/toolhound-ruby/incident.rb
|
74
|
+
- lib/toolhound-ruby/inventory.rb
|
75
|
+
- lib/toolhound-ruby/project.rb
|
76
|
+
- lib/toolhound-ruby/version.rb
|
77
|
+
- script/bootstrap
|
78
|
+
- script/cibuild
|
79
|
+
- script/console
|
80
|
+
- script/package
|
81
|
+
- script/release
|
82
|
+
- script/test
|
83
|
+
- toolhound-ruby.gemspec
|
84
|
+
homepage: https://github.com/nearmiss/nearmiss-ruby
|
85
|
+
licenses:
|
86
|
+
- MIT
|
87
|
+
metadata: {}
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options:
|
90
|
+
- "--charset=UTF-8"
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 1.9.3
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project: toolhound-ruby
|
105
|
+
rubygems_version: 2.2.2
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: A wrapper around Toolhound API.
|
109
|
+
test_files: []
|
110
|
+
has_rdoc:
|