Class: PivotalAPI::Comment

Inherits:
Base
  • Object
show all
Defined in:
lib/pivotal-tracker-api/comment.rb

Direct Known Subclasses

Comments

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

#initialize, #to_json

Constructor Details

This class inherits a constructor from PivotalAPI::Base

Instance Attribute Details

#commit_identifierObject

Returns the value of attribute commit_identifier.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def commit_identifier
  @commit_identifier
end

#commit_typeObject

Returns the value of attribute commit_type.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def commit_type
  @commit_type
end

#created_atObject

Returns the value of attribute created_at.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def created_at
  @created_at
end

#epic_idObject

Returns the value of attribute epic_id.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def epic_id
  @epic_id
end

#file_attachmentsObject

Returns the value of attribute file_attachments.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def file_attachments
  @file_attachments
end

#google_attachment_idsObject

Returns the value of attribute google_attachment_ids.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def google_attachment_ids
  @google_attachment_ids
end

#idObject

Returns the value of attribute id.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def id
  @id
end

#kindObject

Returns the value of attribute kind.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def kind
  @kind
end

#personObject

Returns the value of attribute person.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def person
  @person
end

#project_idObject

Returns the value of attribute project_id.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def project_id
  @project_id
end

#story_idObject

Returns the value of attribute story_id.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def story_id
  @story_id
end

#textObject

Returns the value of attribute text.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def text
  @text
end

#updated_atObject

Returns the value of attribute updated_at.



41
42
43
# File 'lib/pivotal-tracker-api/comment.rb', line 41

def updated_at
  @updated_at
end

Class Method Details

.fieldsObject



46
47
48
49
50
# File 'lib/pivotal-tracker-api/comment.rb', line 46

def self.fields
  ["person(#{Person.fields.join(',')})", 'text', 'updated_at', 'id',
   'created_at', 'story_id', 'file_attachments', 'google_attachment_ids',
   'commit_identifier', 'commit_type', 'kind']
end

.from_json(json) ⇒ Object



52
53
54
# File 'lib/pivotal-tracker-api/comment.rb', line 52

def self.from_json(json)
  parse_json_comment(json)
end

.parse_json_comment(comment) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/pivotal-tracker-api/comment.rb', line 56

def self.parse_json_comment(comment)
  person = Person.from_json(comment[:person]) if comment[:person]
  person = Person.unkown if person.nil?
  new({
    id: comment[:id].to_i,
    text: comment[:text],
    person: person,
    created_at: DateTime.parse(comment[:created_at].to_s),
    updated_at: DateTime.parse(comment[:updated_at].to_s),
    file_attachments: FileAttachments.from_json(comment[:file_attachments]),
    commit_identifier: comment[:commit_identifier],
    google_attachment_ids: comment[:google_attachment_ids],
    commit_type: comment[:commit_type],
    kind: comment[:kind]
  })
end