kamiflex 0.11.3 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kamiflex.rb +16 -0
- data/lib/kamiflex/core.rb +15 -4
- data/lib/kamiflex/custom.rb +10 -0
- data/lib/kamiflex/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9c0e63d45a74a91db303733a98b67ca7d86f9864a320a8dddeb80362e4e812f
|
4
|
+
data.tar.gz: 0e4a0b7ff1ed8ca8203253dcee0963574afc2670331c80de6a6fa51bb335a66a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20d529c449aaf92c79dc54ef9a9ab36b1e015a702bf5cd4991209a6e4d2b463327f5d3c3c0a4d5d49af2c789b20b8ef9cc82afbe59c364fcfc2ef0ae50f6ecd7
|
7
|
+
data.tar.gz: a10f3ed766e09479f92f1f5ba3983230e5c1d467db944e60d898d1493cceb526052482a0f04df758555ae57ec7189f7cc94529a2c0cda0460622ed07c6c04406
|
data/lib/kamiflex.rb
CHANGED
@@ -3,13 +3,29 @@ require_relative "./kamiflex/core"
|
|
3
3
|
require_relative "./kamiflex/basic_elements"
|
4
4
|
require_relative "./kamiflex/actions"
|
5
5
|
require_relative "./kamiflex/quick_reply"
|
6
|
+
require_relative "./kamiflex/custom"
|
6
7
|
|
7
8
|
module Kamiflex
|
9
|
+
def self.to_hash(parent)
|
10
|
+
parent.class.include Kamiflex::Core
|
11
|
+
parent.class.include Kamiflex::BasicElements
|
12
|
+
parent.class.include Kamiflex::Actions
|
13
|
+
parent.class.include Kamiflex::QuickReply
|
14
|
+
parent.class.include Kamiflex::Custom
|
15
|
+
|
16
|
+
parent.instance_exec do
|
17
|
+
flex do
|
18
|
+
yield
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
8
23
|
def self.build(parent)
|
9
24
|
parent.class.include Kamiflex::Core
|
10
25
|
parent.class.include Kamiflex::BasicElements
|
11
26
|
parent.class.include Kamiflex::Actions
|
12
27
|
parent.class.include Kamiflex::QuickReply
|
28
|
+
parent.class.include Kamiflex::Custom
|
13
29
|
|
14
30
|
hash = parent.instance_exec do
|
15
31
|
flex do
|
data/lib/kamiflex/core.rb
CHANGED
@@ -9,19 +9,21 @@ module Kamiflex
|
|
9
9
|
}.merge(attributes.slice(:quickReply))
|
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|
|
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.0
|
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
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/kamiflex/actions.rb
|
40
40
|
- lib/kamiflex/basic_elements.rb
|
41
41
|
- lib/kamiflex/core.rb
|
42
|
+
- lib/kamiflex/custom.rb
|
42
43
|
- lib/kamiflex/quick_reply.rb
|
43
44
|
- lib/kamiflex/railtie.rb
|
44
45
|
- lib/kamiflex/version.rb
|
@@ -48,7 +49,7 @@ licenses:
|
|
48
49
|
- MIT
|
49
50
|
metadata:
|
50
51
|
allowed_push_host: https://rubygems.org
|
51
|
-
post_install_message:
|
52
|
+
post_install_message:
|
52
53
|
rdoc_options: []
|
53
54
|
require_paths:
|
54
55
|
- lib
|
@@ -63,8 +64,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
64
|
- !ruby/object:Gem::Version
|
64
65
|
version: '0'
|
65
66
|
requirements: []
|
66
|
-
rubygems_version: 3.
|
67
|
-
signing_key:
|
67
|
+
rubygems_version: 3.1.2
|
68
|
+
signing_key:
|
68
69
|
specification_version: 4
|
69
70
|
summary: 'Kamiflex: generate JSON objects for Line flex message with a Builder-style
|
70
71
|
DSL'
|