Class: BrowserStack::Worker
- Inherits:
-
ApiRequest
- Object
- ApiRequest
- BrowserStack::Worker
- Defined in:
- lib/browser_stack/worker.rb
Instance Attribute Summary collapse
-
#browser ⇒ Object
Returns the value of attribute browser.
-
#browser_version ⇒ Object
Returns the value of attribute browser_version.
-
#os ⇒ Object
Returns the value of attribute os.
-
#os_version ⇒ Object
Returns the value of attribute os_version.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from ApiRequest
#config, #http_client, #params, #request, #response, #uri
Class Method Summary collapse
- .create_worker(params = {}) ⇒ Object
- .get_all_worker_status ⇒ Object
- .get_worker_status(worker_id) ⇒ Object
- .treminate_worker(worker_id) ⇒ Object
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Worker
constructor
A new instance of Worker.
- #valid? ⇒ Boolean
Methods inherited from ApiRequest
#api_error?, #authenticate, #commit, #error_message, #get_http_client, #parse_response, #set_uri
Constructor Details
#initialize(attributes = {}) ⇒ Worker
Returns a new instance of Worker.
4 5 6 7 8 9 10 11 12 |
# File 'lib/browser_stack/worker.rb', line 4 def initialize(attributes={}) attributes.each do |name, value| begin send("#{name}=", value) rescue puts "invalid attribute #{name} in worker" end end end |
Instance Attribute Details
#browser ⇒ Object
Returns the value of attribute browser.
3 4 5 |
# File 'lib/browser_stack/worker.rb', line 3 def browser @browser end |
#browser_version ⇒ Object
Returns the value of attribute browser_version.
3 4 5 |
# File 'lib/browser_stack/worker.rb', line 3 def browser_version @browser_version end |
#os ⇒ Object
Returns the value of attribute os.
3 4 5 |
# File 'lib/browser_stack/worker.rb', line 3 def os @os end |
#os_version ⇒ Object
Returns the value of attribute os_version.
3 4 5 |
# File 'lib/browser_stack/worker.rb', line 3 def os_version @os_version end |
#timeout ⇒ Object
Returns the value of attribute timeout.
3 4 5 |
# File 'lib/browser_stack/worker.rb', line 3 def timeout @timeout end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/browser_stack/worker.rb', line 3 def url @url end |
Class Method Details
.create_worker(params = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/browser_stack/worker.rb', line 19 def create_worker(params={}) worker = Worker.new(params) if worker.valid? worker.commit("/worker","post",params) else # raise some error raise "Not Valid should contain os,os_version,url parameter" end worker end |
.get_all_worker_status ⇒ Object
42 43 44 45 46 |
# File 'lib/browser_stack/worker.rb', line 42 def get_all_worker_status worker = Worker.new worker.commit("/workers") worker end |
Instance Method Details
#valid? ⇒ Boolean
14 15 16 |
# File 'lib/browser_stack/worker.rb', line 14 def valid? os && os_version && url end |