zensana 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92d157593d5d791cb3d34056174ec0e4a5b988a4
4
- data.tar.gz: 4714d4d78693dc7767bb575616cc678e6c3152dc
3
+ metadata.gz: b94c9bb7aedae5805ed90054a3a565bb872d4c73
4
+ data.tar.gz: bfc11506fedbc028540e80e809dcd6ff58b2def4
5
5
  SHA512:
6
- metadata.gz: d5d8fa90f895486c9a4c4bb07f4de2d2728889a020304fcec11d66e1a06c35df71faa778841be21e4b3c6b974e989c403908e3d07ae263f39f3c8362e7ced95d
7
- data.tar.gz: a6a5709d63a02a81ae08dd85904b4b6db2d0f8a3caa31ac7199ae7043e7b36e16388fc4cd6d8ec6567c115b5c4268c3d3d61821893cfe331f2e2c932e50c72fd
6
+ metadata.gz: 4e9f316b42b0ab2bfca14c28d8b31fdf88ad6cf3273cc6dbb06dd62e39bd6e9551ad3878a4465dea6b6ef536839fc68d8719a81b3b9251e1c8a5b70c7228ecd3
7
+ data.tar.gz: 9c9dba2fd5d2f4bab8b28c36f60adabdf29cc655932802791ab8c122e378e27a0921147cf40c507c0ec534398ecc76f45b77b7507af7df2a38969dbbc3663266
@@ -157,15 +157,6 @@ using options #{options}
157
157
  end
158
158
  end
159
159
 
160
- # if assignee is not an agent then leave unassigned
161
- if (assignee_key = options[:default_user] || task.attributes['assignee'])
162
- if (assignee = asana_to_zendesk_user(assignee_key, false))
163
- unless assignee.attributes && assignee.attributes['role'] != 'end-user'
164
- assignee = nil
165
- end
166
- end
167
- end
168
-
169
160
  # ready to import the ticket now!
170
161
  ticket = Zensana::Zendesk::Ticket.new(
171
162
  :requester_id => requester.id,
@@ -180,7 +171,7 @@ using options #{options}
180
171
 
181
172
  Task attributes: #{task.attributes}
182
173
  EOF
183
- :assignee_id => assignee ? assignee.id : nil,
174
+ :assignee_id => zendesk_assignee_id(task),
184
175
  :created_at => task.created_at,
185
176
  :tags => flatten_tags(project_tags, section_tags),
186
177
  :comments => comments
@@ -226,6 +217,21 @@ using options #{options}
226
217
  zendesk
227
218
  end
228
219
 
220
+ # lookup the asana task assignee in zendesk and
221
+ # return their id if they are an agent or admin
222
+ #
223
+ def zendesk_assignee_id(task)
224
+ assignee_id = nil
225
+ if (assignee_key = options[:default_user] || task.attributes['assignee'])
226
+ if (assignee = asana_to_zendesk_user(assignee_key, false))
227
+ if assignee.attributes && assignee.attributes['role'] != 'end-user'
228
+ assignee_id = assignee.attributes['id']
229
+ end
230
+ end
231
+ end
232
+ assignee_id
233
+ end
234
+
229
235
  # download the attachments to the local file system
230
236
  # and retry a few times because internet
231
237
  # the download process is restartable (idempotent)
@@ -292,7 +298,7 @@ using options #{options}
292
298
  end
293
299
 
294
300
  def normalize_it(thing)
295
- thing.gsub(/(\/| |-)+/,'_').downcase
301
+ thing.downcase.gsub(/([^a-z0-9])+/,'_')
296
302
  end
297
303
  end
298
304
  end
@@ -13,11 +13,6 @@ module Zensana
13
13
  download_file unless downloaded?
14
14
  end
15
15
 
16
- def download!
17
- File.delete full_path if downloaded?
18
- download_file
19
- end
20
-
21
16
  def downloaded?
22
17
  File.exist? full_path
23
18
  end
@@ -15,8 +15,6 @@ module Zensana
15
15
 
16
16
  def initialize(attributes)
17
17
  validate_keys attributes
18
- #id = attributes['author_id']
19
- #raise NotFound, "Author #{id} does not exist" unless author_exists?(id)
20
18
  @attributes = attributes
21
19
  end
22
20
 
@@ -1,3 +1,3 @@
1
1
  module Zensana
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
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.1.1
4
+ version: 1.1.2
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-17 00:00:00.000000000 Z
11
+ date: 2015-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httmultiparty