fastlane-plugin-slack_bot 0.1.1 → 0.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7340f09d68383428d22988f1cee11d6a175bfdb3d4443af48dc070a2a366dee4
|
4
|
+
data.tar.gz: ef98d678fac65cb75943ba53daee4e5da38b9c21d1bda396b790b4d0736a9a93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4f4e61b04ed004d81436de2202cb66df05420e34d94583e39c145048fba2e00bd0c60392fa38b9a8163bb7c1e1d8c891bcf218674aced8c82da46f625598c0b
|
7
|
+
data.tar.gz: 36fbd80160b344bc8d53e5d6a346baf77de81159f1ec9cc2d116173ed8505d7b8f6737d0133651277eef0c2a4fafec5c1dcf47cf686a697c8418ac41e05b9cab
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/slack_bot_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
FETCH_FILES_SLACK_RESULT = :FETCH_FILES_SLACK_RESULT
|
8
|
+
end
|
9
|
+
class FetchFilesSlackAction < Action
|
10
|
+
def self.run(options)
|
11
|
+
require 'excon'
|
12
|
+
require 'json'
|
13
|
+
|
14
|
+
api_url = "https://slack.com/api/files.list"
|
15
|
+
headers = { "Content-Type": "application/json", "Authorization": "Bearer #{options[:api_token]}" }
|
16
|
+
query = { channel: options[:channel], count: options[:count], page: options[:page] }
|
17
|
+
|
18
|
+
response = Excon.get(api_url, headers: headers, query: query)
|
19
|
+
status_code = response[:status]
|
20
|
+
UI.user_error!("Response body is nil, status code: #{status_code} 💥") if response.body.nil?
|
21
|
+
|
22
|
+
result = {
|
23
|
+
status: status_code,
|
24
|
+
body: response.body,
|
25
|
+
json: JSON.parse(response.body)
|
26
|
+
}
|
27
|
+
|
28
|
+
Actions.lane_context[SharedValues::FETCH_FILES_SLACK_RESULT] = result
|
29
|
+
return result
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.description
|
33
|
+
"List files of any #channel using Slack bot `files.list` api."
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.available_options
|
37
|
+
[
|
38
|
+
FastlaneCore::ConfigItem.new(key: :api_token,
|
39
|
+
env_name: "FL_FETCH_FILES_SLACK_BOT_TOKEN",
|
40
|
+
description: "Slack bot Token",
|
41
|
+
sensitive: true,
|
42
|
+
code_gen_sensitive: true,
|
43
|
+
is_string: true,
|
44
|
+
default_value: ENV["SLACK_API_TOKEN"],
|
45
|
+
default_value_dynamic: true,
|
46
|
+
optional: false),
|
47
|
+
FastlaneCore::ConfigItem.new(key: :channel,
|
48
|
+
env_name: "FL_FETCH_FILES_SLACK_CHANNEL",
|
49
|
+
description: "slack #channel ID",
|
50
|
+
optional: false),
|
51
|
+
FastlaneCore::ConfigItem.new(key: :count,
|
52
|
+
env_name: "FL_FETCH_FILES_SLACK_COUNT",
|
53
|
+
description: "Number of items to return per page, default value: 100",
|
54
|
+
default_value: "100",
|
55
|
+
optional: true),
|
56
|
+
FastlaneCore::ConfigItem.new(key: :page,
|
57
|
+
env_name: "FL_FETCH_FILES_SLACK_PAGE",
|
58
|
+
description: "Page number of results to return, default value: 1",
|
59
|
+
default_value: "1",
|
60
|
+
optional: true)
|
61
|
+
]
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.authors
|
65
|
+
["crazymanish"]
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.example_code
|
69
|
+
[
|
70
|
+
'fetch_files_slack(channel: "CHXYMXXXX")',
|
71
|
+
'fetch_files_slack(channel: "CHXYMXXXX", count: "10")',
|
72
|
+
'fetch_files_slack(channel: "CHXYMXXXX", count: "10", page: "2")'
|
73
|
+
]
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.is_supported?(platform)
|
77
|
+
true
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-slack_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manish Rathi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- LICENSE
|
146
146
|
- README.md
|
147
147
|
- lib/fastlane/plugin/slack_bot.rb
|
148
|
+
- lib/fastlane/plugin/slack_bot/actions/fetch_files_slack.rb
|
148
149
|
- lib/fastlane/plugin/slack_bot/actions/post_to_slack.rb
|
149
150
|
- lib/fastlane/plugin/slack_bot/helper/slack_bot_helper.rb
|
150
151
|
- lib/fastlane/plugin/slack_bot/version.rb
|