fastlane-plugin-trello 1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f457b41a445cdc3121e70a6b94528d46b5455c15
4
- data.tar.gz: 3b319ba30944ff47103b3d01ddd3bac143a692ea
3
+ metadata.gz: 1c1741f57a456200ab53a3c50639f7edde503aca
4
+ data.tar.gz: d6dbbdaa5a976c968f3f4f9abe8c979b678c9a6e
5
5
  SHA512:
6
- metadata.gz: 300f60ee7dabdd13e6907fd34d50368fc76a74d9579e6b7b8f744ecf065584d2c84b9f1e9fc186f3d87b2389d3091e7f1f1dadd6d4c73088578fb7f4b3268ae5
7
- data.tar.gz: 67b2059d1638cc1bf4fc4bfc54a3d2cdd8ff606073651891563016302e9f2805bcfc5e72a19f66c4da34546a7623e4781e730cee006155adeef51bd1f089e1b1
6
+ metadata.gz: 6e59b82e6ac32160056e004cf062cc2037a510b33af577aa653f5c0ebeee26c13661610d2abd929187e13dab3bd22c7fe74157417597568b60799e060fd4aa14
7
+ data.tar.gz: 1753d01098437cef8a709a471c3c4a8ccb76de0e49cfa48130cfdc839de5b0b77cc798dcba88fb952a75f9843b5ed7bd78792e11240fa1274ca4fb77b8a39fe0
@@ -0,0 +1,105 @@
1
+ require 'fastlane/action'
2
+ require 'uri'
3
+ require 'net/http'
4
+ require 'json'
5
+ require_relative '../helper/trello_helper'
6
+
7
+ module Fastlane
8
+ module Actions
9
+ class TrelloComment < Action
10
+
11
+ @base_path = "https://api.trello.com/1"
12
+ @base_url = URI(@base_path)
13
+ @http = Net::HTTP.new(@base_url.host, @base_url.port)
14
+ @http.use_ssl = true
15
+ @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
16
+
17
+ def self.run(params)
18
+
19
+ @key = params[:api_key]
20
+ @token = params[:api_token]
21
+ @board_id = params[:board_id]
22
+ card_number = params[:card_number]
23
+ comment_text = params[:text]
24
+
25
+ UI.message("Fetching Trello card [##{card_number}]...")
26
+ card = find_card_by(short_id: card_number)
27
+ unless card
28
+ UI.error("Card #{card_number} not found.")
29
+ return
30
+ end
31
+ card_name = card["name"]
32
+
33
+ UI.message("Adding comment '#{comment_text}' to card [##{card_number}] '#{card_name}'")
34
+ add_comment(card_id: card["id"], text: comment_text)
35
+ end
36
+
37
+ def self.find_card_by(short_id:)
38
+ url = URI("#{@base_path}/boards/#{@board_id}/cards/#{short_id}?fields=id%2Cname&key=#{@key}&token=#{@token}")
39
+ request = Net::HTTP::Get.new(url)
40
+ response = @http.request(request)
41
+ card = JSON.parse(response.body)
42
+ return card
43
+ end
44
+
45
+ def self.add_comment(card_id:, text:)
46
+ url = URI("#{@base_path}/cards/#{card_id}/actions/comments?text=#{text}&key=#{@key}&token=#{@token}")
47
+ request = Net::HTTP::Put.new(url)
48
+ response = @http.request(request)
49
+ card = JSON.parse(response.body)
50
+ return card
51
+ end
52
+
53
+ def self.description
54
+ "Trello plugin for Fastlane"
55
+ end
56
+
57
+ def self.authors
58
+ ["Oscar De Moya"]
59
+ end
60
+
61
+ def self.return_value
62
+ # If your method provides a return value, you can describe here what it does
63
+ end
64
+
65
+ def self.details
66
+ "Plugin for moving a trello card to a given list"
67
+ end
68
+
69
+ def self.available_options
70
+ [
71
+ FastlaneCore::ConfigItem.new(key: :api_key,
72
+ env_name: "TRELLO_API_KEY",
73
+ description: "Trello API Key (get one at: https://trello.com/app-key)",
74
+ optional: false,
75
+ type: String),
76
+ FastlaneCore::ConfigItem.new(key: :api_token,
77
+ env_name: "TRELLO_API_TOKEN",
78
+ description: "Trello API Token (get one at: https://trello.com/app-key)",
79
+ optional: false,
80
+ type: String),
81
+ FastlaneCore::ConfigItem.new(key: :board_id,
82
+ env_name: "TRELLO_BOARD_ID",
83
+ description: "The ID of the Trello board. You can find it in the trello board URL",
84
+ optional: false,
85
+ type: String),
86
+ FastlaneCore::ConfigItem.new(key: :text,
87
+ env_name: "TRELLO_COMMENT_TEXT",
88
+ description: "The text of the comment to add to the card",
89
+ optional: false,
90
+ type: String),
91
+ FastlaneCore::ConfigItem.new(key: :card_number,
92
+ env_name: "TRELLO_CARD_NUMBER",
93
+ description: "The number of the card to be moved the given list",
94
+ optional: false,
95
+ type: Integer)
96
+ ]
97
+ end
98
+
99
+ def self.is_supported?(platform)
100
+ true
101
+ end
102
+ end
103
+ end
104
+ end
105
+
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Trello
3
- VERSION = "1.1"
3
+ VERSION = "1.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-trello
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar De Moya
@@ -146,6 +146,7 @@ files:
146
146
  - README.md
147
147
  - lib/fastlane/plugin/trello.rb
148
148
  - lib/fastlane/plugin/trello/actions/trello_action.rb
149
+ - lib/fastlane/plugin/trello/actions/trello_comment.rb
149
150
  - lib/fastlane/plugin/trello/helper/trello_helper.rb
150
151
  - lib/fastlane/plugin/trello/version.rb
151
152
  homepage: https://github.com/oscardemoya/fastlane-plugin-trello