slack-ruby-block-kit 0.4.0 → 0.5.0

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: 40f294a5c8ef52820a0db8fd474a4cba423dad298f14092217f6213b47ba45ad
4
- data.tar.gz: e22e8b941d6d3c765c6f40735bd97ecd11f94ac4560e3ba038e0cef073a72241
3
+ metadata.gz: 378d3c0f61c46eb14a2b94d00b17ec9c244651410ca1808af7a153799fd5aae3
4
+ data.tar.gz: 5c6e19732f13dca80bcb6903d33d2b74ab2276d1e3440f39c959ba693d56a0b0
5
5
  SHA512:
6
- metadata.gz: d7d952242309b0906da8e5ae6072f618a200e3604ad304ceeb323e2387ec5185cadee7e1554729f9beaf004431f0c97053d30c462d40c0c9bee6aaaa1cd91b88
7
- data.tar.gz: 639e9d8b9b57c99022e0080233a0ecae95f958e04732a0f2bd0fc41cc1b704918fa0eb04a28d6e451a2d373f823c1fb8e40c1890d24ebe5d60af58150e6c27cb
6
+ metadata.gz: f461f8b3321c739727690bf72f02598698e5de10a2a99626f1bffa68a47771777f9af783df6063df841ab85e8db6fea6dcce8e5cb027ae029fcf88253f7f13f5
7
+ data.tar.gz: 7c80bdbf03ce41fef6a11f816a3ffaf9eda92ddd2011a9e20e3c6e9653ebf3306e529aa1b5c53811792d532a18ba732ec55163df3467e490652f6c4c7b2df562
data/.rubocop.yml CHANGED
@@ -13,3 +13,6 @@ Style/AsciiComments:
13
13
  Naming/FileName:
14
14
  Exclude:
15
15
  - lib/slack-ruby-block-kit.rb
16
+
17
+ Metrics/ParameterLists:
18
+ Max: 8
data/.rubocop_todo.yml CHANGED
@@ -17,11 +17,6 @@ Metrics/BlockLength:
17
17
  Metrics/ClassLength:
18
18
  Max: 117
19
19
 
20
- # Offense count: 3
21
- # Configuration parameters: CountKeywordArgs.
22
- Metrics/ParameterLists:
23
- Max: 6
24
-
25
20
  # Offense count: 5
26
21
  # Configuration parameters: Max.
27
22
  RSpec/ExampleLength:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slack-ruby-block-kit (0.4.0)
