summaryrefslogtreecommitdiff
path: root/app/controllers/services/addresses/create_address_service.rb
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-03-25 00:10:33 -0600
committerHombreLaser <sebastian-440@live.com>2023-03-25 00:10:33 -0600
commit7265af094ed16c36632128bccdcf84a3796c2359 (patch)
tree6d4f49752e0256b7c5ef2fc3e7db917be67db7bf /app/controllers/services/addresses/create_address_service.rb
parent76d44f91efab14dc0eeb84e83a77a85a7bb7fd74 (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.rb21
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