gloo 0.7.6 → 1.0.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.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/Gemfile.lock +46 -39
  4. data/LICENSE.txt +1 -1
  5. data/gloo.gemspec +12 -6
  6. data/lib/VERSION +1 -1
  7. data/lib/dependencies.rb +28 -0
  8. data/lib/gloo/app/info.rb +3 -1
  9. data/lib/gloo/app/log.rb +1 -29
  10. data/lib/gloo/app/platform.rb +142 -0
  11. data/lib/gloo/objs/cli/banner.rb +2 -2
  12. data/lib/gloo/objs/cli/bar.rb +4 -4
  13. data/lib/gloo/objs/cli/colorize.rb +3 -3
  14. data/lib/gloo/objs/cli/confirm.rb +3 -3
  15. data/lib/gloo/objs/cli/menu.rb +9 -9
  16. data/lib/gloo/objs/cli/menu_item.rb +2 -2
  17. data/lib/gloo/objs/cli/pastel.rb +2 -2
  18. data/lib/gloo/objs/cli/prompt.rb +4 -4
  19. data/lib/gloo/objs/cli/select.rb +4 -4
  20. data/lib/gloo/objs/dev/git.rb +7 -7
  21. data/lib/gloo/objs/dev/stats.rb +8 -5
  22. data/lib/gloo/objs/snd/play.rb +1 -1
  23. data/lib/gloo/objs/snd/say.rb +2 -2
  24. data/lib/gloo/objs/system/file_handle.rb +9 -9
  25. data/lib/gloo/objs/system/ssh_exec.rb +3 -3
  26. data/lib/gloo/objs/system/system.rb +2 -2
  27. data/lib/gloo/verbs/alert.rb +7 -7
  28. data/lib/gloo/verbs/beep.rb +1 -1
  29. data/lib/gloo/verbs/cls.rb +2 -2
  30. data/lib/gloo.rb +7 -7
  31. data/lib/run.rb +7 -5
  32. metadata +42 -147
  33. data/lib/gloo/app/args.rb +0 -112
  34. data/lib/gloo/app/engine.rb +0 -230
  35. data/lib/gloo/app/help.rb +0 -156
  36. data/lib/gloo/app/mode.rb +0 -27
  37. data/lib/gloo/app/settings.rb +0 -186
  38. data/lib/gloo/convert/converter.rb +0 -35
  39. data/lib/gloo/convert/string_to_datetime.rb +0 -21
  40. data/lib/gloo/convert/string_to_decimal.rb +0 -20
  41. data/lib/gloo/convert/string_to_integer.rb +0 -20
  42. data/lib/gloo/core/baseo.rb +0 -28
  43. data/lib/gloo/core/dictionary.rb +0 -181
  44. data/lib/gloo/core/error.rb +0 -61
  45. data/lib/gloo/core/event_manager.rb +0 -44
  46. data/lib/gloo/core/factory.rb +0 -210
  47. data/lib/gloo/core/gloo_system.rb +0 -266
  48. data/lib/gloo/core/heap.rb +0 -52
  49. data/lib/gloo/core/here.rb +0 -36
  50. data/lib/gloo/core/it.rb +0 -36
  51. data/lib/gloo/core/literal.rb +0 -30
  52. data/lib/gloo/core/obj.rb +0 -305
  53. data/lib/gloo/core/obj_finder.rb +0 -30
  54. data/lib/gloo/core/op.rb +0 -40
  55. data/lib/gloo/core/parser.rb +0 -59
  56. data/lib/gloo/core/pn.rb +0 -188
  57. data/lib/gloo/core/tokens.rb +0 -165
  58. data/lib/gloo/core/verb.rb +0 -86
  59. data/lib/gloo/exec/action.rb +0 -48
  60. data/lib/gloo/exec/dispatch.rb +0 -40
  61. data/lib/gloo/exec/exec_env.rb +0 -74
  62. data/lib/gloo/exec/runner.rb +0 -45
  63. data/lib/gloo/exec/script.rb +0 -49
  64. data/lib/gloo/exec/stack.rb +0 -78
  65. data/lib/gloo/expr/expression.rb +0 -118
  66. data/lib/gloo/expr/l_boolean.rb +0 -36
  67. data/lib/gloo/expr/l_decimal.rb +0 -39
  68. data/lib/gloo/expr/l_integer.rb +0 -37
  69. data/lib/gloo/expr/l_string.rb +0 -58
  70. data/lib/gloo/expr/op_div.rb +0 -22
  71. data/lib/gloo/expr/op_minus.rb +0 -22
  72. data/lib/gloo/expr/op_mult.rb +0 -22
  73. data/lib/gloo/expr/op_plus.rb +0 -24
  74. data/lib/gloo/objs/basic/alias.rb +0 -78
  75. data/lib/gloo/objs/basic/boolean.rb +0 -120
  76. data/lib/gloo/objs/basic/container.rb +0 -76
  77. data/lib/gloo/objs/basic/decimal.rb +0 -76
  78. data/lib/gloo/objs/basic/integer.rb +0 -73
  79. data/lib/gloo/objs/basic/script.rb +0 -99
  80. data/lib/gloo/objs/basic/string.rb +0 -77
  81. data/lib/gloo/objs/basic/text.rb +0 -87
  82. data/lib/gloo/objs/basic/untyped.rb +0 -41
  83. data/lib/gloo/objs/ctrl/each.rb +0 -279
  84. data/lib/gloo/objs/ctrl/repeat.rb +0 -108
  85. data/lib/gloo/objs/data/markdown.rb +0 -84
  86. data/lib/gloo/objs/data/mysql.rb +0 -192
  87. data/lib/gloo/objs/data/query.rb +0 -176
  88. data/lib/gloo/objs/data/sqlite.rb +0 -159
  89. data/lib/gloo/objs/data/table.rb +0 -140
  90. data/lib/gloo/objs/dt/date.rb +0 -50
  91. data/lib/gloo/objs/dt/datetime.rb +0 -62
  92. data/lib/gloo/objs/dt/time.rb +0 -50
  93. data/lib/gloo/objs/ror/erb.rb +0 -116
  94. data/lib/gloo/objs/ror/eval.rb +0 -107
  95. data/lib/gloo/objs/web/http_get.rb +0 -159
  96. data/lib/gloo/objs/web/http_post.rb +0 -183
  97. data/lib/gloo/objs/web/json.rb +0 -135
  98. data/lib/gloo/objs/web/slack.rb +0 -130
  99. data/lib/gloo/objs/web/teams.rb +0 -117
  100. data/lib/gloo/objs/web/uri.rb +0 -148
  101. data/lib/gloo/persist/file_loader.rb +0 -191
  102. data/lib/gloo/persist/file_saver.rb +0 -49
  103. data/lib/gloo/persist/file_storage.rb +0 -45
  104. data/lib/gloo/persist/line_splitter.rb +0 -81
  105. data/lib/gloo/persist/persist_man.rb +0 -120
  106. data/lib/gloo/utils/format.rb +0 -21
  107. data/lib/gloo/utils/stats.rb +0 -205
  108. data/lib/gloo/utils/words.rb +0 -19
  109. data/lib/gloo/verbs/context.rb +0 -62
  110. data/lib/gloo/verbs/create.rb +0 -68
  111. data/lib/gloo/verbs/execute.rb +0 -56
  112. data/lib/gloo/verbs/help.rb +0 -264
  113. data/lib/gloo/verbs/if.rb +0 -92
  114. data/lib/gloo/verbs/list.rb +0 -98
  115. data/lib/gloo/verbs/load.rb +0 -45
  116. data/lib/gloo/verbs/move.rb +0 -89
  117. data/lib/gloo/verbs/put.rb +0 -94
  118. data/lib/gloo/verbs/quit.rb +0 -40
  119. data/lib/gloo/verbs/run.rb +0 -75
  120. data/lib/gloo/verbs/save.rb +0 -39
  121. data/lib/gloo/verbs/show.rb +0 -64
  122. data/lib/gloo/verbs/tell.rb +0 -79
  123. data/lib/gloo/verbs/unless.rb +0 -92
  124. data/lib/gloo/verbs/version.rb +0 -37
  125. data/lib/gloo/verbs/wait.rb +0 -42
