Skip to content

Instantly share code, notes, and snippets.

@groony
Created July 2, 2018 10:13
Show Gist options
  • Save groony/c4811e87c27053e5e07bde1cbbfc72b7 to your computer and use it in GitHub Desktop.
Save groony/c4811e87c27053e5e07bde1cbbfc72b7 to your computer and use it in GitHub Desktop.
service object example
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