class CiHelper::Redmine::IssueUpdater
when include Redmine
and you will have issue instance that you can use before use it to set your form
object.issue_setting do |config|
config.status = 'Your status in text or in value' config.text_box = 'your description in string' end
object.issue.submit
Constants
- STATUS
- STATUS_WORKING_FLOW
Attributes
form[RW]
update_page[RW]
Public Instance Methods
description()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 21 def description form.field_with(name: 'issue[subject]').value end
print_all_status()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 40 def print_all_status status_options_in_text.each_index { |index| puts "status: #{status_options_in_text[index]}, value: #{status_options_in_value[index]}"} end
priority()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 25 def priority # TODO: supply an api for user to pasted the priority of this issue fail NotImplementedError, 'not check this method ' transform_to_word(issue_form.field_with(name: 'issue[prioirty_id]').text.to_i) end
spend_time=(time)
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 60 def spend_time=(time) time_entry_hours.value = time end
status=(user_input)
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 31 def status=(user_input) # make sure let user select value or text status_select_list.value = status_options.select { |option| option.value == user_input} end
status_options_in_text()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 48 def status_options_in_text status_select_list.options.map(&:text) end
status_options_in_value()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 44 def status_options_in_value status_select_list.options.map(&:value) end
submit()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 64 def submit # need to handle the submit success or not fail Exceptions::SettingError, 'Please set your form before use it' unless form form.click_button end
target_branch()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 56 def target_branch target_branch_select_list.options.select{ |option| option.value == target_branch_select_list.value }.first.text end
target_version()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 52 def target_version target_version_select_list.options.select{ |option| option.value == target_version_select_list.value }.first.text end
text_box=(text)
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 36 def text_box=(text) text_field.value = text end
Private Instance Methods
status_options()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 73 def status_options status_select_list.options end
status_select_list()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 77 def status_select_list form.field_with(name: 'issue[status_id]') end
target_branch_select_list()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 89 def target_branch_select_list form.field_with(name: 'issue[custom_field_values][8]') end
target_version_select_list()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 85 def target_version_select_list form.field_with(name: 'issue[fixed_version_id]') end
text_field()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 81 def text_field form.field_with(name: 'issue[notes]') end
time_entry_hours()
click to toggle source
# File lib/ci_helper/redmine/issue_updater.rb, line 93 def time_entry_hours form.field_with(name: 'time_entry[hours]') end
transform_to_word(id)
click to toggle source
TODO: not implement yet
# File lib/ci_helper/redmine/issue_updater.rb, line 100 def transform_to_word(id) CiHelper::PRIORITY[id] end