Sha256: f6cde98312a9d520fb8244568a91e5f2689624a8abcbc3a929b852025750df6e

Contents?: true

Size: 802 Bytes

Versions: 3

Compression:

Stored size: 802 Bytes

Contents

module BillForward
	class MutableEntity < InsertableEntity
		def initialize(*args)
	      raise AbstractInstantiateError.new('This abstract class cannot be instantiated!') if self.class == MutableEntity
	      super
	    end

		# Asks API to update existing instance of this entity,
 		# based on current model.
	    # 
	    # @return [self] The updated Entity
		def save()
			self.class.request_first('put', '', self, nil, _client)
		end

		# Asks API to retire existing instance of this entity.
		# @note Many BillForward entities do not support RETIRE
		# @note As-yet untested
	    # 
	    # @return [self] The retired Entity
		def delete(query_params = {})
			self.class.request_first('delete', ERB::Util.url_encode(id), query_params, nil, _client)
		end

		alias_method :retire, :delete
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bill_forward-2.2016.241 lib/bill_forward/mutable_entity.rb
bill_forward-2.2016.227 lib/bill_forward/mutable_entity.rb
bill_forward-2.2016.222 lib/bill_forward/mutable_entity.rb