pivotal-tracker-api 0.1.3 → 0.1.4

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec4113fd877a3f6412585278193c64114bc53529
4
- data.tar.gz: 0c48160b2eba2e5ea807f723dbd2fb2dacb79514
3
+ metadata.gz: 415392ce30293d0f4806f3d0725c003354c98a6f
4
+ data.tar.gz: 4da04a3fd9e24bfc219377c119fd33fe4f56682d
5
5
  SHA512:
6
- metadata.gz: 2a60363ee4d3558f2422591659cbb1875796cd6597ab6dd139f1c0aef79a5735de7087bbab05a246d90cf7fbcdc5718fe61f4e1bc916280cdbe99ef00b824129
7
- data.tar.gz: 24a7538caed3da39fdb66acfde8e8757d6bcc5d6db2081b6aaa2fe0e7434d73bb2c90e78083af5d9cf718d32f8d2fd5df2ca4aa5db71bd0441ede5fa7384a938
6
+ metadata.gz: 1ea6a1c9d0fa27060ea056ce50a83e5c7b99554ab6e2ca93b1355658ca352b0e0d38cb018621cdbfbc087503f93fd278a74ed1279294611cc4d75ea157491cbe
7
+ data.tar.gz: f7f678dc7cf94b8fba301ebd4a647191f6cacd4a6ca694b76d511420c8f984179973fd1f5f1b755f9f1e49e7c795778cf597dedd971ffadef30f6acce933126c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -1,7 +1,30 @@
1
1
  module Scorer
2
2
  class Attachment
3
3
 
4
- attr_accessor :status, :url, :filename, :id, :description, :uploaded_at, :uploaded_by
4
+ attr_accessor :filename, :id, :created_at, :uploaded_by, :big_url,
5
+ :width, :height, :download_url, :thumbnail_url, :size, :content_type
6
+
7
+ def self.parse_attachments(attachments)
8
+ parsed_attachments = Array.new
9
+ if attachments
10
+ attachments.each do |file|
11
+ parsed_attachments << new({
12
+ id: file[:id].to_i,
13
+ filename: file[:filename],
14
+ created_at: file[:created_at],
15
+ uploaded_by: file[:uploaded_by],
16
+ big_url: file[:big_url],
17
+ width: file[:width],
18
+ height: file[:height],
19
+ download_url: file[:download_url],
20
+ thumbnail_url: file[:thumbnail_url],
21
+ size: file[:size],
22
+ content_type: file[:content_type]
23
+ })
24
+ end
25
+ end
26
+ parsed_attachments
27
+ end
5
28
 
6
29
  def initialize(attributes={})
7
30
  update_attributes(attributes)
@@ -11,7 +34,7 @@ module Scorer
11
34
 
12
35
  def update_attributes(attrs)
13
36
  attrs.each do |key, value|
14
- self.send("#{key}=", value.is_a?(Array) ? value.join(',') : value )
37
+ self.send("#{key}=", value)
15
38
  end
16
39
  end
17
40
 
@@ -1,10 +1,10 @@
1
1
  module Scorer
2
2
  class Comment
3
3
 
4
- attr_accessor :story, :project_id, :story_id, :id, :text, :author, :created_at, :updated_at
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']
7
+ ['person', 'text', 'updated_at', 'id', 'created_at', 'story_id', 'file_attachments']
8
8
  end
9
9
 
10
10
  def self.parse_json_comments(json_comments, story)
@@ -14,12 +14,17 @@ module Scorer
14
14
  if comment[:person]
15
15
  person = Scorer::Person.parse_json_person(comment[:person])
16
16
  end
17
+ file_attachments = Array.new
18
+ if comment[:file_attachments]
19
+ file_attachments = Scorer::Attachment.parse_attachments(comment[:file_attachments])
20
+ end
17
21
  comments << new({
18
22
  id: comment[:id].to_i,
19
23
  text: comment[:text],
20
24
  author: person,
21
25
  created_at: DateTime.parse(comment[:created_at].to_s).to_s,
22
26
  updated_at: DateTime.parse(comment[:updated_at].to_s).to_s,
27
+ file_attachments: file_attachments,
23
28
  story: story
24
29
  })
25
30
  end
@@ -40,7 +45,7 @@ module Scorer
40
45
 
41
46
  def update_attributes(attrs)
42
47
  attrs.each do |key, value|
43
- self.send("#{key}=", value.is_a?(Array) ? value.join(',') : value )
48
+ self.send("#{key}=", value)
44
49
  end
45
50
  end
46
51
 
@@ -4,7 +4,7 @@ module Scorer
4
4
  attr_accessor :project_id, :follower_ids, :updated_at, :current_state, :name, :comment_ids, :url, :story_type,
5
5
  :label_ids, :description, :requested_by_id, :planned_iteration_number, :external_id, :deadline,
6
6
  :owned_by_id, :owned_by, :created_at, :estimate, :kind, :id, :task_ids, :integration_id, :accepted_at,
7
- :comments, :tasks, :attachments, :requested_by, :labels, :notes, :started_at, :status
7
+ :comments, :tasks, :has_attachments, :requested_by, :labels, :notes, :started_at, :status
8
8
 
9
9
  def initialize(attributes={})
10
10
  update_attributes(attributes)
@@ -44,8 +44,16 @@ module Scorer
44
44
  else
45
45
  parsed_story.comments = Scorer::Comment.parse_json_comments(json_story[:comments], parsed_story)
46
46
  end
47
+ parsed_story.has_attachments = false
48
+ if !parsed_story.comments.nil? && parsed_story.comments.count > 0
49
+ parsed_story.comments.each do |note|
50
+ if note.file_attachments.count > 0
51
+ parsed_story.has_attachments = true
52
+ break
53
+ end
54
+ end
55
+ end
47
56
  parsed_story.tasks = parse_tasks(json_story[:tasks], json_story)
48
- parsed_story.attachments = []
49
57
  parsed_story
50
58
  end
51
59
 
@@ -77,24 +85,6 @@ module Scorer
77
85
  parsed_tasks
78
86
  end
79
87
 
80
- def self.parse_attachments(attachments)
81
- parsed_attachments = Array.new
82
- if attachments
83
- attachments.each do |file|
84
- attachment = Scorer::Attachment.new
85
- attachment.id = file[:id].to_i
86
- attachment.filename = file[:filename]
87
- attachment.description = file[:description]
88
- attachment.uploaded_by = file[:uploaded_by]
89
- attachment.uploaded_at = file[:uploaded_at]
90
- attachment.url = file[:url]
91
- attachment.status = file[:status]
92
- parsed_attachments << attachment
93
- end
94
- end
95
- parsed_attachments
96
- end
97
-
98
88
  def self.parse_labels(labels)
99
89
  parsed_labels = ''
100
90
  labels.each do |label|
@@ -2,11 +2,11 @@
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.3 ruby lib
5
+ # stub: pivotal-tracker-api 0.1.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "pivotal-tracker-api"
9
- s.version = "0.1.3"
9
+ s.version = "0.1.4"
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"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal-tracker-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - jfox