Skip to content

Instantly share code, notes, and snippets.

@dpmccabe
Last active December 23, 2015 22:49
Show Gist options
  • Save dpmccabe/6706298 to your computer and use it in GitHub Desktop.
Save dpmccabe/6706298 to your computer and use it in GitHub Desktop.
class Billing < OtherClass
extend ActiveModel::Naming
include ActiveModel::Conversion
include ActiveModel::Validations
attr_accessor :save_my_billing
attr_reader :result
cattr_reader :rate
@@rate = 0.03
def initialize(args = {})
args.each { |key, val| send("@#{key}=", val) }
end
def charge_for(item)
# ...
log_result
end
def reset!
# ...
end
def self.send_billing_report
# ...
end
protected
def charge_custom(item)
# ...
log_result
end
private
def log_result
Transaction.create_from_result(result)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment