Class: Stf::Client
Instance Method Summary collapse
- #add_adb_public_key(adb_public_key) ⇒ Object
- #add_device(serial) ⇒ Object
- #get_device(serial) ⇒ Object
- #get_devices ⇒ Object
- #get_user ⇒ Object
- #get_user_devices ⇒ Object
-
#initialize(base_url, token) ⇒ Client
constructor
A new instance of Client.
- #remove_device(serial) ⇒ Object
- #start_debug(serial) ⇒ Object
- #stop_debug(serial) ⇒ Object
Methods included from Log
Constructor Details
#initialize(base_url, token) ⇒ Client
Returns a new instance of Client.
12 13 14 15 |
# File 'lib/stf/client.rb', line 12 def initialize(base_url, token) @base_url = base_url @token = token end |
Instance Method Details
#add_adb_public_key(adb_public_key) ⇒ Object
57 58 59 60 |
# File 'lib/stf/client.rb', line 57 def add_adb_public_key(adb_public_key) response = execute '/api/v1/user/adbPublicKeys', Net::HTTP::Post, { publickey: adb_public_key }.to_json return response.success end |
#add_device(serial) ⇒ Object
37 38 39 40 |
# File 'lib/stf/client.rb', line 37 def add_device(serial) response = execute '/api/v1/user/devices', Net::HTTP::Post, {serial: serial}.to_json return response.success end |
#get_device(serial) ⇒ Object
22 23 24 25 |
# File 'lib/stf/client.rb', line 22 def get_device(serial) response = execute "/api/v1/devices/#{serial}", Net::HTTP::Get return response.device end |
#get_devices ⇒ Object
17 18 19 20 |
# File 'lib/stf/client.rb', line 17 def get_devices response = execute '/api/v1/devices', Net::HTTP::Get return response.devices end |
#get_user ⇒ Object
27 28 29 30 |
# File 'lib/stf/client.rb', line 27 def get_user response = execute '/api/v1/user', Net::HTTP::Get return response.user end |
#get_user_devices ⇒ Object
32 33 34 35 |
# File 'lib/stf/client.rb', line 32 def get_user_devices response = execute '/api/v1/user/devices', Net::HTTP::Get return response.devices end |
#remove_device(serial) ⇒ Object
42 43 44 45 |
# File 'lib/stf/client.rb', line 42 def remove_device(serial) response = execute "/api/v1/user/devices/#{serial}", Net::HTTP::Delete return response.success end |
#start_debug(serial) ⇒ Object
47 48 49 50 |
# File 'lib/stf/client.rb', line 47 def start_debug(serial) response = execute "/api/v1/user/devices/#{serial}/remoteConnect", Net::HTTP::Post return response end |
#stop_debug(serial) ⇒ Object
52 53 54 55 |
# File 'lib/stf/client.rb', line 52 def stop_debug(serial) response = execute "/api/v1/user/devices/#{serial}/remoteConnect", Net::HTTP::Delete return response.success end |