overview 0.0.6.pre.24 → 0.0.7.pre.26

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWNiYjZhYjBmYmU5NWQ0YjM3ZmI4NzQ3OWFjZTcyYWExODg1ZWU0NQ==
4
+ NDRhOTg3NzQyNGU5YmJjOTdkZjg0NGIzYjMzMDdkNzkwM2JiNzdiZQ==
5
5
  data.tar.gz: !binary |-
6
- ZjhlNGRkZTE1N2EwYTg3OGQ4OTgwY2Y3MWQyYzc3ZDhmZGIyYzNjYg==
6
+ NTI1YTI4ODA4ZmQwYTY0ZGE5NGRiZmM1ZDdkZjgzYmZkZWQzODI4ZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjBiZDA5OTIzODZjN2IxZTkwYzZmZDViYWMyMDUwZWU2ZjI1YTg1ZGZkYmVj
10
- YzVjMWI2OTI4ZTMzYjViMmU0YjQ4YWYzMmM0NDVmNjE5NDAxNjRmYjhiM2Ew
11
- ZGNkMTZlNjBlMmNkNzMyYjY4YTM4N2EwMjNmY2ZlZWIxMjZhZDk=
9
+ YjgxZTE3YWRlZDFlZmY5NjNjNGQ2NmJlNWRmM2QyMDk2Nzk3NWU3MzJjYWFm
10
+ M2Y0ZDBjM2IxYzdjZmEzMzVlODYwMWFiZDgzZDk5OWIxOTU0MmNiODMwODNm
11
+ NzA5NWRhZjExNzAxYTMyMTlhYTk4ZjQwY2NlNGJlNzkwYTg0NTM=
12
12
  data.tar.gz: !binary |-
13
- YzcyNmM4ZWMyYWM1OTIwMjQyMTQyZmQ1MjZiN2QwNzVjYmY3YzUzZDkyM2Q3
14
- YzEwOTBiZWJmNzczOWI0NmI3YTFiMWNlYjdmOGRmZDYxNTIzMThlNDE5NGJk
15
- ZmI3MWIzMTYzYTY4ODk1ODdkNzc5YzVmMzQ5NzZjMmRjY2MzMWY=
13
+ Yjk5MTk1M2UyMzQxODFhMzE3NTFmMTU5Nzg1M2JlMzg1OGQ3ODNjMWYyYzY2
14
+ MzViMmNlNzdiMWYyNDY5MjkxNWRlZmQ0OGQ1NWY1YTRiMjQ0NWQxNDg5YzFh
15
+ MjZiOTM4NTFjNzg2OTU0Y2I2OGE4NjQ2YjUzMDgxY2MyZGVjYTU=
@@ -5,12 +5,10 @@ module Helpers
5
5
  end
6
6
 
7
7
  def get(request)
8
- p "get cache"
9
8
  @memory[request]
10
9
  end
11
10
 
12
11
  def set(request, response)
13
- p "set cache"
14
12
  @memory[request] = response
15
13
  end
16
14
  end
@@ -10,6 +10,21 @@ module Helpers
10
10
  end
11
11
  end
12
12
 
13
+ class SprintlyEmbeddedURL < String
14
+ def initialize(s)
15
+ super s
16
+ end
17
+
18
+ def to_s
19
+ inspect
20
+ end
21
+
22
+ def inspect
23
+ return "<#{self}|#{self}>"
24
+ end
25
+ end
26
+
27
+
13
28
  class SprintlyItem
14
29
  require 'uri'
15
30
 
@@ -21,6 +36,7 @@ module Helpers
21
36
  attr_accessor :id
22
37
  attr_accessor :hackpads
23
38
  attr_accessor :url
39
+ attr_accessor :parent
24
40
 
25
41
 
26
42
  HACKPADURL = "hackpad.com"
@@ -40,27 +56,19 @@ module Helpers
40
56
  @status = json["status"]
41
57
  @author = author
42
58
  @url = json["short_url"]
59
+ @parent = SprintlyItem.new(json["parent"]) if json["parent"]
43
60
 
44
61
  urls = URI.extract(@description)
45
- urls.select! { |u| u.include?(HACKPADURL)}
62
+ @hackpads = urls.select { |u| u.include?(HACKPADURL)}.collect {|u| SprintlyEmbeddedURL.new(u)}
46
63
 
47
- @hackpads = urls
48
- # json["deployed_to"])
64
+ end
49
65
 
50
- # @title = title.delete("\n")
51
- # @description = description
52
- # @sha = sha
53
- # @date = date
54
- # @id = id
55
- # @source = source
56
- # @type = type
57
- # @status = status
58
- # @author = author
59
- # @environments = environments
66
+ def to_s
67
+ inspect
60
68
  end
61
69
 
62
70
  def inspect
63
- "<#{@source} #{@type.upcase} ##{@id} : #{self.status} : #{@title}>"
71
+ return "<#{url}|##{@id} - #{@title}>"
64
72
  end
65
73
 
66
74
  def environments
@@ -90,6 +98,24 @@ module Helpers
90
98
  def released?
91
99
  return self.environments.join.scan(/v(\d+)/).any? unless self.environments.nil?
92
100
  end
