Class: CiHelper::RedmineProcedure

Inherits:
Object
  • Object
show all
Includes:
Redmine
Defined in:
lib/ci_helper/redmine_procedure.rb

Overview

This class responsible for traversing the page in the redmine and find the issue form, re-get the page

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Redmine

#issue, #issue_form=, #issue_setting, #submit

Constructor Details

#initialize(account, password) ⇒ RedmineProcedure

Returns a new instance of RedmineProcedure.



11
12
13
14
15
# File 'lib/ci_helper/redmine_procedure.rb', line 11

def initialize(, password)
  @account  = 
  @password = password
  @client   = Mechanize.new
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



8
9
10
# File 'lib/ci_helper/redmine_procedure.rb', line 8

def 
  @account
end

#clientObject (readonly)

Returns the value of attribute client.



8
9
10
# File 'lib/ci_helper/redmine_procedure.rb', line 8

def client
  @client
end

#issue_noObject

Returns the value of attribute issue_no.



8
9
10
# File 'lib/ci_helper/redmine_procedure.rb', line 8

def issue_no
  @issue_no
end

#issue_pageObject (readonly)

Returns the value of attribute issue_page.



8
9
10
# File 'lib/ci_helper/redmine_procedure.rb', line 8

def issue_page
  @issue_page
end

#passwordObject (readonly)

Returns the value of attribute password.



8
9
10
# File 'lib/ci_helper/redmine_procedure.rb', line 8

def password
  @password
end

Instance Method Details

#formObject



33
34
35
# File 'lib/ci_helper/redmine_procedure.rb', line 33

def form
  issue_page.form_with(action: "/issues/#{issue_no}")
end

#get_issue_pageObject



50
51
52
# File 'lib/ci_helper/redmine_procedure.rb', line 50

def get_issue_page
  client.get("#{CiHelper::REDMINE_DOMAIN}#{issue_no}")
end

#loginObject



37
38
39
40
41
42
43
44
# File 'lib/ci_helper/redmine_procedure.rb', line 37

def 
   = get_issue_page

  @issue_page = .form_with(action: '/login') do |f|
    f.field_with(name: 'username').value = 
    f.field_with(name: 'password').value = password
  end.click_button
end

#refresh_issue_pageObject



46
47
48
# File 'lib/ci_helper/redmine_procedure.rb', line 46

def refresh_issue_page
  @issue_page = get_issue_page
end

#set_issue_formObject



29
30
31
# File 'lib/ci_helper/redmine_procedure.rb', line 29

def set_issue_form
  self.issue_form = form
end