Skip to content

Commit

Permalink
Abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Berke-Williams committed Jan 13, 2012
1 parent cacb537 commit 3385e12
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/fake_braintree/customer.rb
Expand Up @@ -16,14 +16,14 @@ def create
hash = customer_hash
create_customer_with(hash)
create_credit_card_with(hash)
creation_response_for(hash)
response_for_created_customer(hash)
end
end

def update
if existing_customer_hash
hash = update_existing_customer!
gzipped_response(200, hash.to_xml(:root => 'customer'))
response_for_updated_customer(hash)
else
failure_response(404)
end
Expand Down Expand Up @@ -123,7 +123,7 @@ def existing_customer_id
@customer_hash['id']
end

def creation_response_for(hash)
def response_for_created_customer(hash)
gzipped_response(201, hash.to_xml(:root => 'customer'))
end

Expand Down Expand Up @@ -167,5 +167,9 @@ def deletion_response
def delete_customer_with_id(id)
FakeBraintree.registry.customers[id] = nil
end

def response_for_updated_customer(hash)
gzipped_response(200, hash.to_xml(:root => 'customer'))
end
end
end

0 comments on commit 3385e12

Please sign in to comment.