Class: Jira::Auto::Tool::Project::TicketFields
- Defined in:
- lib/jira/auto/tool/project/ticket_fields.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#tool ⇒ Object
readonly
Returns the value of attribute tool.
Instance Method Summary collapse
- #each_issue_type_field ⇒ Object
-
#initialize(tool, project) ⇒ TicketFields
constructor
A new instance of TicketFields.
- #list ⇒ Object
- #table_row_header ⇒ Object
- #table_rows ⇒ Object
Constructor Details
#initialize(tool, project) ⇒ TicketFields
Returns a new instance of TicketFields.
10 11 12 13 |
# File 'lib/jira/auto/tool/project/ticket_fields.rb', line 10 def initialize(tool, project) @tool = tool @project = project end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
8 9 10 |
# File 'lib/jira/auto/tool/project/ticket_fields.rb', line 8 def project @project end |
#tool ⇒ Object (readonly)
Returns the value of attribute tool.
8 9 10 |
# File 'lib/jira/auto/tool/project/ticket_fields.rb', line 8 def tool @tool end |
Instance Method Details
#each_issue_type_field ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/jira/auto/tool/project/ticket_fields.rb', line 39 def each_issue_type_field tool.jira_client.Createmeta.all({ projectKeys: project.key, "expand" => "projects.issuetypes.fields" }) .each do || .attrs["issuetypes"].each do |issue_type| issue_type_name = issue_type["name"] issue_type["fields"].each_value do |field| yield(issue_type_name, field) end end end end |
#list ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/jira/auto/tool/project/ticket_fields.rb', line 15 def list table = Terminal::Table.new( title: "Project #{project.key} Ticket Fields", headings: table_row_header, rows: table_rows ) puts table end |
#table_row_header ⇒ Object
25 26 27 |
# File 'lib/jira/auto/tool/project/ticket_fields.rb', line 25 def table_row_header ["Ticket Type", "Field Key", "Field Name", "Field Type", "Allowed Values"] end |
#table_rows ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/jira/auto/tool/project/ticket_fields.rb', line 29 def table_rows rows = [] each_issue_type_field do |issue_type_name, field| rows << [issue_type_name, field["key"], field["name"], field["schema"]["type"], allowed_values(field)] end rows.sort end |