Class: Twigg::Gerrit::Change

Inherits:
Object
  • Object
show all
Defined in:
lib/twigg-gerrit/gerrit/change.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Change

Returns a new instance of Change.

Raises:

  • (ArgumentError)


22
23
24
25
26
27
# File 'lib/twigg-gerrit/gerrit/change.rb', line 22

def initialize(options = {})
  raise ArgumentError unless @change_id       = options[:change_id]
  raise ArgumentError unless @subject         = options[:subject]
  raise ArgumentError unless @full_name       = options[:full_name]
  raise ArgumentError unless @last_updated_on = options[:last_updated_on]
end

Instance Attribute Details

#change_idObject (readonly)

Returns the value of attribute change_id.



20
21
22
# File 'lib/twigg-gerrit/gerrit/change.rb', line 20

def change_id
  @change_id
end

#full_nameObject (readonly)

Returns the value of attribute full_name.



20
21
22
# File 'lib/twigg-gerrit/gerrit/change.rb', line 20

def full_name
  @full_name
end

#last_updated_onObject (readonly)

Returns the value of attribute last_updated_on.



20
21
22
# File 'lib/twigg-gerrit/gerrit/change.rb', line 20

def last_updated_on
  @last_updated_on
end

#subjectObject (readonly)

Returns the value of attribute subject.



20
21
22
# File 'lib/twigg-gerrit/gerrit/change.rb', line 20

def subject
  @subject
end

Class Method Details

.changesObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/twigg-gerrit/gerrit/change.rb', line 5

def changes
  DB[:changes].
    select(:change_id, :last_updated_on, :subject, :full_name).
    join(:accounts, account_id: :owner_account_id).
    where(status: 'n').
    order(Sequel.desc(:last_updated_on)).
    all.map do |change|
    new(change_id:       change[:change_id],
        subject:         change[:subject],
        full_name:       change[:full_name],
        last_updated_on: change[:last_updated_on])
  end
end

Instance Method Details

#urlObject



29
30
31
# File 'lib/twigg-gerrit/gerrit/change.rb', line 29

def url
  Config.gerrit.web.host + '/' + change_id.to_s
end