Class: FileUploader::HTTPResource
- Defined in:
- lib/resource/resource_http.rb
Constant Summary
Constants included from S3Resource
S3Resource::S3_BUCKET, S3Resource::S3_CONFIG, S3Resource::S3_KEY, S3Resource::S3_SECRET
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
- #basename ⇒ Object
-
#initialize(resource) ⇒ HTTPResource
constructor
A new instance of HTTPResource.
- #path ⇒ Object
Methods inherited from Resource
create, #destroy, #extension, #mime_type, #uri
Methods included from S3Resource
Constructor Details
#initialize(resource) ⇒ HTTPResource
Returns a new instance of HTTPResource.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/resource/resource_http.rb', line 5 def initialize(resource) super status, file = Net::HTTP.get_response(URI.parse(self.uri)) File.open(self.basename, 'wb') do |open_file| open_file.print(file) end self.tempfile = File.open(self.basename) end |
Instance Method Details
#basename ⇒ Object
17 18 19 |
# File 'lib/resource/resource_http.rb', line 17 def basename File.basename(self.uri) end |
#path ⇒ Object
21 22 23 |
# File 'lib/resource/resource_http.rb', line 21 def path File.realdirpath(self.tempfile) end |