class PipeRocket::FileService
Constants
- HOST
Public Class Methods
new(resource_name)
click to toggle source
# File lib/pipe_rocket/file_service.rb, line 5 def initialize(resource_name) @resource_name = resource_name end
Public Instance Methods
file_url(id)
click to toggle source
Download a file by id
# File lib/pipe_rocket/file_service.rb, line 10 def file_url(id) uri = build_uri({}, id, 'download') response = HTTP.get(uri) case response.code when 302 response.headers['Location'] else raise PipeRocket::Error.new(response.code) end rescue HTTP::ConnectionError raise PipeRocket::Error.new(408) end