pivotal-tracker-api 0.1.5 → 0.1.6

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: d076ef0979ef0aebf4912f3aa3ed0b340ae56617
4
- data.tar.gz: a06ea8d52ffa481d0a90c044be227566e972f2ea
3
+ metadata.gz: 560e9d8e7bd5655593e3cd8b1d42411305ad29c2
4
+ data.tar.gz: eeb4255fb00eb9bfffaf6ac4d473c0e3af93ccf8
5
5
  SHA512:
6
- metadata.gz: 854894d31492f4758ae51c1ed4c389d29e8f1d06d676474611b053160b6c46f845120ce07fa10121a3332d6ef67f416b0662009ac497d488fe856e75683344fc
7
- data.tar.gz: 7682da2fd003458cb6dfb7ff655af03d0bc5555eec82b01ac2ab4c730899a35db28b087f691bee4e38b28d41835a1439265f561858289811a370db41d2bafc5d
6
+ metadata.gz: 1bf81cf50034cfbd2f5bef545cfc323c84bf28c1b2ae7851504d67286313a048676dd4bbb0139811ca78bf6445976f207a0cb85564f5ce6e62a132c90d0ca92b
7
+ data.tar.gz: d7b52ae07c22aa081f8e18480f6b8187b81df6f05b0649adae915c8a21fb57be159733db4fca4eecdf12011f0012aedca81b03c87286e2381dab04893812059a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -4,7 +4,8 @@ module Scorer
4
4
  attr_accessor :story, :project_id, :story_id, :id, :text, :author, :created_at, :updated_at, :file_attachments
5
5
 
6
6
  def self.fields
7
- ['person', 'text', 'updated_at', 'id', 'created_at', 'story_id', 'file_attachments']
7
+ ["person(#{Scorer::Person.fields.join(',')})", 'text', 'updated_at', 'id',
8
+ 'created_at', 'story_id', 'file_attachments']
8
9
  end
9
10
 
10
11
  def self.parse_json_comments(json_comments, story)
@@ -7,20 +7,10 @@ module Scorer
7
7
  update_attributes(attributes)
8
8
  end
9
9
 
10
- def self.parse_json_iteration_with_comments(json_iteration)
11
- parse_iteration(json_iteration, true)
12
- end
13
-
14
10
  def self.parse_json_iteration(json_iteration)
15
- parse_iteration(json_iteration, false)
16
- end
17
-
18
- protected
19
-
20
- def self.parse_iteration(json_iteration, with_comments)
21
11
  new({
22
12
  project_id: json_iteration[:project_id].to_i,
23
- stories: parse_stories(json_iteration[:stories], json_iteration[:project_id].to_i, with_comments),
13
+ stories: parse_stories(json_iteration[:stories], json_iteration[:project_id].to_i),
24
14
  story_ids: json_iteration[:story_ids],
25
15
  number: json_iteration[:number],
26
16
  team_strength: json_iteration[:team_strength],
@@ -30,11 +20,13 @@ module Scorer
30
20
  })
31
21
  end
32
22
 
33
- def self.parse_stories(stories, project_id, with_comments)
23
+ protected
24
+
25
+ def self.parse_stories(stories, project_id)
34
26
  story_ids = Array.new
35
27
  stories.each { |story| story_ids << story[:id].to_i if !story[:id].nil? }
36
28
  project = PivotalService.one_project(project_id)
37
- PivotalService.stories(project, true, with_comments, story_ids, Scorer::Story.fields)
29
+ PivotalService.stories(project, true, story_ids, Scorer::Story.fields)
38
30
  end
39
31
 
40
32
  def update_attributes(attrs)
@@ -3,6 +3,10 @@ module Scorer
3
3
 
4
4
  attr_accessor :name, :id, :initials, :email, :username
5
5
 
6
+ def self.fields
7
+ ['name', 'id', 'initials', 'email', 'username']
8
+ end
9
+
6
10
  def initialize(attributes={})
7
11
  update_attributes(attributes)
8
12
  end
@@ -33,7 +33,7 @@ class PivotalService
33
33
  Scorer::Activity.parse_json_activity(json_activity, project_id)
34
34
  end
35
35
 
36
- def iterations(project_id, scope, get_comments, fields=[], limit=1, offset=1)
36
+ def iterations(project_id, scope, fields=[], limit=1, offset=1)
37
37
  return @iteration if !@iteration.nil? && @iteration.project_id == project_id
38
38
 
39
39
  api_url = "/projects/#{project_id}/iterations?"
@@ -46,20 +46,15 @@ class PivotalService
46
46
  api_url = append_fields(api_url, fields)
47
47
  response = Scorer::Client.get_with_caching(api_url)
48
48
  json_iterations = JSON.parse(response, {:symbolize_names => true})
49
- if get_comments
50
- @iteration = Scorer::Iteration.parse_json_iteration_with_comments(json_iterations[0])
51
- else
52
- @iteration = Scorer::Iteration.parse_json_iteration(json_iterations[0])
53
- end
54
- @iteration
49
+ @iteration = Scorer::Iteration.parse_json_iteration(json_iterations[0])
55
50
  end
56
51
 
57
- def all_stories(project_label, project, get_comments, fields=[])
52
+ def all_stories(project_label, project, fields=[])
58
53
  api_url = append_fields('/projects' + "/#{project.id}/stories", fields)
59
54
  api_url = api_url + "&with_label=#{project_label}&with_state=unstarted&limit=100"
60
55
  response = Scorer::Client.get(api_url)
61
56
  json_stories = JSON.parse(response, {:symbolize_names => true})
62
- Scorer::Story.parse_json_stories(json_stories, project.id, get_comments)
57
+ Scorer::Story.parse_json_stories(json_stories, project.id)
63
58
  end
64
59
 
65
60
  def one_story(project_label, project, fields=[])
@@ -70,7 +65,7 @@ class PivotalService
70
65
  Scorer::Story.parse_json_story(json_story, project.id)
71
66
  end
72
67
 
73
- def stories(project, should_cache, get_comments, ids=[], fields=[])
68
+ def stories(project, should_cache, ids=[], fields=[])
74
69
  @stories = Array.new
75
70
  api_url = append_fields('/projects' + "/#{project.id}/stories", fields)
76
71
  api_url = api_url.rindex('?fields=') ? "#{api_url}&filter=id%3A" : "#{api_url}?filter=id%3A"
@@ -82,7 +77,7 @@ class PivotalService
82
77
  response = Scorer::Client.get(api_url)
83
78
  end
84
79
  json_story = JSON.parse(response, {:symbolize_names => true})
85
- @stories << Scorer::Story.parse_json_story(json_story[0], project.id, get_comments)
80
+ @stories << Scorer::Story.parse_json_story(json_story[0], project.id)
86
81
  else
87
82
  story_ids = ''
88
83
  ids.each do |id|
@@ -95,7 +90,7 @@ class PivotalService
95
90
  response = Scorer::Client.get(api_url)
96
91
  end
97
92
  json_stories = JSON.parse(response, {:symbolize_names => true})
98
- @stories = Scorer::Story.parse_json_stories(json_stories, project.id, get_comments)
93
+ @stories = Scorer::Story.parse_json_stories(json_stories, project.id)
99
94
  end
100
95
  end
101
96
 
@@ -14,10 +14,10 @@ module Scorer
14
14
  ['url', 'name', 'description', 'story_type',
15
15
  'estimate', 'current_state', 'requested_by',
16
16
  'owned_by', 'labels', 'integration_id',
17
- 'deadline', 'comments', 'tasks']
17
+ 'deadline', "comments(#{Scorer::Comment.fields.join(',')})", 'tasks']
18
18
  end
19
19
 
20
- def self.parse_json_story(json_story, project_id, get_comments)
20
+ def self.parse_json_story(json_story, project_id)
21
21
  requested_by = json_story[:requested_by][:name] if !json_story[:requested_by].nil?
22
22
  story_id = json_story[:id].to_i
23
23
  estimate = json_story[:estimate] ? json_story[:estimate].to_i : -1
@@ -39,11 +39,7 @@ module Scorer
39
39
  deadline: json_story[:deadline]
40
40
  })
41
41
 
42
- if get_comments
43
- parsed_story.comments = get_story_comments(project_id, parsed_story)
44
- else
45
- parsed_story.comments = Scorer::Comment.parse_json_comments(json_story[:comments], parsed_story)
46
- end
42
+ parsed_story.comments = Scorer::Comment.parse_json_comments(json_story[:comments], parsed_story)
47
43
  parsed_story.has_attachments = false
48
44
  if !parsed_story.comments.nil? && parsed_story.comments.count > 0
49
45
  parsed_story.comments.each do |note|
@@ -57,18 +53,14 @@ module Scorer
57
53
  parsed_story
58
54
  end
59
55
 
60
- def self.parse_json_stories(json_stories, project_id, get_comments)
56
+ def self.parse_json_stories(json_stories, project_id)
61
57
  stories = Array.new
62
58
  json_stories.each do |story|
63
- stories << parse_json_story(story, project_id, get_comments)
59
+ stories << parse_json_story(story, project_id)
64
60
  end
65
61
  stories
66
62
  end
67
63
 
68
- def self.get_story_comments(project_id, story)
69
- PivotalService.comments(project_id, story, Scorer::Comment.fields)
70
- end
71
-
72
64
  def self.parse_tasks(tasks, story)
73
65
  parsed_tasks = Array.new
74
66
  if tasks
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: pivotal-tracker-api 0.1.5 ruby lib
5
+ # stub: pivotal-tracker-api 0.1.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "pivotal-tracker-api"
9
- s.version = "0.1.5"
9
+ s.version = "0.1.6"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["jfox"]
14
- s.date = "2014-01-31"
14
+ s.date = "2014-02-01"
15
15
  s.description = "A ruby gem to communicate with the Picotal Tracker API v5"
16
16
  s.email = "atljeremy@me.com"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal-tracker-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - jfox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-31 00:00:00.000000000 Z
11
+ date: 2014-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client