kamiflex 0.11.5 → 0.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kamiflex/core.rb +16 -10
- data/lib/kamiflex/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abe7d79a2da6e406553d0ac0affcf3d68e8bfc11eeb708b0491b76da8181a29a
|
4
|
+
data.tar.gz: 4f17979f04de0cbf1ac0239800c16a12b6ec40280c4d923a78e4fe1de4ecd99b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7d6689a1430d5f072cd4cf98ce57b94a6ce08f0f67e95e053328ca8c4f1a885ee17393a20d457f80a803d002cdde8aacc39419198a0928a83f6767f5849c656
|
7
|
+
data.tar.gz: b6ba2c19320da472a198382773329254d10a1900b7e281d8f848776dc818a04e4cab47eb4213afbc0f41031d2884c250db194ddf56e11be5130f639399e5d5e0
|
data/lib/kamiflex/core.rb
CHANGED
@@ -6,22 +6,24 @@ module Kamiflex
|
|
6
6
|
type: "flex",
|
7
7
|
altText: "this is a flex message",
|
8
8
|
contents: _contents.first
|
9
|
-
}.merge(attributes.slice(:quickReply))
|
9
|
+
}.merge(attributes.slice(:quickReply, :altText))
|
10
10
|
end
|
11
11
|
|
12
|
-
def bubble
|
12
|
+
def bubble(**params)
|
13
13
|
attributes, _contents = flex_scope{ yield }
|
14
14
|
@flex_contents << {
|
15
15
|
type: "bubble"
|
16
|
-
}.merge(attributes.slice(:size, :direction, :header, :hero, :body, :footer, :
|
16
|
+
}.merge(attributes.slice(:size, :direction, :header, :hero, :body, :footer, :styles, :action))
|
17
|
+
.merge(params)
|
17
18
|
end
|
18
19
|
|
19
|
-
def bubbles(resources)
|
20
|
+
def bubbles(resources, **params)
|
20
21
|
resources.each_with_index do |resource, index|
|
21
22
|
attributes, _contents = flex_scope{ yield(resource, index) }
|
22
23
|
@flex_contents << {
|
23
24
|
type: "bubble",
|
24
|
-
}.merge(attributes.slice(:size, :direction, :header, :hero, :body, :footer, :
|
25
|
+
}.merge(attributes.slice(:size, :direction, :header, :hero, :body, :footer, :styles, :action))
|
26
|
+
.merge(params)
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
@@ -68,6 +70,15 @@ module Kamiflex
|
|
68
70
|
}.merge(params)
|
69
71
|
end
|
70
72
|
|
73
|
+
# style
|
74
|
+
def styles(params)
|
75
|
+
@flex_attributes[:styles] = params
|
76
|
+
end
|
77
|
+
|
78
|
+
def alt_text(text)
|
79
|
+
@flex_attributes[:altText] = text
|
80
|
+
end
|
81
|
+
|
71
82
|
# container
|
72
83
|
def horizontal_box(resources = [nil], **params)
|
73
84
|
resources.each_with_index do |resource, index|
|
@@ -80,11 +91,6 @@ module Kamiflex
|
|
80
91
|
end
|
81
92
|
end
|
82
93
|
|
83
|
-
# style
|
84
|
-
def style(params)
|
85
|
-
@flex_attributes[:style] = params
|
86
|
-
end
|
87
|
-
|
88
94
|
def vertical_box(resources = [nil], **params, &block)
|
89
95
|
horizontal_box(resources, layout: "vertical", **params, &block)
|
90
96
|
end
|
data/lib/kamiflex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kamiflex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- etrex kuo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -49,7 +49,7 @@ licenses:
|
|
49
49
|
- MIT
|
50
50
|
metadata:
|
51
51
|
allowed_push_host: https://rubygems.org
|
52
|
-
post_install_message:
|
52
|
+
post_install_message:
|
53
53
|
rdoc_options: []
|
54
54
|
require_paths:
|
55
55
|
- lib
|
@@ -64,8 +64,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: '0'
|
66
66
|
requirements: []
|
67
|
-
rubygems_version: 3.
|
68
|
-
signing_key:
|
67
|
+
rubygems_version: 3.1.2
|
68
|
+
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: 'Kamiflex: generate JSON objects for Line flex message with a Builder-style
|
71
71
|
DSL'
|