@@ -1,140 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # A data table.
5
- # The table container headers and data.
6
- #
7
- require 'tty-table'
8
- require 'pastel'
9
-
10
- module Gloo
11
- module Objs
12
- class Table < Gloo::Core::Obj
13
-
14
- KEYWORD = 'table'.freeze
15
- KEYWORD_SHORT = 'tbl'.freeze
16
- HEADERS = 'headers'.freeze
17
- DATA = 'data'.freeze
18
-
19
- #
20
- # The name of the object type.
21
- #
22
- def self.typename
23
- return KEYWORD
24
- end
25
-
26
- #
27
- # The short name of the object type.
28
- #
29
- def self.short_typename
30
- return KEYWORD_SHORT
31
- end
32
-
33
- #
34
- # Get the list of headers.
35
- # Returns nil if there is none.
36
- #
37
- def headers
38
- o = find_child HEADERS
39
- return [] unless o
40
-
41
- return o.children.map( &:value )
42
- end
43
-
44
- #
45
- # Get the list of column names.
46
- # Returns nil if there is none.
47
- #
48
- def columns
49
- o = find_child HEADERS
50
- return [] unless o
51
-
52
- return o.children.map( &:name )
53
- end
54
-
55
- #
56
- # Get the list of data elements.
57
- #
58
- def data
59
- o = find_child DATA
60
- return [] unless o
61
-
62
- o = Gloo::Objs::Alias.resolve_alias( o )
63
- cols = self.columns
64
- return o.children.map do |e|
65
- cols.map { |h| e.find_child( h ).value }
66
- end
67
- end
68
-
69
- # ---------------------------------------------------------------------
70
- # Children
71
- # ---------------------------------------------------------------------
72
-
73
- #
74
- # Does this object have children to add when an object
75
- # is created in interactive mode?
76
- # This does not apply during obj load, etc.
77
- #
78
- def add_children_on_create?
79
- return true
80
- end
81
-
82
- #
83
- # Add children to this object.
84
- # This is used by containers to add children needed
85
- # for default configurations.
86
- #
87
- def add_default_children
88
- fac = $engine.factory
89
- fac.create_can HEADERS, self
90
- fac.create_can DATA, self
91
- end
92
-
93
- # ---------------------------------------------------------------------
94
- # Messages
95
- # ---------------------------------------------------------------------
96
-
97
- #
98
- # Get a list of message names that this object receives.
99
- #
100
- def self.messages
101
- return super + %w[show]
102
- end
103
-
104
- #
105
- # Show the table in the CLI.
106
- #
107
- def msg_show
108
- title = self.value
109
- Gloo::Objs::Table.show headers, data, title
110
- end
111
-
112
- # ---------------------------------------------------------------------
113
- # Static table helper
114
- # ---------------------------------------------------------------------
115
-
116
- #
117
- # Show the given table data.
118
- #
119
- def self.show( headers, data, title = nil )
120
- pastel = ::Pastel.new
121
- table = TTY::Table.new headers, data
122
- pad = [ 0, 1, 0, 1 ]
123
- rendered = table.render( :ascii, indent: 2, padding: pad ) do |r|
124
- r.border.style = :blue
125
- r.filter = proc do |val, row_index, _col_index|
126
- # col_index % 2 == 1 ? pastel.red.on_green(val) : val
127
- if row_index.zero?
128
- pastel.blue( val )
129
- else
130
- row_index.odd? ? pastel.white( val ) : pastel.yellow( val )
131
- end
132
- end
133
- end
134
- puts "\n#{title.white}"
135
- puts "#{rendered}\n\n"
136
- end
137
-
138
- end
139
- end
140
- end
@@ -1,50 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # A Date object (does not include a time).
5
- #
6
-
7
- module Gloo
8
- module Objs
9
- class Date < Gloo::Core::Obj
10
-
11
- KEYWORD = 'date'.freeze
12
- KEYWORD_SHORT = 'date'.freeze
13
-
14
- #
15
- # The name of the object type.
16
- #
17
- def self.typename
18
- return KEYWORD
19
- end
20
-
21
- #
22
- # The short name of the object type.
23
- #
24
- def self.short_typename
25
- return KEYWORD_SHORT
26
- end
27
-
28
- # ---------------------------------------------------------------------
29
- # Messages
30
- # ---------------------------------------------------------------------
31
-
32
- #
33
- # Get a list of message names that this object receives.
34
- #
35
- def self.messages
36
- return super + %w[now]
37
- end
38
-
39
- #
40
- # Set to the current date.
41
- #
42
- def msg_now
43
- t = DateTime.now.strftime( '%Y.%m.%d' )
44
- self.value = t
45
- $engine.heap.it.set_to t
46
- end
47
-
48
- end
49
- end
50
- end
@@ -1,62 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # A Date and Time object.
5
- #
6
-
7
- module Gloo
8
- module Objs
9
- class Datetime < Gloo::Core::Obj
10
-
11
- KEYWORD = 'datetime'.freeze
12
- KEYWORD_SHORT = 'dt'.freeze
13
-
14
- #
15
- # The name of the object type.
16
- #
17
- def self.typename
18
- return KEYWORD
19
- end
20
-
21
- #
22
- # The short name of the object type.
23
- #
24
- def self.short_typename
25
- return KEYWORD_SHORT
26
- end
27
-
28
- #
29
- # Set the value with any necessary type conversions.
30
- #
31
- def set_value( new_value )
32
- unless new_value.is_a? DateTime
33
- self.value = $engine.converter.convert( new_value, 'DateTime', nil )
34
- return
35
- end
36
-
37
- self.value = new_value
38
- end
39
-
40
- # ---------------------------------------------------------------------
41
- # Messages
42
- # ---------------------------------------------------------------------
43
-
44
- #
45
- # Get a list of message names that this object receives.
46
- #
47
- def self.messages
48
- return super + %w[now]
49
- end
50
-
51
- #
52
- # Set to the current date and time.
53
- #
54
- def msg_now
55
- t = DateTime.now.strftime( '%Y.%m.%d %I:%M:%S %P' )
56
- self.value = t
57
- $engine.heap.it.set_to t
58
- end
59
-
60
- end
61
- end
62
- end
@@ -1,50 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # A Time object (does not include a date).
5
- #
6
-
7
- module Gloo
8
- module Objs
9
- class Time < Gloo::Core::Obj
10
-
11
- KEYWORD = 'time'.freeze
12
- KEYWORD_SHORT = 'time'.freeze
13
-
14
- #
15
- # The name of the object type.
16
- #
17
- def self.typename
18
- return KEYWORD
19
- end
20
-
21
- #
22
- # The short name of the object type.
23
- #
24
- def self.short_typename
25
- return KEYWORD_SHORT
26
- end
27
-
28
- # ---------------------------------------------------------------------
29
- # Messages
30
- # ---------------------------------------------------------------------
31
-
32
- #
33
- # Get a list of message names that this object receives.
34
- #
35
- def self.messages
36
- return super + %w[now]
37
- end
38
-
39
- #
40
- # Set to the current time.
41
- #
42
- def msg_now
43
- t = DateTime.now.strftime( '%I:%M:%S %P' )
44
- self.value = t
45
- $engine.heap.it.set_to t
46
- end
47
-
48
- end
49
- end
50
- end
@@ -1,116 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # An object that evaluate a ruby statement.
5
- #
6
- require 'erb'
7
-
8
- module Gloo
9
- module Objs
10
- class Erb < Gloo::Core::Obj
11
-
12
- KEYWORD = 'erb'.freeze
13
- KEYWORD_SHORT = 'erb'.freeze
14
- TEMPLATE = 'template'.freeze
15
- PARAMS = 'params'.freeze
16
- RESULT = 'result'.freeze
17
-
18
- #
19
- # The name of the object type.
20
- #
21
- def self.typename
22
- return KEYWORD
23
- end
24
-
25
- #
26
- # The short name of the object type.
27
- #
28
- def self.short_typename
29
- return KEYWORD_SHORT
30
- end
31
-
32
- #
33
- # Get the ERB template.
34
- #
35
- def template_value
36
- tmpl = find_child TEMPLATE
37
- return nil unless tmpl
38
-
39
- return tmpl.value
40
- end
41
-
42
- #
43
- # Set the result of the ERB template conversion.
44
- #
45
- def set_result( data )
46
- r = find_child RESULT
47
- return nil unless r
48
-
49
- r.set_value data
50
- end
51
-
52
- #
53
- # Get a hash with parameters for the ERB render.
54
- #
55
- def param_hash
56
- h = {}
57
-
58
- body = find_child PARAMS
59
- body.children.each do |child|
60
- child = Gloo::Objs::Alias.resolve_alias( child )
61
- h[ child.name ] = child.value
62
- end
63
-
64
- return h
65
- end
66
-
67
- # ---------------------------------------------------------------------
68
- # Children
69
- # ---------------------------------------------------------------------
70
-
71
- #
72
- # Does this object have children to add when an object
73
- # is created in interactive mode?
74
- # This does not apply during obj load, etc.
75
- #
76
- def add_children_on_create?
77
- return true
78
- end
79
-
80
- #
81
- # Add children to this object.
82
- # This is used by containers to add children needed
83
- # for default configurations.
84
- #
85
- def add_default_children
86
- fac = $engine.factory
87
- fac.create_text TEMPLATE, '', self
88
- fac.create_can PARAMS, self
89
- fac.create_text RESULT, '', self
90
- end
91
-
92
- # ---------------------------------------------------------------------
93
- # Messages
94
- # ---------------------------------------------------------------------
95
-
96
- #
97
- # Get a list of message names that this object receives.
98
- #
99
- def self.messages
100
- return super + [ 'run' ]
101
- end
102
-
103
- #
104
- # Run the ERB template conversion.
105
- #
106
- def msg_run
107
- tmpl = template_value
108
- return unless tmpl
109
-
110
- render = ERB.new( tmpl )
111
- set_result render.result_with_hash( param_hash )
112
- end
113
-
114
- end
115
- end
116
- end
@@ -1,107 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # An object that evaluate a ruby statement.
5
- #
6
-
7
- module Gloo
8
- module Objs
9
- class Eval < Gloo::Core::Obj
10
-
11
- KEYWORD = 'eval'.freeze
12
- KEYWORD_SHORT = 'ruby'.freeze
13
- CMD = 'command'.freeze
14
- DEFAULT_CMD = '1+2'.freeze
15
- RESULT = 'result'.freeze
16
-
17
- #
18
- # The name of the object type.
19
- #
20
- def self.typename
21
- return KEYWORD
22
- end
23
-
24
- #
25
- # The short name of the object type.
26
- #
27
- def self.short_typename
28
- return KEYWORD_SHORT
29
- end
30
-
31
- #
32
- # Get the URI from the child object.
33
- # Returns nil if there is none.
34
- #
35
- def cmd_value
36
- cmd = find_child CMD
37
- return nil unless cmd
38
-
39
- return cmd.value
40
- end
41
-
42
- #
43
- # Set the result of the system call.
44
- #
45
- def set_result( data )
46
- r = find_child RESULT
47
- return nil unless r
48
-
49
- r.set_value data
50
- end
51
-
52
- # ---------------------------------------------------------------------
53
- # Children
54
- # ---------------------------------------------------------------------
55
-
56
- #
57
- # Does this object have children to add when an object
58
- # is created in interactive mode?
59
- # This does not apply during obj load, etc.
60
- #
61
- def add_children_on_create?
62
- return true
63
- end
64
-
65
- #
66
- # Add children to this object.
67
- # This is used by containers to add children needed
68
- # for default configurations.
69
- #
70
- def add_default_children
71
- fac = $engine.factory
72
- fac.create_string CMD, DEFAULT_CMD, self
73
- fac.create_string RESULT, nil, self
74
- end
75
-
76
- # ---------------------------------------------------------------------
77
- # Messages
78
- # ---------------------------------------------------------------------
79
-
80
- #
81
- # Get a list of message names that this object receives.
82
- #
83
- def self.messages
84
- return super + [ 'run' ]
85
- end
86
-
87
- #
88
- # Run the command and evaluate the expression.
89
- #
90
- def msg_run
91
- cmd = cmd_value
92
- return unless cmd
93
-
94
- begin
95
- # rubocop:disable Security/Eval
96
- result = eval cmd
97
- # rubocop:enable Security/Eval
98
- set_result result
99
- $engine.heap.it.set_to result
100
- rescue => e
101
- $engine.err e.message
102
- end
103
- end
104
-
105
- end
106
- end
107
- end
@@ -1,159 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # An object that can post JSON to a URI.
5
- #
6
- require 'net/http'
7
- require 'uri'
8
- require 'json'
9
- require 'openssl'
10
-
11
- module Gloo
12
- module Objs
13
- class HttpGet < Gloo::Core::Obj
14
-
15
- KEYWORD = 'http_get'.freeze
16
- KEYWORD_SHORT = 'get'.freeze
17
- URL = 'uri'.freeze
18
- DEFAULT_URL = 'https://web.site/'.freeze
19
- PARAMS = 'params'.freeze
20
- RESULT = 'result'.freeze
21
- SKIP_SSL_VERIFY = 'skip_ssl_verify'.freeze
22
-
23
- #
24
- # The name of the object type.
25
- #
26
- def self.typename
27
- return KEYWORD
28
- end
29
-
30
- #
31
- # The short name of the object type.
32
- #
33
- def self.short_typename
34
- return KEYWORD_SHORT
35
- end
36
-
37
- # ---------------------------------------------------------------------
38
- # Children
39
- # ---------------------------------------------------------------------
40
-
41
- #
42
- # Does this object have children to add when an object
43
- # is created in interactive mode?
44
- # This does not apply during obj load, etc.
45
- #
46
- def add_children_on_create?
47
- return true
48
- end
49
-
50
- #
51
- # Add children to this object.
52
- # This is used by containers to add children needed
53
- # for default configurations.
54
- #
55
- def add_default_children
56
- fac = $engine.factory
57
- fac.create_string URL, DEFAULT_URL, self
58
- fac.create_can PARAMS, self
59
- fac.create_string RESULT, nil, self
60
- end
61
-
62
- # ---------------------------------------------------------------------
63
- # Messages
64
- # ---------------------------------------------------------------------
65
-
66
- #
67
- # Get a list of message names that this object receives.
68
- #
69
- def self.messages
70
- return super + [ 'run' ]
71
- end
72
-
73
- #
74
- # Post the content to the endpoint.
75
- #
76
- def msg_run
77
- url = full_url_value
78
- $log.debug url
79
- r = Gloo::Objs::HttpGet.invoke_request( url, skip_ssl_verify? )
80
- update_result r
81
- end
82
-
83
- # ---------------------------------------------------------------------
84
- # Static functions
85
- # ---------------------------------------------------------------------
86
-
87
- #
88
- # Post the content to the endpoint.
89
- #
90
- def self.invoke_request( url, skip_ssl_verify = false )
91
- uri = URI( url )
92
- params = { use_ssl: uri.scheme == 'https' }
93
-
94
- params[ :verify_mode ] = ::OpenSSL::SSL::VERIFY_NONE if skip_ssl_verify
95
-
96
- Net::HTTP.start( uri.host, uri.port, params ) do |http|
97
- request = Net::HTTP::Get.new uri
98
- response = http.request request # Net::HTTPResponse object
99
- return response.body
100
- end
101
- end
102
-
103
- # ---------------------------------------------------------------------
104
- # Private functions
105
- # ---------------------------------------------------------------------
106
-
107
- private
108
-
109
- #
110
- # Get the URI from the child object.
111
- # Returns nil if there is none.
112
- #
113
- def uri_value
114
- uri = find_child URL
115
- return nil unless uri
116
-
117
- return uri.value
118
- end
119
-
120
- #
121
- # Should we skip SSL verification during the request?
122
- #
123
- def skip_ssl_verify?
124
- skip = find_child SKIP_SSL_VERIFY
125
- return false unless skip
126
-
127
- return skip.value
128
- end
129
-
130
- #
131
- # Set the result of the API call.
132
- #
133
- def update_result( data )
134
- r = find_child RESULT
135
- return nil unless r
136
-
137
- r.set_value data
138
- end
139
-
140
- #
141
- # Get the URL for the service including all URL params.
142
- #
143
- def full_url_value
144
- p = ''
145
- params = find_child PARAMS
146
- params.children.each do |child|
147
- p << ( p.empty? ? '?' : '&' )
148
-
149
- child = Gloo::Objs::Alias.resolve_alias( child )
150
-
151
- # TODO: Quote URL params for safety
152
- p << "#{child.name}=#{child.value}"
153
- end
154
- return "#{uri_value}#{p}"
155
- end
156
-
157
- end
158
- end
159
- end