Class: Bitbucket::Representation::Issue

Inherits:
Base
  • Object
show all
Defined in:
lib/bitbucket/representation/issue.rb

Constant Summary collapse

CLOSED_STATUS =
%w[resolved invalid duplicate wontfix closed].freeze

Instance Attribute Summary

Attributes inherited from Base

#raw

Instance Method Summary collapse

Methods inherited from Base

decorate, #initialize

Constructor Details

This class inherits a constructor from Bitbucket::Representation::Base

Instance Method Details

#authorObject



16
17
18
# File 'lib/bitbucket/representation/issue.rb', line 16

def author
  raw.dig('reporter', 'nickname')
end

#created_atObject



36
37
38
# File 'lib/bitbucket/representation/issue.rb', line 36

def created_at
  raw['created_on']
end

#descriptionObject



20
21
22
# File 'lib/bitbucket/representation/issue.rb', line 20

def description
  raw.fetch('content', {}).fetch('raw', nil)
end

#iidObject



8
9
10
# File 'lib/bitbucket/representation/issue.rb', line 8

def iid
  raw['id']
end

#kindObject



12
13
14
# File 'lib/bitbucket/representation/issue.rb', line 12

def kind
  raw['kind']
end

#milestoneObject



32
33
34
# File 'lib/bitbucket/representation/issue.rb', line 32

def milestone
  raw['milestone']['name'] if raw['milestone'].present?
end

#stateObject



24
25
26
# File 'lib/bitbucket/representation/issue.rb', line 24

def state
  closed? ? 'closed' : 'opened'
end

#titleObject



28
29
30
# File 'lib/bitbucket/representation/issue.rb', line 28

def title
  raw['title']
end

#to_hashObject



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/bitbucket/representation/issue.rb', line 48

def to_hash
  {
    iid: iid,
    title: title,
    description: description,
    state: state,
    author: author,
    milestone: milestone,
    created_at: created_at,
    updated_at: updated_at
  }
end

#to_sObject



44
45
46
# File 'lib/bitbucket/representation/issue.rb', line 44

def to_s
  iid
end

#updated_atObject



40
41
42
# File 'lib/bitbucket/representation/issue.rb', line 40

def updated_at
  raw['edited_on']
end