Class: HaveAPI::Fs::RemoteControl
- Inherits:
-
Object
- Object
- HaveAPI::Fs::RemoteControl
- Defined in:
- lib/haveapi/fs/remote_control.rb
Overview
The purpose of this class is to handle commands received via the Components::RemoteControlFile.
Class Method Summary collapse
-
.execute(context, path) ⇒ Object
Call method #exec of a component at
path
.
Class Method Details
.execute(context, path) ⇒ Object
Call method #exec of a component at path
.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/haveapi/fs/remote_control.rb', line 9 def self.execute(context, path) c = context.fs.send(:find_component, path) ret = c.exec case ret when true {status: true} when HaveAPI::Client::Response {status: ret.ok?, message: ret., errors: ret.errors} when HaveAPI::Client::ValidationError {status: false, message: ret., errors: ret.errors} else {status: false, message: 'unknown response'} end end |