4
+ slack-ruby-block-kit (0.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
- [![CircleCI](https://circleci.com/gh/CGA1123/slack_block_kit-ruby/tree/master.svg?style=svg)](https://circleci.com/gh/CGA1123/slack_block_kit-ruby/tree/master)
2
- [![Gem Version](https://badge.fury.io/rb/slack_block_kit.svg)](https://badge.fury.io/rb/slack_block_kit)
1
+ [![CircleCI](https://circleci.com/gh/CGA1123/slack-ruby-block-kit/tree/master.svg?style=svg)](https://circleci.com/gh/CGA1123/slack_block_kit-ruby/tree/master)
2
+ [![Gem Version](https://badge.fury.io/rb/slack-ruby-block-kit.svg)](https://badge.fury.io/rb/slack-ruby-block-kit)
3
3
 
4
4
  # Slack::BlockKit
5
5
 
@@ -18,7 +18,7 @@ The 'blocks' availables are split in line with how Slack documents them, that is
18
18
  Add this line to your application's Gemfile:
19
19
 
20
20
  ```ruby
21
- gem 'slack_block_kit'
21
+ gem 'slack-ruby-block-kit'
22
22
  ```
23
23
 
24
24
 
@@ -29,12 +29,12 @@ And then execute:
29
29
 
30
30
  Or install it yourself as:
31
31
 
32
- $ gem install slack_block_kit
32
+ $ gem install slack-ruby-block-kit
33
33
 
34
34
  Finally, require this:
35
35
 
36
36
  ```ruby
37
- require 'slack/block_kit'
37
+ require 'slack-ruby-block-kit'
38
38
  ```
39
39
 
40
40
  ## Examples
@@ -43,7 +43,7 @@ Here are a few examples that might help you get started!
43
43
 
44
44
  ```ruby
45
45
  require 'faraday'
46
- require 'slack/block_kit'
46
+ require 'slack-ruby-block-kit'
47
47
  require 'json'
48
48
 
49
49
  a_prebuilt_block = Slack::BlockKit::Layout::Section.new
@@ -88,7 +88,7 @@ You can also check out the [`slackerduty`](https://github.com/CGA1123/slackerdut
88
88
 
89
89
  Bug reports and pull requests are welcome on GitHub at https://github.com/CGA1123/slack_block_kit-ruby
90
90
 
91
- See [issues](https://github.com/CGA1123/slack_block_kit-ruby/issues) if you want any inspiration as to what to help with!
91
+ See [issues](https://github.com/CGA1123/slack-ruby-block-kit/issues) if you want any inspiration as to what to help with!
92
92
 
93
93
  ## License
94
94
 
@@ -6,7 +6,7 @@ module Slack
6
6
  module Element; end
7
7
  module Layout; end
8
8
 
9
- VERSION = '0.4.0'
9
+ VERSION = '0.5.0'
10
10
 
11
11
  Dir[File.join(__dir__, 'block_kit', 'composition', '*.rb')].each { |file| require file }
12
12
  Dir[File.join(__dir__, 'block_kit', 'element', '*.rb')].each { |file| require file }
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Slack
4
+ module BlockKit
5
+ module Element
6
+ # A plain-text input, similar to the HTML <input> tag, creates a field
7
+ # where a user can enter freeform data. It can appear as a single-line
8
+ # field or a larger textarea using the multiline flag.
9
+ #
10
+ # Plain-text input elements are currently only available in modals
11
+ #
12
+ # https://api.slack.com/reference/block-kit/block-elements#input
13
+ class PlainTextInput
14
+ TYPE = 'plain_text_input'
15
+
16
+ def initialize(
17
+ action_id:,
18
+ placeholder: nil,
19
+ emoji: nil,
20
+ initial_value: nil,
21
+ multiline: nil,
22
+ min_length: nil,
23
+ max_length: nil
24
+ )
25
+ @placeholder = Composition::PlainText.new(text: placeholder, emoji: emoji) if placeholder
26
+ @initial_value = initial_value
27
+ @action_id = action_id
28
+ @multiline = multiline
29
+ @min_length = min_length
30
+ @max_length = max_length
31
+ end
32
+
33
+ def as_json(*)
34
+ {
35
+ type: TYPE,
36
+ action_id: @action_id,
37
+ placeholder: @placeholder&.as_json,
38
+ multiline: @multiline,
39
+ min_length: @min_length,
40
+ max_length: @max_length,
41
+ initial_value: @initial_value
42
+ }.compact
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Slack
4
+ module BlockKit
5
+ module Layout
6
+ # A block that collects information from users - it can hold a plain-text
7
+ # input element, a select menu element, a multi-select menu element, or a
8
+ # datepicker.
9
+ #
10
+ # https://api.slack.com/reference/block-kit/blocks#input
11
+ class Input
12
+ TYPE = 'input'
13
+
14
+ attr_accessor :label, :element, :block_id, :hint, :optional, :emoji
15
+
16
+ def initialize(
17
+ label:,
18
+ element:,
19
+ block_id: nil,
20
+ hint: nil,
21
+ optional: nil,
22
+ emoji: nil
23
+ )
24
+ @label = Composition::PlainText.new(text: label, emoji: emoji) if label
25
+ @hint = Composition::PlainText.new(text: hint, emoji: emoji) if hint
26
+ @block_id = block_id
27
+ @optional = optional
28
+ @element = element
29
+ end
30
+
31
+ def as_json(*)
32
+ {
33
+ type: TYPE,
34
+ element: @element.as_json,
35
+ label: @label&.as_json,
36
+ hint: @hint&.as_json,
37
+ block_id: @block_id,
38
+ optional: optional
39
+ }.compact
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-block-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Gregg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-29 00:00:00.000000000 Z
11
+ date: 2020-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,12 +126,14 @@ files:
126
126
  - lib/slack/block_kit/element/external_select.rb
127
127
  - lib/slack/block_kit/element/image.rb
128
128
  - lib/slack/block_kit/element/overflow_menu.rb
129
+ - lib/slack/block_kit/element/plain_text_input.rb
129
130
  - lib/slack/block_kit/element/static_select.rb
130
131
  - lib/slack/block_kit/element/users_select.rb
131
132
  - lib/slack/block_kit/layout/actions.rb
132
133
  - lib/slack/block_kit/layout/context.rb
133
134
  - lib/slack/block_kit/layout/divider.rb
134
135
  - lib/slack/block_kit/layout/image.rb
136
+ - lib/slack/block_kit/layout/input.rb
135
137
  - lib/slack/block_kit/layout/section.rb
136
138
  - slack-ruby-block-kit.gemspec
137
139
  homepage: https://github.com/CGA1123/slack-ruby-block-kit