Class: Appthwack::Client
- Inherits:
-
Object
- Object
- Appthwack::Client
- Defined in:
- lib/appthwack/client.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#last_request ⇒ Object
Returns the value of attribute last_request.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
Instance Method Summary collapse
- #create_device_pool(name, device_ids) ⇒ Object
- #device_pools(project_id) ⇒ Object
- #devices ⇒ Object
-
#initialize(api_token, options = {}) ⇒ Client
constructor
A new instance of Client.
- #projects ⇒ Object
- #schedule_test(name, project_id, app_file_id, opt = {}) ⇒ Object
- #test_run_results(project_id, run_id) ⇒ Object
- #test_run_status(project_id, run_id) ⇒ Object
- #upload_file(name, file) ⇒ Object
Constructor Details
#initialize(api_token, options = {}) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 10 11 12 13 |
# File 'lib/appthwack/client.rb', line 5 def initialize(api_token, ={}) @api_token = api_token @base_url, @request_timeout, @open_timeout = { base_url: BASE_URL, request_timeout: 600, open_timeout: 10 }.merge().values end |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
3 4 5 |
# File 'lib/appthwack/client.rb', line 3 def api_token @api_token end |
#base_url ⇒ Object
Returns the value of attribute base_url.
3 4 5 |
# File 'lib/appthwack/client.rb', line 3 def base_url @base_url end |
#last_request ⇒ Object
Returns the value of attribute last_request.
3 4 5 |
# File 'lib/appthwack/client.rb', line 3 def last_request @last_request end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
3 4 5 |
# File 'lib/appthwack/client.rb', line 3 def open_timeout @open_timeout end |
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
3 4 5 |
# File 'lib/appthwack/client.rb', line 3 def request_timeout @request_timeout end |
Instance Method Details
#create_device_pool(name, device_ids) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/appthwack/client.rb', line 19 def create_device_pool(name, device_ids) payload = { :name => name, :devices => device_ids } post("#{@base_url}/api/devicepool", payload) end |
#device_pools(project_id) ⇒ Object
28 29 30 |
# File 'lib/appthwack/client.rb', line 28 def device_pools(project_id) get("#{@base_url}/api/devicepool/#{project_id}") end |
#devices ⇒ Object
32 33 34 |
# File 'lib/appthwack/client.rb', line 32 def devices get("#{@base_url}/api/device") end |
#projects ⇒ Object
15 16 17 |
# File 'lib/appthwack/client.rb', line 15 def projects get("#{@base_url}/api/project/") end |
#schedule_test(name, project_id, app_file_id, opt = {}) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/appthwack/client.rb', line 45 def schedule_test(name, project_id, app_file_id, opt={}) payload = { :project => project_id, :name => name, :app => app_file_id }.merge(opt) post("#{@base_url}/api/run", payload) end |
#test_run_results(project_id, run_id) ⇒ Object
59 60 61 |
# File 'lib/appthwack/client.rb', line 59 def test_run_results(project_id, run_id) get("#{@base_url}/api/run/#{project_id}/#{run_id}") end |
#test_run_status(project_id, run_id) ⇒ Object
55 56 57 |
# File 'lib/appthwack/client.rb', line 55 def test_run_status(project_id, run_id) get("#{@base_url}/api/run/#{project_id}/#{run_id}/status") end |
#upload_file(name, file) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/appthwack/client.rb', line 36 def upload_file(name, file) payload = { :name => name, :file => file } post("#{@base_url}/api/file", payload) end |