Class: Applications::CreateService
- Inherits:
-
Object
- Object
- Applications::CreateService
- Defined in:
- app/services/applications/create_service.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#execute(request) ⇒ Object
EE would override and use `request` arg.
-
#initialize(current_user, params) ⇒ CreateService
constructor
A new instance of CreateService.
Constructor Details
#initialize(current_user, params) ⇒ CreateService
Returns a new instance of CreateService.
7 8 9 10 |
# File 'app/services/applications/create_service.rb', line 7 def initialize(current_user, params) @current_user = current_user @params = params.except(:ip_address) end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user
5 6 7 |
# File 'app/services/applications/create_service.rb', line 5 def current_user @current_user end |
#params ⇒ Object (readonly)
Returns the value of attribute params
5 6 7 |
# File 'app/services/applications/create_service.rb', line 5 def params @params end |
Instance Method Details
#execute(request) ⇒ Object
EE would override and use `request` arg
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/services/applications/create_service.rb', line 13 def execute(request) @application = Doorkeeper::Application.new(params) unless params[:scopes].present? @application.errors.add(:base, _("Scopes can't be blank")) return @application end @application.save @application end |