Module: Vindi::APIOperations::Delete
- Included in:
- Bill, Customer, Discount, PaymentProfile, Plan, Product, ProductItem, Subscription, Usage
- Defined in:
- lib/vindi/api_operations/delete.rb
Instance Method Summary collapse
- #delete(id) ⇒ Object (also: #destroy)
Instance Method Details
#delete(id) ⇒ Object Also known as: destroy
6 7 8 9 10 11 |
# File 'lib/vindi/api_operations/delete.rb', line 6 def delete(id) response = Client.request(:delete, "#{endpoint}/#{id}") singular_key = endpoint.end_with?("batches") ? endpoint.sub(/es$/, "").to_sym : endpoint.chomp("s").to_sym resource_attrs = response.key?(singular_key) ? response[singular_key] : response new(resource_attrs) end |