Module: Vindi::APIOperations::Update

Included in:
Bill, Charge, Customer, Issue, Plan, Product, ProductItem, Subscription
Defined in:
lib/vindi/api_operations/update.rb

Instance Method Summary collapse

Instance Method Details

#update(id, params = {}) ⇒ Object



6
7
8
9
10
11
# File 'lib/vindi/api_operations/update.rb', line 6

def update(id, params = {})
  response = Client.request(:put, "#{endpoint}/#{id}", params)
  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