Class: YuiRestClient::App
- Inherits:
-
Object
- Object
- YuiRestClient::App
- Defined in:
- lib/yui_rest_client/app.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#bargraph(filter) ⇒ Widgets::Bargraph
Initializes new instance of Bargraph with the filter provided.
-
#button(filter) ⇒ Widgets::Button
Initializes new instance of Button with the filter provided.
-
#check_api_version ⇒ Object
Validates if server side REST API is compatible with client inside.
-
#checkbox(filter) ⇒ Widgets::Checkbox
Initializes new instance of Checkbox with the filter provided.
-
#client_api_version ⇒ Object
Returns client side libyui REST API version.
-
#combobox(filter) ⇒ Widgets::Combobox
Initializes new instance of Combobox with the filter provided.
-
#connect ⇒ Object
wait until the specified port is open or until the timeout is reached.
-
#datefield(filter) ⇒ Widgets::Datefield
Initializes new instance of Datefield with the filter provided.
-
#initialize(host:, port:) ⇒ App
constructor
Used to initialize main entry point of YuiRestClient and set host and port for the application under control.
-
#label(filter) ⇒ Widgets::Label
Initializes new instance of Label with the filter provided.
-
#menucollection(filter) ⇒ Widgets::Menucollection
Initializes new instance of Menucollection with the filter provided.
-
#multilinebox(filter) ⇒ Widgets::Multilinebox
Initializes new instance of Multilinebox with the filter provided.
-
#numberbox(filter) ⇒ Widgets::Numberbox
Initializes new instance of Numberbox with the filter provided.
-
#progressbar(filter) ⇒ Widgets::Progressbar
Initializes new instance of Progressbar with the filter provided.
-
#radiobutton(filter) ⇒ Widgets::Radiobutton
Initializes new instance of Radiobutton with the filter provided.
-
#richtext(filter) ⇒ Widgets::Richtext
Initializes new instance of Richtext with the filter provided.
-
#selectionbox(filter) ⇒ Widgets::Selectionbox
Initializes new instance of Selectionbox with the filter provided.
-
#server_api_version ⇒ Object
Returns server side libyui REST API version.
-
#tab(filter) ⇒ Widgets::Tab
Initializes new instance of Tab with the filter provided.
-
#table(filter) ⇒ Widgets::Table
Initializes new instance of Table with the filter provided.
-
#textbox(filter) ⇒ Widgets::Textbox
Initializes new instance of Textbox with the filter provided.
-
#timefield(filter) ⇒ Widgets::Timefield
Initializes new instance of time field with the filter provided.
-
#tree(filter) ⇒ Widgets::Tree
Initializes new instance of Tree with the filter provided.
-
#wizard(filter) ⇒ Widgets::Wizard
Initializes new instance of Wizard with the filter provided.
Constructor Details
#initialize(host:, port:) ⇒ App
Used to initialize main entry point of YuiRestClient and set host and port for the application under control.
11 12 13 14 15 16 |
# File 'lib/yui_rest_client/app.rb', line 11 def initialize(host:, port:) @host = host @port = port @widget_controller = Http::WidgetController.new(host: host, port: port) @version_controller = Http::VersionController.new(host: host, port: port) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/yui_rest_client/app.rb', line 5 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/yui_rest_client/app.rb', line 5 def port @port end |
Instance Method Details
#bargraph(filter) ⇒ Widgets::Bargraph
Initializes new instance of Bargraph with the filter provided. Does not make request to libyui-rest-api.
34 35 36 |
# File 'lib/yui_rest_client/app.rb', line 34 def (filter) Widgets::Bargraph.new(@widget_controller, FilterExtractor.new(filter)) end |
#button(filter) ⇒ Widgets::Button
Initializes new instance of Button with the filter provided. Does not make request to libyui-rest-api.
44 45 46 |
# File 'lib/yui_rest_client/app.rb', line 44 def (filter) Widgets::Button.new(@widget_controller, FilterExtractor.new(filter)) end |
#check_api_version ⇒ Object
Validates if server side REST API is compatible with client inside
233 234 235 236 237 238 239 240 |
# File 'lib/yui_rest_client/app.rb', line 233 def check_api_version YuiRestClient.logger.info("Client API version: #{API_VERSION}") server_api_v = server_api_version raise Error::YuiRestClientError if server_api_v.nil? YuiRestClient.logger.info("Server API version: #{server_api_v}") server_api_v <= client_api_version end |
#checkbox(filter) ⇒ Widgets::Checkbox
Initializes new instance of Checkbox with the filter provided. Does not make request to libyui-rest-api.
54 55 56 |
# File 'lib/yui_rest_client/app.rb', line 54 def checkbox(filter) Widgets::Checkbox.new(@widget_controller, FilterExtractor.new(filter)) end |
#client_api_version ⇒ Object
Returns client side libyui REST API version
220 221 222 |
# File 'lib/yui_rest_client/app.rb', line 220 def client_api_version API_VERSION end |
#combobox(filter) ⇒ Widgets::Combobox
Initializes new instance of Combobox with the filter provided. Does not make request to libyui-rest-api.
64 65 66 |
# File 'lib/yui_rest_client/app.rb', line 64 def combobox(filter) Widgets::Combobox.new(@widget_controller, FilterExtractor.new(filter)) end |
#connect ⇒ Object
wait until the specified port is open or until the timeout is reached
20 21 22 23 24 25 26 |
# File 'lib/yui_rest_client/app.rb', line 20 def connect Wait.until(timeout: YuiRestClient.timeout, interval: YuiRestClient.interval) do YuiRestClient.logger.debug("Waiting for #{@host}:#{@port}...") port_open? end self end |
#datefield(filter) ⇒ Widgets::Datefield
Initializes new instance of Datefield with the filter provided. Does not make request to libyui-rest-api.
74 75 76 |
# File 'lib/yui_rest_client/app.rb', line 74 def datefield(filter) Widgets::Datefield.new(@widget_controller, FilterExtractor.new(filter)) end |
#label(filter) ⇒ Widgets::Label
Initializes new instance of Label with the filter provided. Does not make request to libyui-rest-api.
84 85 86 |
# File 'lib/yui_rest_client/app.rb', line 84 def label(filter) Widgets::Label.new(@widget_controller, FilterExtractor.new(filter)) end |
#menucollection(filter) ⇒ Widgets::Menucollection
Initializes new instance of Menucollection with the filter provided. Does not make request to libyui-rest-api.
94 95 96 |
# File 'lib/yui_rest_client/app.rb', line 94 def (filter) Widgets::Menucollection.new(@widget_controller, FilterExtractor.new(filter)) end |
#multilinebox(filter) ⇒ Widgets::Multilinebox
Initializes new instance of Multilinebox with the filter provided. Does not make request to libyui-rest-api.
104 105 106 |
# File 'lib/yui_rest_client/app.rb', line 104 def multilinebox(filter) Widgets::Multilinebox.new(@widget_controller, FilterExtractor.new(filter)) end |
#numberbox(filter) ⇒ Widgets::Numberbox
Initializes new instance of Numberbox with the filter provided. Does not make request to libyui-rest-api.
114 115 116 |
# File 'lib/yui_rest_client/app.rb', line 114 def numberbox(filter) Widgets::Numberbox.new(@widget_controller, FilterExtractor.new(filter)) end |
#progressbar(filter) ⇒ Widgets::Progressbar
Initializes new instance of Progressbar with the filter provided. Does not make request to libyui-rest-api.
124 125 126 |
# File 'lib/yui_rest_client/app.rb', line 124 def (filter) Widgets::Progressbar.new(@widget_controller, FilterExtractor.new(filter)) end |
#radiobutton(filter) ⇒ Widgets::Radiobutton
Initializes new instance of Radiobutton with the filter provided. Does not make request to libyui-rest-api.
134 135 136 |
# File 'lib/yui_rest_client/app.rb', line 134 def (filter) Widgets::Radiobutton.new(@widget_controller, FilterExtractor.new(filter)) end |
#richtext(filter) ⇒ Widgets::Richtext
Initializes new instance of Richtext with the filter provided. Does not make request to libyui-rest-api.
144 145 146 |
# File 'lib/yui_rest_client/app.rb', line 144 def richtext(filter) Widgets::Richtext.new(@widget_controller, FilterExtractor.new(filter)) end |
#selectionbox(filter) ⇒ Widgets::Selectionbox
Initializes new instance of Selectionbox with the filter provided. Does not make request to libyui-rest-api.
154 155 156 |
# File 'lib/yui_rest_client/app.rb', line 154 def selectionbox(filter) Widgets::Selectionbox.new(@widget_controller, FilterExtractor.new(filter)) end |
#server_api_version ⇒ Object
Returns server side libyui REST API version
226 227 228 |
# File 'lib/yui_rest_client/app.rb', line 226 def server_api_version @version_controller.api_version end |
#tab(filter) ⇒ Widgets::Tab
Initializes new instance of Tab with the filter provided. Does not make request to libyui-rest-api.
164 165 166 |
# File 'lib/yui_rest_client/app.rb', line 164 def tab(filter) Widgets::Tab.new(@widget_controller, FilterExtractor.new(filter)) end |
#table(filter) ⇒ Widgets::Table
Initializes new instance of Table with the filter provided. Does not make request to libyui-rest-api.
174 175 176 |
# File 'lib/yui_rest_client/app.rb', line 174 def table(filter) Widgets::Table.new(@widget_controller, FilterExtractor.new(filter)) end |
#textbox(filter) ⇒ Widgets::Textbox
Initializes new instance of Textbox with the filter provided. Does not make request to libyui-rest-api.
194 195 196 |
# File 'lib/yui_rest_client/app.rb', line 194 def textbox(filter) Widgets::Textbox.new(@widget_controller, FilterExtractor.new(filter)) end |
#timefield(filter) ⇒ Widgets::Timefield
Initializes new instance of time field with the filter provided. Does not make request to libyui-rest-api.
184 185 186 |
# File 'lib/yui_rest_client/app.rb', line 184 def timefield(filter) Widgets::Timefield.new(@widget_controller, FilterExtractor.new(filter)) end |
#tree(filter) ⇒ Widgets::Tree
Initializes new instance of Tree with the filter provided. Does not make request to libyui-rest-api.
204 205 206 |
# File 'lib/yui_rest_client/app.rb', line 204 def tree(filter) Widgets::Tree.new(@widget_controller, FilterExtractor.new(filter)) end |
#wizard(filter) ⇒ Widgets::Wizard
Initializes new instance of Wizard with the filter provided. Does not make request to libyui-rest-api.
214 215 216 |
# File 'lib/yui_rest_client/app.rb', line 214 def wizard(filter) Widgets::Wizard.new(@widget_controller, FilterExtractor.new(filter)) end |