Module: Paperclip::Storage::Atompub
- Defined in:
- lib/paperclip/storage/atompub.rb
Class Method Summary collapse
Instance Method Summary collapse
- #exists?(style_name = default_style) ⇒ Boolean
-
#flush_deletes ⇒ Object
:nodoc:.
-
#flush_writes ⇒ Object
:nodoc:.
- #path(style_name = default_style) ⇒ Object
- #url(style_name = default_style) ⇒ Object
Class Method Details
.extended(base) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/paperclip/storage/atompub.rb', line 6 def self.extended(base) base.instance_eval do (@options.delete(:atompub_config) || {}).each do |key, value| @options[:"atompub_#{key}"] = value end end end |
Instance Method Details
#exists?(style_name = default_style) ⇒ Boolean
23 24 25 26 27 28 29 |
# File 'lib/paperclip/storage/atompub.rb', line 23 def exists?(style_name = default_style) if original_filename ! atompub_entry(style_name).nil? else false end end |
#flush_deletes ⇒ Object
:nodoc:
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/paperclip/storage/atompub.rb', line 45 def flush_deletes #:nodoc: @queued_for_delete.each do |path| begin log("deleting #{path}") entry = atompub_entry(path) = (path).destroy .destroy atompub_client.delete_media(entry.edit_media_link) rescue ::Atompub::RequestError # Ignore this. end end @queued_for_delete = [] end |
#flush_writes ⇒ Object
:nodoc:
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/paperclip/storage/atompub.rb', line 31 def flush_writes #:nodoc: @queued_for_write.each do |style, file| begin log("saving #{path(style)}") = (style) .resource_uri = atompub_client.create_media([:atompub_media_collection_uri], file.path, file.content_type, original_filename) .content_src = atompub_client.get_entry(.resource_uri).content.src .save! ensure file.rewind end end end |
#path(style_name = default_style) ⇒ Object
14 15 16 |
# File 'lib/paperclip/storage/atompub.rb', line 14 def path(style_name = default_style) style_name end |
#url(style_name = default_style) ⇒ Object
18 19 20 21 |
# File 'lib/paperclip/storage/atompub.rb', line 18 def url(style_name = default_style) = (style_name) ? .content_src : nil end |