gloo 0.5.1 → 0.5.2
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/Gemfile.lock +1 -1
- data/lib/gloo/app/info.rb +1 -1
- data/lib/gloo/objs/basic/container.rb +22 -1
- data/lib/gloo/objs/data/table.rb +1 -1
- data/lib/gloo/objs/web/http_post.rb +9 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62e053ee5dd0031478cca487810180928cf0f799fb865de3c87b4ae1ee85c9f9
|
4
|
+
data.tar.gz: 8ffddb0025e2a37b78f8b1d4ccf0b7314dc894a4cc22722ccb9122946e71e4b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bdfb7834a1f21a2a2ff38fe8f942433bfb5f15e851307681b438ef714320e0924918283630b0ee017b6f93e5fb35cadaec06d1981620044b0e50aa3b49c13e9
|
7
|
+
data.tar.gz: '0857dc12ae065532205d20a0d00179b92a58c416d384ead1e3a9432ed5af9439818750808893d391a85f87440eece6667f485f4b08738e0d0c196e1e0c27b19c'
|
data/Gemfile.lock
CHANGED
data/lib/gloo/app/info.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
#
|
4
4
|
# An object that contains a collection of other objects.
|
5
5
|
#
|
6
|
+
require 'tty-table'
|
7
|
+
require 'pastel'
|
6
8
|
|
7
9
|
module Gloo
|
8
10
|
module Objs
|
@@ -33,7 +35,7 @@ module Gloo
|
|
33
35
|
# Get a list of message names that this object receives.
|
34
36
|
#
|
35
37
|
def self.messages
|
36
|
-
return super + %w[count delete_children]
|
38
|
+
return super + %w[count delete_children show_key_value_table]
|
37
39
|
end
|
38
40
|
|
39
41
|
#
|
@@ -52,6 +54,23 @@ module Gloo
|
|
52
54
|
self.delete_children
|
53
55
|
end
|
54
56
|
|
57
|
+
#
|
58
|
+
# Show the given table data.
|
59
|
+
#
|
60
|
+
def msg_show_key_value_table
|
61
|
+
data = self.children.map { |o| [ o.name, o.value ] }
|
62
|
+
pastel = ::Pastel.new
|
63
|
+
table = TTY::Table.new rows: data
|
64
|
+
pad = [ 0, 1, 0, 1 ]
|
65
|
+
rendered = table.render( :ascii, indent: 2, padding: pad ) do |r|
|
66
|
+
r.border.style = :blue
|
67
|
+
r.filter = proc do |val, _row_index, col_index|
|
68
|
+
col_index.zero? ? pastel.blue( val ) : pastel.white( val )
|
69
|
+
end
|
70
|
+
end
|
71
|
+
puts "\n #{rendered}\n\n"
|
72
|
+
end
|
73
|
+
|
55
74
|
# ---------------------------------------------------------------------
|
56
75
|
# Help
|
57
76
|
# ---------------------------------------------------------------------
|
@@ -80,6 +99,8 @@ module Gloo
|
|
80
99
|
count - Count the number of children objects in the container.
|
81
100
|
The result is put in <it>.
|
82
101
|
delete_children - Delete all children objects from the container.
|
102
|
+
show_key_value_tbl - Show a table with key (name) and values
|
103
|
+
for all children in the container.
|
83
104
|
TEXT
|
84
105
|
end
|
85
106
|
|
data/lib/gloo/objs/data/table.rb
CHANGED
@@ -73,14 +73,8 @@ module Gloo
|
|
73
73
|
# for default configurations.
|
74
74
|
def add_default_children
|
75
75
|
fac = $engine.factory
|
76
|
-
fac.
|
77
|
-
|
78
|
-
:value => 'https://web.site/',
|
79
|
-
:parent => self } )
|
80
|
-
fac.create( { :name => 'body',
|
81
|
-
:type => 'container',
|
82
|
-
:value => nil,
|
83
|
-
:parent => self } )
|
76
|
+
fac.create_string URL, 'https://web.site/', self
|
77
|
+
fac.create_can BODY, self
|
84
78
|
end
|
85
79
|
|
86
80
|
# ---------------------------------------------------------------------
|
@@ -99,8 +93,11 @@ module Gloo
|
|
99
93
|
uri = uri_value
|
100
94
|
return unless uri
|
101
95
|
|
96
|
+
$log.debug "posting to: #{uri}"
|
97
|
+
body = self.body_as_json
|
98
|
+
$log.debug "posting body: #{body}"
|
102
99
|
use_ssl = uri.downcase.start_with?( 'https' )
|
103
|
-
Gloo::Objs::HttpPost.post_json uri,
|
100
|
+
Gloo::Objs::HttpPost.post_json uri, body, use_ssl
|
104
101
|
end
|
105
102
|
|
106
103
|
# ---------------------------------------------------------------------
|
@@ -118,7 +115,9 @@ module Gloo
|
|
118
115
|
n.use_ssl = use_ssl
|
119
116
|
|
120
117
|
# Send the payload to the endpoint.
|
121
|
-
n.start { |http| http.request( request ) }
|
118
|
+
result = n.start { |http| http.request( request ) }
|
119
|
+
$log.debug result.code
|
120
|
+
$log.debug result.message
|
122
121
|
end
|
123
122
|
|
124
123
|
# ---------------------------------------------------------------------
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gloo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Crane
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|