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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8285c6a18070b8195357d8446e6b98dbb1f93855542e7abb213c5b6ae437c881
4
- data.tar.gz: 51f537fc96dec685233bf705a2788971278d6056d4c05e580dda1abd7dae19e0
3
+ metadata.gz: 62e053ee5dd0031478cca487810180928cf0f799fb865de3c87b4ae1ee85c9f9
4
+ data.tar.gz: 8ffddb0025e2a37b78f8b1d4ccf0b7314dc894a4cc22722ccb9122946e71e4b5
5
5
  SHA512:
6
- metadata.gz: b1b59636ac2d49dda9e656c749a57115300b922c270d100b0f7b7da4df801ccea73ab7938d98b77b996ea3f50429658700ffedcf23bd873507bc282469c1cf35
7
- data.tar.gz: b9ce5396190e90c0a88410217370dd5385fef029d5793a49c5194476ad498fdabe4e22b7cc5842c6c38dc4dfc9b7447784fc85155cdf89820a3fdc603bdb22dc
6
+ metadata.gz: 1bdfb7834a1f21a2a2ff38fe8f942433bfb5f15e851307681b438ef714320e0924918283630b0ee017b6f93e5fb35cadaec06d1981620044b0e50aa3b49c13e9
7
+ data.tar.gz: '0857dc12ae065532205d20a0d00179b92a58c416d384ead1e3a9432ed5af9439818750808893d391a85f87440eece6667f485f4b08738e0d0c196e1e0c27b19c'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gloo (0.5.0)
4
+ gloo (0.5.1)
5
5
  activesupport (~> 5.2, >= 5.2.4.3)
6
6
  chronic (~> 0.10, >= 0.10.2)
7
7
  colorize (~> 0.8, >= 0.8.1)
@@ -8,7 +8,7 @@ module Gloo
8
8
  module App
9
9
  class Info
10
10
 
11
- VERSION = '0.5.1'.freeze
11
+ VERSION = '0.5.2'.freeze
12
12
  APP_NAME = 'Gloo'.freeze
13
13
 
14
14
  # Get the application display title.
@@ -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
 
@@ -94,7 +94,7 @@ module Gloo
94
94
  # Get a list of message names that this object receives.
95
95
  #
96
96
  def self.messages
97
- return super + [ 'show' ]
97
+ return super + %w[show]
98
98
  end
99
99
 
100
100
  #
@@ -73,14 +73,8 @@ module Gloo
73
73
  # for default configurations.
74
74
  def add_default_children
75
75
  fac = $engine.factory
76
- fac.create( { :name => 'uri',
77
- :type => 'string',
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, body_as_json, use_ssl
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.1
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-12 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler