Created
May 10, 2013 17:48
-
-
Save mxey/5556112 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def completed_putio_transfers(user_token) | |
| putio_connection = Faraday.new('https://api.put.io/v2/') do |faraday| | |
| faraday.request :oauth2, user_token, param_name: :oauth_token | |
| faraday.response :json, content_type: /\bjson$/ | |
| faraday.response :raise_error | |
| faraday.adapter Faraday.default_adapter | |
| end | |
| transfers = putio_connection.get('transfers/list').body['transfers'] | |
| transfers.select! { |t| t['status'] == 'COMPLETED' || t['status'] == 'SEEDING' } | |
| return Hash[transfers.map { |t| [t['id'], t['name']] }] | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment