Class: FileAttachment

Inherits:
Flareshow::Base show all
Defined in:
lib/file_attachment.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Flareshow::Base

all, api_endpoint, assimilate_resources, auth_endpoint, authenticate, #changes, commit, create, #destroy, #destroyed?, dispatch, find, first, get, #get, handle_response, http_get, #id, #initialize, list, #method_missing, #method_name, post, process_response, query, #refresh, #save, server_defined?, #set, store, #update

Constructor Details

This class inherits a constructor from Flareshow::Base

Dynamic Method Handling

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

Class Method Details

.resource_keyObject

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



9
10
11
# File 'lib/file_attachment.rb', line 9

def resource_key
  "files"
end

Instance Method Details

#downloadObject

download the file contents



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

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