# File lib/couchdb_adapter/attachments.rb, line 74 def get_attachment(name) assert_attachments_property attachment = self.attachments[name] if self.attachments unless self.id && attachment nil else adapter = repository.adapter http = Net::HTTP.new(adapter.uri.host, adapter.uri.port) uri = Addressable::URI.encode_component(attachment_path(name)) response, data = http.get(uri, 'Content-Type' => attachment['content_type']) unless response.kind_of?(Net::HTTPSuccess) nil else data end end end