Class: Confluence::Attachment

Inherits:
Record
  • Object
show all
Extended by:
Findable
Defined in:
lib/confluence/attachment.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject



14
15
16
# File 'lib/confluence/attachment.rb', line 14

def data
  @data ||= client.getAttachmentData(page_id, filename, "0")
end

Class Method Details

.find_criteria(args) ⇒ Object



30
31
32
33
34
# File 'lib/confluence/attachment.rb', line 30

def self.find_criteria(args)
  if args.key? :page_id and args.key? :filename
    self.new(client.getAttachment(args[:page_id], args[:filename], args[:version] || "0"))
  end
end

Instance Method Details

#removeObject



26
27
28
# File 'lib/confluence/attachment.rb', line 26

def remove
  client.removeAttachment(page_id, filename)
end

#storeObject



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

def store
  # reinitialize attachment after storing it
  initialize(client.addAttachment(page_id, self.to_hash, XMLRPC::Base64.new(@data)))
  
  # return self
  self
end