diff options
author | HombreLaser <sebastian-440@live.com> | 2023-03-25 00:10:33 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-03-25 00:10:33 -0600 |
commit | 7265af094ed16c36632128bccdcf84a3796c2359 (patch) | |
tree | 6d4f49752e0256b7c5ef2fc3e7db917be67db7bf /app/controllers/services/addresses/create_address_service.rb | |
parent | 76d44f91efab14dc0eeb84e83a77a85a7bb7fd74 (diff) |
Añade specs de addresscontroller
Diffstat (limited to 'app/controllers/services/addresses/create_address_service.rb')
-rw-r--r-- | app/controllers/services/addresses/create_address_service.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/controllers/services/addresses/create_address_service.rb b/app/controllers/services/addresses/create_address_service.rb new file mode 100644 index 0000000..b634a2b --- /dev/null +++ b/app/controllers/services/addresses/create_address_service.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Services + module Addresses + # The service for address creation. + class CreateAddressService < AddressServicesBase + attr_reader :address + + def call + if already_existing_address.nil? + @address = Address.new(@params) + @address.user_accounts << @user_account + @address.save + else + add_address_to_user_addresses + @address = already_existing_address + end + end + end + end +end |