Class: Fastlane::Actions::YtIssuesInfoAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::YtIssuesInfoAction
- Defined in:
- lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(_) ⇒ Boolean
- .output ⇒ Object
- .return_type ⇒ Object
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
129 130 131 |
# File 'lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb', line 129 def self. ['Semen Kologrivov'] end |
.available_options ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb', line 86 def self. [ FastlaneCore::ConfigItem.new( key: :issue_ids, description: 'Array of issue\'s ids', optional: false, type: Array ), FastlaneCore::ConfigItem.new( key: :issue_fields, description: 'Array of neccessary fields of issue', optional: true, default_value: ['summary', 'description'], type: Array ), FastlaneCore::ConfigItem.new( key: :issue_custom_fields_names, description: 'Array of names of neccessary custom fields of issue', optional: true, default_value: ['Kanban State', 'Stage'], type: Array ), FastlaneCore::ConfigItem.new( key: :base_url, env_name: 'YOUTRACK_BASE_URL', description: 'Base YouTrack URL', optional: false, type: String ), FastlaneCore::ConfigItem.new( key: :access_token, env_name: 'YOUTRACK_API_TOKEN', description: 'Access token for YouTrack API', optional: false, type: String ) ] end |
.description ⇒ Object
78 79 80 |
# File 'lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb', line 78 def self.description 'Get info about YouTrack\'s issues (summary, description etc.)' end |
.details ⇒ Object
82 83 84 |
# File 'lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb', line 82 def self.details '' end |
.example_code ⇒ Object
137 138 139 140 141 |
# File 'lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb', line 137 def self.example_code [ 'yt_issues_info(issue_ids: ["ios_1234", "ios_5678", "ios_4321"])' ] end |
.is_supported?(_) ⇒ Boolean
133 134 135 |
# File 'lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb', line 133 def self.is_supported?(_) true end |
.output ⇒ Object
143 144 145 146 147 |
# File 'lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb', line 143 def self.output [ ['YOUTRACK_RELEASED_ISSUES', 'Array of released issues'] ] end |
.return_type ⇒ Object
149 150 151 |
# File 'lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb', line 149 def self.return_type :array end |
.return_value ⇒ Object
125 126 127 |
# File 'lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb', line 125 def self.return_value 'Hashes with issues info' end |
.run(params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/fastlane/plugin/youtrack/actions/yt_issues_info_action.rb', line 10 def self.run(params) issue_ids = params[:issue_ids] fields = params[:issue_fields] custom_fields_names = params[:issue_custom_fields_names] base_url = params[:base_url] access_token = params[:access_token] issues_info = issue_ids.map do |issue_id| info = { id: issue_id, url: "#{base_url}/issue/#{issue_id}" } issue_info_result = Helper::YoutrackHelper.get_issue_info( issue_id, fields, base_url, access_token ) return info unless issue_info_result.success? begin issue_info_response_body = JSON.parse(issue_info_result.body) fields.each { |field| info[field.to_sym] = issue_info_response_body[field] } rescue JSON::ParserError => e puts e return info end issue_custom_fields_result = Helper::YoutrackHelper.get_issue_custom_fields( issue_id, base_url, access_token ) return info unless issue_custom_fields_result.success? begin issue_custom_fields_response_body = JSON.parse(issue_custom_fields_result.body) custom_fields_names.each do |field_name| custom_field = issue_custom_fields_response_body.find { |field| field['name'] == field_name } next if custom_field.nil? info[field_name.to_sym] = { type: custom_field['$type'], name: custom_field['name'], value: custom_field['value']['name'] } end rescue JSON::ParserError => e puts e return info end info end Actions.lane_context[SharedValues::YOUTRACK_RELEASED_ISSUES] = issues_info issues_info rescue => ex UI.error(ex) UI.error('Failed') end |