afl_teamwork 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +41 -0
- data/Rakefile +2 -0
- data/afl_teamwork.gemspec +25 -0
- data/app/controllers/lists_controller.rb +12 -0
- data/app/views/lists/show.html.erb +100 -0
- data/lib/afl_teamwork/client.rb +35 -0
- data/lib/afl_teamwork/version.rb +3 -0
- data/lib/afl_teamwork.rb +32 -0
- data/rails/init.rb +1 -0
- metadata +112 -0
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Matt McFarling
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# AflTeamwork
|
2
|
+
|
3
|
+
This gem uses the Teamwork Project Management system to allow clients to request and mark complete development items.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Clone this repo to your local computer.
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'afl_teamwork'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
Create an initializer in your dashboard project in ```config/initializers```. Insert the following:
|
20
|
+
|
21
|
+
AflTeamwork.configure do |config|
|
22
|
+
config.teamwork_name = ENV['TEAMWORK_NAME']
|
23
|
+
config.teamwork_api_key = ENV['TEAMWORK_API_KEY']
|
24
|
+
config.project_id = ENV['TEAMWORK_PROJECT_ID']
|
25
|
+
end
|
26
|
+
|
27
|
+
Add a route:
|
28
|
+
|
29
|
+
map.connect '/lists', :controller => 'lists', :action => "show"
|
30
|
+
|
31
|
+
Updating the plugin from your project directory:
|
32
|
+
|
33
|
+
bundle update afl_teamwork
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
1. Fork it ( https://github.com/analyticsforlawyers/afl_teamwork/fork )
|
38
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
41
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'afl_teamwork/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "afl_teamwork"
|
8
|
+
spec.version = AflTeamwork::VERSION
|
9
|
+
spec.authors = ["Analytics For Lawyers"]
|
10
|
+
spec.email = ["matt@analyticsforlawyers.com"]
|
11
|
+
spec.summary = %q{Gem uses Teamwork to pull in tasklist data.}
|
12
|
+
spec.description = %q{Teamwork task lists integration gem.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.4.2"
|
23
|
+
|
24
|
+
spec.add_dependency "faraday"
|
25
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class ListsController < ApplicationController
|
2
|
+
def show
|
3
|
+
@inbox_items = client.get_list_items("Inbox")
|
4
|
+
@dev_items = client.get_list_items("Development")
|
5
|
+
end
|
6
|
+
|
7
|
+
protected
|
8
|
+
|
9
|
+
def client
|
10
|
+
AflTeamwork::Client.new(AflTeamwork.configuration.teamwork_name, AflTeamwork.configuration.teamwork_api_key)
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
<%- content_for(:header) do -%>
|
2
|
+
<style type="text/css">
|
3
|
+
.task-items{
|
4
|
+
display: block;
|
5
|
+
width:100%;
|
6
|
+
}
|
7
|
+
.task-item{
|
8
|
+
padding:15px 30px 20px;
|
9
|
+
background: #fff;
|
10
|
+
margin-bottom: 20px;
|
11
|
+
border:0;
|
12
|
+
position: relative;
|
13
|
+
-webkit-box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.26);
|
14
|
+
-moz-box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.26);
|
15
|
+
box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.26);
|
16
|
+
}
|
17
|
+
.task-item h1 {
|
18
|
+
margin:0;
|
19
|
+
margin-bottom: 10px;
|
20
|
+
padding:0;
|
21
|
+
font-size:18px;
|
22
|
+
font-weight: 500;
|
23
|
+
}
|
24
|
+
.task-item .task-status {
|
25
|
+
position: absolute;
|
26
|
+
top:15px;
|
27
|
+
right:30px;
|
28
|
+
}
|
29
|
+
.task-item .task-status .tags {
|
30
|
+
margin:0; padding;0;
|
31
|
+
float:left;
|
32
|
+
}
|
33
|
+
.task-item .task-status .tags ul {
|
34
|
+
margin:0; padding;0;
|
35
|
+
}
|
36
|
+
.task-item .task-status .tags ul li{
|
37
|
+
display: block;
|
38
|
+
float: left;
|
39
|
+
background: #bbb;
|
40
|
+
margin:0 5px;
|
41
|
+
list-style-type: none;
|
42
|
+
font-size: 12px;
|
43
|
+
padding:5px 10px;
|
44
|
+
-webkit-border-radius: 7px;
|
45
|
+
-moz-border-radius: 7px;
|
46
|
+
border-radius: 7px;
|
47
|
+
background: #b3daf1;
|
48
|
+
color: #1c5578;
|
49
|
+
font-weight: 700;
|
50
|
+
}
|
51
|
+
|
52
|
+
.task-item .due_date {
|
53
|
+
float:left;
|
54
|
+
display: block;
|
55
|
+
background: #defad8;
|
56
|
+
color: #225d16;
|
57
|
+
font-size: 12px;
|
58
|
+
padding:5px 10px;
|
59
|
+
font-weight: 700;
|
60
|
+
/*-webkit-border-radius: 7px;
|
61
|
+
-moz-border-radius: 7px;
|
62
|
+
border-radius: 7px;*/
|
63
|
+
}
|
64
|
+
.task-item .overdue {
|
65
|
+
background: #f9b993 !important;
|
66
|
+
color: #6e391a !important;
|
67
|
+
}
|
68
|
+
</style>
|
69
|
+
<%- end -%>
|
70
|
+
|
71
|
+
<h1 class='page-subtitle'>Upcoming Task Items:</h1>
|
72
|
+
<hr />
|
73
|
+
<div class="task-items">
|
74
|
+
<% @dev_items.each_with_index do |item, i| %>
|
75
|
+
<div class="task-item">
|
76
|
+
<h1><%= "#{i+1}. #{item['content']}" %></h1>
|
77
|
+
<div class="task-status">
|
78
|
+
<div class="tags">
|
79
|
+
<% if item['tags'] %>
|
80
|
+
<ul>
|
81
|
+
<% item['tags'].each do |tag| %>
|
82
|
+
<li><%= tag['name'].capitalize %></li>
|
83
|
+
<% end %>
|
84
|
+
</ul>
|
85
|
+
<% end %>
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<% if item['due-date'].to_s !='' %>
|
89
|
+
<p class="due_date <%= "overdue" unless Date.parse(item['due-date']) > Date.today %>">
|
90
|
+
Est. Due Date: <%= Date.parse(item['due-date']).strftime("%m/%d/%Y") rescue nil %>
|
91
|
+
</p>
|
92
|
+
<% end %>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
<pre><%= item['description'] %></pre>
|
96
|
+
|
97
|
+
<a href="mailto:brandon@analyticsforlawyers.com?Subject=Update Re: <%= "#{i+1}. #{item['content']}" %>" style="background-image:none;" class="btn btn-small btn-default">Send message</a>
|
98
|
+
</div>
|
99
|
+
<% end %>
|
100
|
+
</div>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
3
|
+
module AflTeamwork
|
4
|
+
class Client
|
5
|
+
def initialize(teamwork_name, api_key)
|
6
|
+
@tw_name = teamwork_name
|
7
|
+
@api_key = api_key
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_list_items(list)
|
11
|
+
project_id = AflTeamwork.configuration.project_id
|
12
|
+
projects = connection.get("/projects/#{project_id}/tasklists.json")
|
13
|
+
tasklists = JSON.parse(projects.body)['tasklists']
|
14
|
+
tasklists.each do |tasklist|
|
15
|
+
if list === tasklist['name']
|
16
|
+
tasklist_id = tasklist['id']
|
17
|
+
todo_items = connection.get("/tasklists/#{tasklist_id}/tasks.json")
|
18
|
+
return JSON.parse(todo_items.body)['todo-items']
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def connection
|
27
|
+
Faraday.new(:url => "https://#{@tw_name}.teamwork.com") do |faraday|
|
28
|
+
faraday.request :basic_auth, @api_key, 'xxx'
|
29
|
+
faraday.request :url_encoded # form-encode POST params
|
30
|
+
#faraday.response :logger # log requests to STDOUT
|
31
|
+
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/afl_teamwork.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "afl_teamwork/version"
|
2
|
+
require 'afl_teamwork/client'
|
3
|
+
|
4
|
+
module AflTeamwork
|
5
|
+
class << self
|
6
|
+
attr_accessor :logger
|
7
|
+
attr_accessor :configuration
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.configure
|
11
|
+
self.configuration ||= Configuration.new
|
12
|
+
yield(configuration)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.logger
|
16
|
+
@logger ||= Logger.new($stdout).tap do |log|
|
17
|
+
log.progname = self.name
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class Configuration
|
22
|
+
attr_accessor :teamwork_name
|
23
|
+
attr_accessor :teamwork_api_key
|
24
|
+
attr_accessor :project_id
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
@teamwork_name = "teamwork-name"
|
28
|
+
@teamwork_api_key = "xxx"
|
29
|
+
@project_id = "123456"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/rails/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'afl_teamwork'
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: afl_teamwork
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Analytics For Lawyers
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2016-08-09 00:00:00 -04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: bundler
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
segments:
|
27
|
+
- 1
|
28
|
+
- 6
|
29
|
+
version: "1.6"
|
30
|
+
prerelease: false
|
31
|
+
type: :development
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rake
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ~>
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
segments:
|
40
|
+
- 10
|
41
|
+
- 4
|
42
|
+
- 2
|
43
|
+
version: 10.4.2
|
44
|
+
prerelease: false
|
45
|
+
type: :development
|
46
|
+
version_requirements: *id002
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: faraday
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
version: "0"
|
56
|
+
prerelease: false
|
57
|
+
type: :runtime
|
58
|
+
version_requirements: *id003
|
59
|
+
description: Teamwork task lists integration gem.
|
60
|
+
email:
|
61
|
+
- matt@analyticsforlawyers.com
|
62
|
+
executables: []
|
63
|
+
|
64
|
+
extensions: []
|
65
|
+
|
66
|
+
extra_rdoc_files: []
|
67
|
+
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- Gemfile
|
71
|
+
- LICENSE.txt
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- afl_teamwork.gemspec
|
75
|
+
- app/controllers/lists_controller.rb
|
76
|
+
- app/views/lists/show.html.erb
|
77
|
+
- lib/afl_teamwork.rb
|
78
|
+
- lib/afl_teamwork/client.rb
|
79
|
+
- lib/afl_teamwork/version.rb
|
80
|
+
- rails/init.rb
|
81
|
+
has_rdoc: true
|
82
|
+
homepage: ""
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
version: "0"
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
version: "0"
|
104
|
+
requirements: []
|
105
|
+
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 1.3.6
|
108
|
+
signing_key:
|
109
|
+
specification_version: 3
|
110
|
+
summary: Gem uses Teamwork to pull in tasklist data.
|
111
|
+
test_files: []
|
112
|
+
|