diff options
author | Rémy Coutable <remy@rymai.me> | 2017-02-20 14:41:27 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-02-20 14:41:27 +0000 |
commit | 173dbeb972d0da365ac77129d0e12727ae571e91 (patch) | |
tree | 87f2f6d62f9786f1465779ccbf58ae55cc948786 /lib/api/helpers.rb | |
parent | bc0b438d13f6bffd8e837f551a5415173f43f9f3 (diff) | |
parent | 612e61f4c4c374f4a47ea6d8a3b71fd40c41ac19 (diff) | |
download | gitlab-ce-173dbeb972d0da365ac77129d0e12727ae571e91.tar.gz |
Merge branch 'api-grape-datetime' into 'master'
Use grape validation for dates
See merge request !9375
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 13896dd91b9..7b6fae866eb 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -160,22 +160,6 @@ module API ActionController::Parameters.new(attrs).permit! end - # Checks the occurrences of datetime attributes, each attribute if present in the params hash must be in ISO 8601 - # format (YYYY-MM-DDTHH:MM:SSZ) or a Bad Request error is invoked. - # - # Parameters: - # keys (required) - An array consisting of elements that must be parseable as dates from the params hash - def datetime_attributes!(*keys) - keys.each do |key| - begin - params[key] = Time.xmlschema(params[key]) if params[key].present? - rescue ArgumentError - message = "\"" + key.to_s + "\" must be a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ" - render_api_error!(message, 400) - end - end - end - def filter_by_iid(items, iid) items.where(iid: iid) end |