Module: Invoiced::Operations::Delete

Included in:
Contact, Coupon, CreditNote, Customer, Estimate, File, Invoice, Item, LineItem, Note, Payment, PaymentPlan, PaymentSourceObject, Plan, Subscription, Task, TaxRate, Transaction
Defined in:
lib/invoiced/operations/delete.rb

Instance Method Summary collapse

Instance Method Details

#deleteObject

[View source]

4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/invoiced/operations/delete.rb', line 4

def delete
    response = @client.request(:delete, self.endpoint())

    if response[:code] == 204
        refresh_from({:id => @id})
    elsif response[:code] == 200
        # update the local values with the response
        refresh_from(response[:body].dup.merge({:id => self.id}))
    end

    return response[:code] == 204 || response[:code] == 200
end