class Xeroizer::Record::AttachmentModel
Public Instance Methods
attach_data(url, id, filename, data, content_type, options = {})
click to toggle source
# File lib/xeroizer/models/attachment.rb, line 22 def attach_data(url, id, filename, data, content_type, options = {}) options = { include_online: false }.merge(options) response_xml = @application.http_put(@application.client, "#{url}/#{CGI.escape(id)}/Attachments/#{CGI.escape(filename)}", data, :raw_body => true, :content_type => content_type, "IncludeOnline" => options[:include_online] ) response = parse_response(response_xml) if (response_items = response.response_items) && response_items.size > 0 response_items.size == 1 ? response_items.first : response_items else response end end
attach_file(url, id, filename, path, content_type, options = {})
click to toggle source
# File lib/xeroizer/models/attachment.rb, line 38 def attach_file(url, id, filename, path, content_type, options = {}) attach_data(url, id, filename, File.read(path), content_type, options) end
attachments_for(url, id)
click to toggle source
# File lib/xeroizer/models/attachment.rb, line 42 def attachments_for(url, id) response_xml = @application.http_get(@application.client, "#{url}/#{CGI.escape(id)}/Attachments") response = parse_response(response_xml) if (response_items = response.response_items) && response_items.size > 0 response_items else [] end end