Use keyword arguments for ApplicationService calls
Not all services are using keywords, which breaks those calls in Ruby 3
This commit is contained in:
@@ -3,7 +3,7 @@ require "down"
|
||||
|
||||
module AppCatalogManager
|
||||
class UpdateMetadata < AppCatalogManagerService
|
||||
def initialize(app)
|
||||
def initialize(app:)
|
||||
@app = app
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class ApplicationService
|
||||
# This enables executing a service's `#call` method directly via
|
||||
# `MyService.call(args)`, without creating a class instance it first.
|
||||
def self.call(*args, &block)
|
||||
new(*args, &block).call
|
||||
def self.call(**args, &block)
|
||||
new(**args, &block).call
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
class CreateAccount < ApplicationService
|
||||
def initialize(args)
|
||||
@username = args[:username]
|
||||
@domain = args[:ou] || Setting.primary_domain
|
||||
@email = args[:email]
|
||||
@password = args[:password]
|
||||
@invitation = args[:invitation]
|
||||
@confirmed = args[:confirmed]
|
||||
def initialize(account:)
|
||||
@username = account[:username]
|
||||
@domain = account[:ou] || Setting.primary_domain
|
||||
@email = account[:email]
|
||||
@password = account[:password]
|
||||
@invitation = account[:invitation]
|
||||
@confirmed = account[:confirmed]
|
||||
end
|
||||
|
||||
def call
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
module LdapManager
|
||||
class FetchAvatar < LdapManagerService
|
||||
def initialize(cn:, ou: nil)
|
||||
def initialize(cn:)
|
||||
@cn = cn
|
||||
@ou = ou
|
||||
end
|
||||
|
||||
def call
|
||||
treebase = @ou ? "ou=#{@ou},cn=users,#{suffix}" : ldap_config["base"]
|
||||
treebase = ldap_config["base"]
|
||||
attributes = %w{ jpegPhoto }
|
||||
filter = Net::LDAP::Filter.eq("cn", @cn)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ require "image_processing/vips"
|
||||
|
||||
module LdapManager
|
||||
class UpdateAvatar < LdapManagerService
|
||||
def initialize(dn, file)
|
||||
def initialize(dn:, file:)
|
||||
@dn = dn
|
||||
@img_data = process(file)
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module LdapManager
|
||||
class UpdateDisplayName < LdapManagerService
|
||||
def initialize(dn, display_name)
|
||||
def initialize(dn:, display_name:)
|
||||
@dn = dn
|
||||
@display_name = display_name
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module LdapManager
|
||||
class UpdateEmail < LdapManagerService
|
||||
def initialize(dn, address)
|
||||
def initialize(dn:, address:)
|
||||
@dn = dn
|
||||
@address = address
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module LdapManager
|
||||
class UpdateEmailMaildrop < LdapManagerService
|
||||
def initialize(dn, address)
|
||||
def initialize(dn:, address:)
|
||||
@dn = dn
|
||||
@address = address
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module LdapManager
|
||||
class UpdateEmailPassword < LdapManagerService
|
||||
def initialize(dn, password_hash)
|
||||
def initialize(dn:, password_hash:)
|
||||
@dn = dn
|
||||
@password_hash = password_hash
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module NostrManager
|
||||
class ValidateId < NostrManagerService
|
||||
def initialize(event)
|
||||
def initialize(event:)
|
||||
@event = Nostr::Event.new(**event)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module NostrManager
|
||||
class VerifySignature < NostrManagerService
|
||||
def initialize(event)
|
||||
def initialize(event:)
|
||||
@event = Nostr::Event.new(**event)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user