Created
July 2, 2018 10:13
-
-
Save groony/c4811e87c27053e5e07bde1cbbfc72b7 to your computer and use it in GitHub Desktop.
service object example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Sso | |
class Show < ApplicationService | |
schema do | |
required(:sso).filled(:str?) | |
required(:sig).filled(:str?) | |
end | |
def execute! | |
current_user.build_sso_url(query_string) | |
success! | |
rescue StandardError => e | |
fail!(errors: { sso: [e.message] }) | |
end | |
private | |
def query_string | |
"sso=#{sso}&sig=#{sig}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment