Class: MyLocalPutio::PutioCli
- Inherits:
-
Object
- Object
- MyLocalPutio::PutioCli
- Defined in:
- lib/my-local-putio/putio_cli.rb
Constant Summary collapse
- ROOT =
"https://api.put.io/v2/"
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#http ⇒ Object
readonly
Returns the value of attribute http.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #delete_file(id) ⇒ Object
- #get_download_url(id) ⇒ Object
- #get_files(parent_id = nil) ⇒ Object
- #get_subtitles(id) ⇒ Object
-
#initialize(configuration) ⇒ PutioCli
constructor
A new instance of PutioCli.
Constructor Details
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
4 5 6 |
# File 'lib/my-local-putio/putio_cli.rb', line 4 def configuration @configuration end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
4 5 6 |
# File 'lib/my-local-putio/putio_cli.rb', line 4 def endpoint @endpoint end |
#http ⇒ Object (readonly)
Returns the value of attribute http.
4 5 6 |
# File 'lib/my-local-putio/putio_cli.rb', line 4 def http @http end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
4 5 6 |
# File 'lib/my-local-putio/putio_cli.rb', line 4 def logger @logger end |
Instance Method Details
#delete_file(id) ⇒ Object
18 19 20 21 |
# File 'lib/my-local-putio/putio_cli.rb', line 18 def delete_file(id) args = {file_ids: id} post("files/delete", args) end |
#get_download_url(id) ⇒ Object
27 28 29 |
# File 'lib/my-local-putio/putio_cli.rb', line 27 def get_download_url(id) get("files/#{id}/url") end |
#get_files(parent_id = nil) ⇒ Object
13 14 15 16 |
# File 'lib/my-local-putio/putio_cli.rb', line 13 def get_files(parent_id=nil) args = parent_id ? {parent_id: parent_id, sort: "NAME_DESC"} : {sort: "DATE_DESC"} get("files/list", args) end |
#get_subtitles(id) ⇒ Object
23 24 25 |
# File 'lib/my-local-putio/putio_cli.rb', line 23 def get_subtitles(id) get("files/#{id}/subtitles") end |