app/handlers/openstax/connect/dev/users_search.rb in openstax_connect-0.0.2 vs app/handlers/openstax/connect/dev/users_search.rb in openstax_connect-0.0.3
- old
+ new
@@ -1,32 +1,34 @@
module OpenStax::Connect::Dev
class UsersSearch
- include Lev::Handler
-
+ lev_handler transaction: :no_transaction
+
paramify :search do
attribute :search_type, type: String
validates :search_type, presence: true,
inclusion: { in: %w(Name Username Any),
message: "is not valid" }
attribute :search_terms, type: String
validates :search_terms, presence: true
end
- uses_routine OpenStax::Connect::SearchUsers, as: :search_users
+ uses_routine OpenStax::Connect::SearchUsers,
+ as: :search_users,
+ translations: { outputs: {type: :verbatim} }
protected
def authorized?
!Rails.env.production? || caller.is_administrator?
end
- def exec
+ def handle
terms = search_params.search_terms
type = search_params.search_type
- results[:users] = run(:search_users, terms, type.downcase.to_sym)
+ run(:search_users, terms, type.downcase.to_sym)
end
end
end