Class: Doxie::Client
- Inherits:
-
Object
- Object
- Doxie::Client
- Defined in:
- lib/doxie/client.rb
Overview
Defined Under Namespace
Classes: Error
Constant Summary collapse
- USERNAME =
'doxie'
Instance Attribute Summary collapse
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#model ⇒ Object
Returns the value of attribute model.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
- #delete_scan(scan_name) ⇒ Object
- #delete_scans(scan_names) ⇒ Object
- #hello ⇒ Object
- #hello_extra ⇒ Object
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
- #recent_scans ⇒ Object
- #restart ⇒ Object
- #scan(scan_name, file_name = nil) ⇒ Object
- #scans ⇒ Object
- #thumbnail(scan_name, file_name = nil) ⇒ Object
Constructor Details
Instance Attribute Details
#ip ⇒ Object
Returns the value of attribute ip.
16 17 18 |
# File 'lib/doxie/client.rb', line 16 def ip @ip end |
#model ⇒ Object
Returns the value of attribute model.
16 17 18 |
# File 'lib/doxie/client.rb', line 16 def model @model end |
#password ⇒ Object
Returns the value of attribute password.
16 17 18 |
# File 'lib/doxie/client.rb', line 16 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
16 17 18 |
# File 'lib/doxie/client.rb', line 16 def port @port end |
Instance Method Details
#delete_scan(scan_name) ⇒ Object
63 64 65 |
# File 'lib/doxie/client.rb', line 63 def delete_scan(scan_name) delete("/scans#{scan_name}") || true end |
#delete_scans(scan_names) ⇒ Object
67 68 69 |
# File 'lib/doxie/client.rb', line 67 def delete_scans(scan_names) post('/scans/delete.json', scan_names) || true end |
#hello ⇒ Object
25 26 27 |
# File 'lib/doxie/client.rb', line 25 def hello get('/hello.json') end |
#hello_extra ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/doxie/client.rb', line 29 def hello_extra if model == Doxie::API_V2 raise Doxie::Client::Error, 'Method does not exist for this model' end get('/hello_extra.json') end |
#recent_scans ⇒ Object
51 52 53 |
# File 'lib/doxie/client.rb', line 51 def recent_scans get('/scans/recent.json') || [] end |
#restart ⇒ Object
37 38 39 |
# File 'lib/doxie/client.rb', line 37 def restart get('/restart.json') || true end |
#scan(scan_name, file_name = nil) ⇒ Object
55 56 57 |
# File 'lib/doxie/client.rb', line 55 def scan(scan_name, file_name = nil) file "/scans#{scan_name}", file_name end |
#scans ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/doxie/client.rb', line 41 def scans get('/scans.json') rescue Doxie::Client::Error => e # a 404 is thrown on the Doxie Q and # Doxie GO SE when there are no scans raise e if model == Doxie::API_V1 [] end |
#thumbnail(scan_name, file_name = nil) ⇒ Object
59 60 61 |
# File 'lib/doxie/client.rb', line 59 def thumbnail(scan_name, file_name = nil) file "/thumbnails#{scan_name}", file_name end |