Skip to content

Instantly share code, notes, and snippets.

@joeljackson
Created April 30, 2015 17:22
Show Gist options
  • Save joeljackson/0114e9839aa2598ea10b to your computer and use it in GitHub Desktop.
Save joeljackson/0114e9839aa2598ea10b to your computer and use it in GitHub Desktop.
# This calss decides whether or not we should attempt to update a credit
# card via the account updater
class CreditCard::AccountUpdatePolicy
# Initializes the class
# @param [CreditCard] credit_card The credit card we want to check for updating
# @raise [StandardError] Raised if the credit card doesn't have it's transactions and orders loaded
def initialize(credit_card)
if !credit_card.transactions.loaded? || !credit_card.orders.loaded? then
raise StandardError.new("Please preload the transactions and orders for this credit card")
end
@credit_card = credit_card
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment