Sha256: 40135249ca5993220943a903a09e61123eb218df88df32715aae6d1cea9d6c97

Contents?: true

Size: 774 Bytes

Versions: 4

Compression:

Stored size: 774 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
			self.class.request_first('delete', ERB::Util.url_encode(id), nil, nil, _client)
		end

		alias_method :retire, :delete
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bill_forward-2.2016.209 lib/bill_forward/mutable_entity.rb
bill_forward-1.2016.117 lib/bill_forward/mutable_entity.rb
bill_forward-1.2016.101 lib/bill_forward/mutable_entity.rb
bill_forward-1.2016.26 lib/bill_forward/mutable_entity.rb