Class: Houston::Adapters::TicketTracker::GithubAdapter::Issue

Inherits:
Object
  • Object
show all
Defined in:
app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, attributes) ⇒ Issue

Returns a new instance of Issue.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 9

def initialize(connection, attributes)
  @connection       = connection
  @raw_attributes   = attributes

  # required
  @remote_id        = attributes["id"]
  @number           = attributes["number"]
  @summary          = attributes["title"]
  @description      = attributes["body"]
  @reporter_email   = attributes["user"]["email"]
  @resolution       = ""
  @milestone_id     = nil
  @type             = get_type
  @created_at       = attributes["created_at"] if attributes["created_at"]
  @closed_at        = attributes["closed_at"] if attributes["closed_at"]

  # optional
  @tags             = get_tags
end

Instance Attribute Details

#closed_atObject (readonly)

Returns the value of attribute closed_at.



29
30
31
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 29

def closed_at
  @closed_at
end

#created_atObject (readonly)

Returns the value of attribute created_at.



29
30
31
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 29

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



29
30
31
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 29

def description
  @description
end

#milestone_idObject (readonly)

Returns the value of attribute milestone_id.



29
30
31
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 29

def milestone_id
  @milestone_id
end

#numberObject (readonly)

Returns the value of attribute number.



29
30
31
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 29

def number
  @number
end

#raw_attributesObject (readonly)

Returns the value of attribute raw_attributes.



29
30
31
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 29

def raw_attributes
  @raw_attributes
end

#remote_idObject (readonly)

Returns the value of attribute remote_id.



29
30
31
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 29

def remote_id
  @remote_id
end

#reporter_emailObject (readonly)

Returns the value of attribute reporter_email.



29
30
31
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 29

def reporter_email
  @reporter_email
end

#resolutionObject (readonly)

Returns the value of attribute resolution.



29
30
31
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 29

def resolution
  @resolution
end

#summaryObject (readonly)

Returns the value of attribute summary.



29
30
31
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 29

def summary
  @summary
end

#tagsObject (readonly)

Returns the value of attribute tags.



29
30
31
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 29

def tags
  @tags
end

#typeObject (readonly)

Returns the value of attribute type.



29
30
31
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 29

def type
  @type
end

Instance Method Details

#attributesObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 43

def attributes
  { remote_id:      remote_id,
    number:         number,
    summary:        summary,
    description:    description,
    reporter_email: reporter_email,
    resolution:     resolution,
    milestone_id:   milestone_id,
    type:           type,
    created_at:     created_at,
    closed_at:      closed_at,

    tags:           tags,
    prerequisites:  [] }
end

#close!Object



61
62
63
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 61

def close!
  connection.close_issue(number)
end

#reopen!Object



69
70
71
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 69

def reopen!
  connection.reopen_issue(number)
end

#resolve!Object



65
66
67
# File 'app/adapters/houston/adapters/ticket_tracker/github_adapter/issue.rb', line 65

def resolve!
  close!
end