Class: FileAttachment

Inherits:
Flareshow::Resource show all
Extended by:
Flareshow::Searchable
Defined in:
lib/file_attachment.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Flareshow::Searchable

search

Methods inherited from Flareshow::Resource

#cache, cache_response, #changes, create, #destroy, #destroyed?, find, #get, get_from_cache, #id, #initialize, list_cache, #method_missing, #method_name, #refresh, #resource_key, #save, #set, store, #update

Constructor Details

This class inherits a constructor from Flareshow::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Flareshow::Resource

Class Method Details

.resource_keyObject

file attachments has a resource key of files for querying the server



11
12
13
# File 'lib/file_attachment.rb', line 11

def resource_key
  "files"
end

Instance Method Details

#downloadObject

download the file contents



17
18
19
20
21
22
23
24
# File 'lib/file_attachment.rb', line 17

def download
  url = self.url
  unless url.match(/http/)
    url = "http://#{Flareshow::Base.server.host}/#{Flareshow::Base.server.domain}#{url}"
  end
  Flareshow::Util.log_info("getting #{url}")
  self.class.http_get(url)
end