diff options
author | Toon Claes <toon@gitlab.com> | 2019-02-28 19:57:34 +0100 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2019-02-28 19:57:34 +0100 |
commit | 62d7990b9bb30cf33ed87017c5c633d1cccc75c2 (patch) | |
tree | c3e1b69c58a412ba1c6f50a0337a23d9f9d6e1a4 /lib/api/time_tracking_endpoints.rb | |
parent | f6453eca992a9c142268e78ac782cef98110d183 (diff) | |
download | gitlab-ce-tc-standard-gem.tar.gz |
Ran standardrb --fix on the whole codebasetc-standard-gem
Inspired by https://twitter.com/searls/status/1101137953743613952 I
decided to try https://github.com/testdouble/standard on our codebase.
It's opinionated, but at least it's a _standard_.
Diffstat (limited to 'lib/api/time_tracking_endpoints.rb')
-rw-r--r-- | lib/api/time_tracking_endpoints.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/api/time_tracking_endpoints.rb b/lib/api/time_tracking_endpoints.rb index 93fe06bec27..9a65801855d 100644 --- a/lib/api/time_tracking_endpoints.rb +++ b/lib/api/time_tracking_endpoints.rb @@ -7,7 +7,7 @@ module API included do helpers do def issuable_name - declared_params.key?(:issue_iid) ? 'issue' : 'merge_request' + declared_params.key?(:issue_iid) ? "issue" : "merge_request" end def issuable_key @@ -25,9 +25,9 @@ module API def load_issuable @issuable ||= begin case issuable_name - when 'issue' + when "issue" find_project_issue(params.delete(issuable_key)) - when 'merge_request' + when "merge_request" find_project_merge_request(params.delete(issuable_key)) end end @@ -46,18 +46,18 @@ module API end def update_service - issuable_name == 'issue' ? ::Issues::UpdateService : ::MergeRequests::UpdateService + issuable_name == "issue" ? ::Issues::UpdateService : ::MergeRequests::UpdateService end end - issuable_name = name.end_with?('Issues') ? 'issue' : 'merge_request' + issuable_name = name.end_with?("Issues") ? "issue" : "merge_request" issuable_collection_name = issuable_name.pluralize issuable_key = "#{issuable_name}_iid".to_sym desc "Set a time estimate for a project #{issuable_name}" params do requires issuable_key, type: Integer, desc: "The ID of a project #{issuable_name}" - requires :duration, type: String, desc: 'The duration to be parsed' + requires :duration, type: String, desc: "The duration to be parsed" end post ":id/#{issuable_collection_name}/:#{issuable_key}/time_estimate" do authorize! update_issuable_key, load_issuable @@ -80,14 +80,14 @@ module API desc "Add spent time for a project #{issuable_name}" params do requires issuable_key, type: Integer, desc: "The ID of a project #{issuable_name}" - requires :duration, type: String, desc: 'The duration to be parsed' + requires :duration, type: String, desc: "The duration to be parsed" end post ":id/#{issuable_collection_name}/:#{issuable_key}/add_spent_time" do authorize! update_issuable_key, load_issuable update_issuable(spend_time: { duration: Gitlab::TimeTrackingFormatter.parse(params.delete(:duration)), - user_id: current_user.id + user_id: current_user.id, }) end @@ -99,7 +99,7 @@ module API authorize! update_issuable_key, load_issuable status :ok - update_issuable(spend_time: { duration: :reset, user_id: current_user.id }) + update_issuable(spend_time: {duration: :reset, user_id: current_user.id}) end desc "Show time stats for a project #{issuable_name}" |