101
+
102
+ def is_story?
103
+ return @type.upcase == "STORY"
104
+ end
105
+
106
+ def all_hackpads
107
+ hackpads = Array.new
108
+ hackpads.push(self.hackpads)
109
+ hackpads.push(self.parent.all_hackpads) if self.parent
110
+ return hackpads.flatten.uniq
111
+ end
112
+
113
+ def all_items
114
+ items = Array.new
115
+ items.push(self)
116
+ items.push(self.parent) if self.parent
117
+ return items.flatten.uniq
118
+ end
93
119
  end
94
120
 
95
121
  class Sprintly < Base
@@ -105,7 +131,7 @@ module Helpers
105
131
 
106
132
  end
107
133
 
108
- def sprintlyItem(id)
134
+ def sprintly_item(id)
109
135
 
110
136
  url = @end_point + @product_id.to_s + "/items/" + id.to_s + ".json"
111
137
  response = Typhoeus::Request.get(url, userpwd: @auth)
@@ -1,3 +1,3 @@
1
1
  module Overview
2
- VERSION = '0.0.6.pre.24'
2
+ VERSION = '0.0.7.pre.26'
3
3
  end
@@ -263,8 +263,7 @@ RSpec.describe 'Sprintly#retrieveSprintlyItem' do
263
263
  it 'returns hackpad item' do
264
264
  cache = Cache.new
265
265
  sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
266
- item = sprintly.sprintlyItem(1)
267
-
266
+ item = sprintly.sprintly_item(1)
268
267
  expect(item.hackpads.count).to eq(1)
269
268
  end
270
269
  end
@@ -273,24 +272,84 @@ RSpec.describe 'Sprintly#retrieveSprintlyItem' do
273
272
  it 'returns sprintly item with id' do
274
273
  cache = Cache.new
275
274
  sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
276
- item = sprintly.sprintlyItem(1)
277
- item = sprintly.sprintlyItem(1)
278
-
275
+ item = sprintly.sprintly_item(1)
279
276
  expect(item.id).to eq(1)
280
277
  end
281
278
  end
282
279
 
283
- RSpec.describe 'Sprintly#retrieveSprintlyItem' do
284
- it 'returns hackpad item' do
280
+ RSpec.describe 'Sprintly#retrieveSprintlyItem.allHackpads' do
281
+ it 'returns single hackpad item' do
285
282
  cache = Cache.new
286
283
  sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
287
- item = sprintly.sprintlyItem(1)
284
+ item = sprintly.sprintly_item(2)
285
+ expect(item.hackpads.count).to eq(0)
286
+ expect(item.all_hackpads.count).to eq(1)
287
+ end
288
+ end
288
289
 
290
+ RSpec.describe 'Sprintly#retrieveSprintlyItem.allHackpads' do
291
+ it 'returns multiple hackpad items' do
292
+ cache = Cache.new
293
+ sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
294
+ item = sprintly.sprintly_item(4)
289
295
  expect(item.hackpads.count).to eq(1)
296
+ expect(item.all_hackpads.count).to eq(2)
297
+ end
298
+ end
299
+
300
+
301
+ RSpec.describe 'Sprintly#retrieveSprintlyItem.inspect' do
302
+ it 'returns beautiful description' do
303
+ cache = Cache.new
304
+ sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
305
+ item = sprintly.sprintly_item(4)
306
+ expect(item.inspect).to eq("<http://sprint.ly/i/30420/4/|#4 - This has a hackpad link>")
290
307
  end
291
308
  end
292
309
 
310
+ RSpec.describe 'Sprintly#retrieveSprintlyItem.all_items' do
311
+ it 'returns single item' do
312
+ cache = Cache.new
313
+ sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
314
+ item = sprintly.sprintly_item(1)
315
+ expect(item.all_items.count).to eq(1)
316
+ end
317
+ end
293
318
 
319
+ RSpec.describe 'Sprintly#retrieveSprintlyItem.all_items' do
320
+ it 'returns mutliple items' do
321
+ cache = Cache.new
322
+ sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
323
+ item = sprintly.sprintly_item(4)
324
+ expect(item.all_items.count).to eq(2)
325
+ end
326
+ end
327
+
328
+ RSpec.describe 'Sprintly#retrieveSprintlyItem.isStory?' do
329
+ it 'returns story' do
330
+ cache = Cache.new
331
+ sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
332
+ item = sprintly.sprintly_item(1)
333
+ expect(item.is_story?).to eq(true)
334
+ end
335
+ end
336
+
337
+ RSpec.describe 'Sprintly#retrieveSprintlyItem.isStory?' do
338
+ it 'returns subtask' do
339
+ cache = Cache.new
340
+ sprintly = Sprintly.new(30420,"jono+overview+test@overllc.com", "kPnNLnM8pjkYeS9sMvrQPhj6JkC4mcNL", cache)
341
+ item = sprintly.sprintly_item(2)
342
+ expect(item.is_story?).to eq(false)
343
+ end
344
+ end
345
+
346
+ RSpec.describe 'SprintlyEmbeddedURL#new' do
347
+ it 'returns SprintlyEmbeddedURL' do
348
+ url = SprintlyEmbeddedURL.new("https://hackpad.com/Hackpad-FAQ-tq56fI63mz3")
349
+ expect(url.to_s).to eq("<https://hackpad.com/Hackpad-FAQ-tq56fI63mz3|https://hackpad.com/Hackpad-FAQ-tq56fI63mz3>")
350
+ end
351
+ end
352
+ SprintlyEmbeddedURL
294
353
 
295
354
 
296
355
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: overview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6.pre.24
4
+ version: 0.0.7.pre.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Orford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-10 00:00:00.000000000 Z
11
+ date: 2015-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake