class Invoiced::CreditNote
Constants
- OBJECT_NAME
Public Instance Methods
attachments(params={})
click to toggle source
# File lib/invoiced/credit_note.rb, line 18 def attachments(params={}) response = @client.request(:get, "#{self.endpoint()}/attachments", params) # ensure each attachment has an ID body = response[:body] body.each do |attachment| if !attachment.has_key?(:id) attachment[:id] = attachment[:file][:id] end end # build objects attachment = Attachment.new(@client) attachments = Util.build_objects(attachment, body) # store the metadata from the list operation metadata = Invoiced::List.new(response[:headers][:link], response[:headers][:x_total_count]) return attachments, metadata end
send(params={}, opts={})
click to toggle source
# File lib/invoiced/credit_note.rb, line 10 def send(params={}, opts={}) response = @client.request(:post, "#{self.endpoint()}/emails", params, opts) # build email objects email = Email.new(@client) Util.build_objects(email, response[:body]) end
void()
click to toggle source
# File lib/invoiced/credit_note.rb, line 39 def void() response = @client.request(:post, "#{self.endpoint()}/void", {}) refresh_from(response[:body].dup.merge({:id => self.id})) return response[:code] == 200 end