Created
April 30, 2015 17:22
-
-
Save joeljackson/0114e9839aa2598ea10b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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