Class: App::Jira
- Inherits:
-
Object
- Object
- App::Jira
- Defined in:
- lib/core/jira.rb
Instance Method Summary collapse
-
#get_jira_number_from_arg(argument) ⇒ Object
Gets jira number from an argument.
-
#initialize ⇒ Object
constructor
Initialise credentials.
-
#validate_jira_number(value) ⇒ Object
Validates that string is a number between 1 - 20,0000.
Constructor Details
#initialize ⇒ Object
Initialise credentials
7 8 |
# File 'lib/core/jira.rb', line 7 def initialize end |
Instance Method Details
#get_jira_number_from_arg(argument) ⇒ Object
Gets jira number from an argument. Displays error if invalid.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/core/jira.rb', line 12 def get_jira_number_from_arg(argument) jira_number = nil jira_number_possible = argument jira_number_possible.split('-').each do |pjn| if validate_jira_number(pjn) jira_number = pjn break end end if jira_number.nil? App::Terminal::error('Invalid Jira Number', "The Jira Number must be a 4-5 digit number. You tried to pass: #{App::Terminal::format_invalid(argument)}", true) end jira_number end |
#validate_jira_number(value) ⇒ Object
Validates that string is a number between 1 - 20,0000
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/core/jira.rb', line 29 def validate_jira_number(value) begin value = Integer value if value < 0 || value > 20000 return false end return true rescue return false end end |