zensana 1.2.0 → 1.3.0
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.
- checksums.yaml +4 -4
- data/lib/zensana/cli.rb +3 -0
- data/lib/zensana/commands/group.rb +9 -0
- data/lib/zensana/commands/project.rb +10 -7
- data/lib/zensana/models/asana/task.rb +1 -5
- data/lib/zensana/models/zendesk/group.rb +22 -0
- data/lib/zensana/version.rb +1 -1
- data/lib/zensana.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08db9404392b3ccfc2461bc38d4a1af86648b687
|
4
|
+
data.tar.gz: 92153952d8bc3dd0b0f6f1d744e94697ba91da78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed052c75b1b0dcabe04002ba5c6ed34ec4bc23e9089c894fd576496b556a63d29ae77c84a20e1df1b1c7eadf3baeef37109b10009526b5754ba7a03d05631ebb
|
7
|
+
data.tar.gz: a0a5a7ccec8ff22f843849d49c7548dd6cc6e9c454193d7e1d79f099d6a9909bcc187668c7ea8a8b1e2ec362780db094c47e68e237bc8c3f254516804bd963c3
|
data/lib/zensana/cli.rb
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
module Zensana
|
2
|
+
class Command::Group < Zensana::Command
|
3
|
+
|
4
|
+
desc 'find GROUP', 'List ZenDesk agent groups that match GROUP (by ID or NAME, regexp accepted)'
|
5
|
+
def find(name)
|
6
|
+
puts Zensana::Zendesk::Group.search(name).collect { |p| "#{p['id']}: #{p['name']}" }.sort
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -5,7 +5,7 @@ module Zensana
|
|
5
5
|
|
6
6
|
desc 'find PROJECT', 'List projects that match PROJECT (by ID or NAME, regexp accepted)'
|
7
7
|
def find(name)
|
8
|
-
puts Zensana::Asana::Project.search(name).collect { |p| p['name'] }.sort
|
8
|
+
puts Zensana::Asana::Project.search(name).collect { |p| "#{p['id']}: #{p['name']}" }.sort
|
9
9
|
end
|
10
10
|
|
11
11
|
desc 'show PROJECT', 'Display details of PROJECT (choosing from list matching ID or NAME, regexp accepted)'
|
@@ -32,6 +32,7 @@ module Zensana
|
|
32
32
|
option :attachments, type: 'boolean', aliases: '-a', default: true, desc: 'download and upload any attachments'
|
33
33
|
option :completed, type: 'boolean', aliases: '-c', default: false, desc: 'include tasks that are completed'
|
34
34
|
option :global_tags, type: 'array', aliases: '-t', default: ['zensana'], desc: 'array of tag(s) to be applied to every ticket imported'
|
35
|
+
option :group_id, type: 'numeric', aliases: '-g', default: nil, desc: 'ZenDesk group_id to assign tickets to - must not conflict with default_user'
|
35
36
|
option :stories, type: 'boolean', aliases: '-s', default: true, desc: 'import stories as comments'
|
36
37
|
option :default_user, type: 'string', aliases: '-u', default: nil, desc: 'set a default user to assign to invalid asana user items'
|
37
38
|
option :verified, type: 'boolean', aliases: '-v', default: true, desc: '`false` will send email to zendesk users created'
|
@@ -79,8 +80,8 @@ using options #{options}
|
|
79
80
|
project_tags = [] << tags
|
80
81
|
section_tags = []
|
81
82
|
|
82
|
-
@asana_project.
|
83
|
-
task_to_ticket task, project_tags, section_tags
|
83
|
+
@asana_project.task_list.each do |task|
|
84
|
+
task_to_ticket task['id'], project_tags, section_tags
|
84
85
|
end
|
85
86
|
say "\n\n ---> Finished!\n\n", :green
|
86
87
|
end
|
@@ -115,10 +116,11 @@ using options #{options}
|
|
115
116
|
end
|
116
117
|
end
|
117
118
|
|
118
|
-
# convert
|
119
|
+
# convert an asana task into a zendesk ticket
|
119
120
|
# calls itself recursively for subtasks
|
120
121
|
#
|
121
|
-
def task_to_ticket(
|
122
|
+
def task_to_ticket(task_id, project_tags, section_tags )
|
123
|
+
task = Zensana::Asana::Task.new(task_id)
|
122
124
|
if task.attributes['completed'] && !options[:completed]
|
123
125
|
say "\nSkipping completed task: #{task.name}! ", :yellow
|
124
126
|
return
|
@@ -187,6 +189,7 @@ using options #{options}
|
|
187
189
|
Task attributes: #{task.attributes}
|
188
190
|
EOF
|
189
191
|
:assignee_id => zendesk_assignee_id(task.attributes['assignee']),
|
192
|
+
:group_id => options[:group_id],
|
190
193
|
:created_at => task.created_at,
|
191
194
|
:tags => flatten_tags(project_tags, section_tags),
|
192
195
|
:comments => comments
|
@@ -197,9 +200,9 @@ using options #{options}
|
|
197
200
|
|
198
201
|
# rinse and repeat for subtasks and their subtasks and ...
|
199
202
|
# we create a new section tag list for each recursed level
|
200
|
-
sub_section_tags = []
|
203
|
+
sub_section_tags = section_tags.dup << []
|
201
204
|
task.subtasks.each do |sub|
|
202
|
-
task_to_ticket
|
205
|
+
task_to_ticket sub.attributes['id'], project_tags, sub_section_tags
|
203
206
|
end
|
204
207
|
|
205
208
|
# this task's tags are now no longer required
|
@@ -15,7 +15,7 @@ module Zensana
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def tags
|
18
|
-
attributes['tags'].map { |t|
|
18
|
+
attributes['tags'].map { |t| t['name'] } if attributes['tags']
|
19
19
|
end
|
20
20
|
|
21
21
|
def is_section?
|
@@ -77,10 +77,6 @@ module Zensana
|
|
77
77
|
def opt_fields
|
78
78
|
FIELDS.map { |f| f.to_s }.join(',')
|
79
79
|
end
|
80
|
-
|
81
|
-
def snake_case(string)
|
82
|
-
string.gsub(/(.)([A-Z])/,'\1_\2').downcase
|
83
|
-
end
|
84
80
|
end
|
85
81
|
end
|
86
82
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Zensana
|
2
|
+
class Zendesk
|
3
|
+
class Group
|
4
|
+
include Zensana::Zendesk::Access
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
def list
|
9
|
+
@@list ||= Zensana::Zendesk.inst.fetch('/groups.json')['groups']
|
10
|
+
end
|
11
|
+
|
12
|
+
def search(spec)
|
13
|
+
list.select { |g| g.to_s =~ %r{#{spec}} }
|
14
|
+
rescue RegexpError
|
15
|
+
raise BadSearch, "'#{spec}' is not a valid regular expression"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/zensana/version.rb
CHANGED
data/lib/zensana.rb
CHANGED
@@ -13,10 +13,12 @@ require 'zensana/models/asana/task'
|
|
13
13
|
require 'zensana/models/asana/user'
|
14
14
|
require 'zensana/models/zendesk/attachment'
|
15
15
|
require 'zensana/models/zendesk/comment'
|
16
|
+
require 'zensana/models/zendesk/group'
|
16
17
|
require 'zensana/models/zendesk/ticket'
|
17
18
|
require 'zensana/models/zendesk/user'
|
18
19
|
|
19
20
|
require 'zensana/command'
|
21
|
+
require 'zensana/commands/group'
|
20
22
|
require 'zensana/commands/project'
|
21
23
|
require 'zensana/cli'
|
22
24
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zensana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Warren Bain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httmultiparty
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/zensana.rb
|
144
144
|
- lib/zensana/cli.rb
|
145
145
|
- lib/zensana/command.rb
|
146
|
+
- lib/zensana/commands/group.rb
|
146
147
|
- lib/zensana/commands/project.rb
|
147
148
|
- lib/zensana/models/asana/attachment.rb
|
148
149
|
- lib/zensana/models/asana/project.rb
|
@@ -150,6 +151,7 @@ files:
|
|
150
151
|
- lib/zensana/models/asana/user.rb
|
151
152
|
- lib/zensana/models/zendesk/attachment.rb
|
152
153
|
- lib/zensana/models/zendesk/comment.rb
|
154
|
+
- lib/zensana/models/zendesk/group.rb
|
153
155
|
- lib/zensana/models/zendesk/ticket.rb
|
154
156
|
- lib/zensana/models/zendesk/user.rb
|
155
157
|
- lib/zensana/services/asana.rb
|