spec/support/dribbble_api.rb in dribbble-1.2.0 vs spec/support/dribbble_api.rb in dribbble-2.0.0

- old
+ new

@@ -1,14 +1,16 @@ +# frozen_string_literal: true + require 'sinatra/base' class String def underscore - self.gsub(/::/, '/'). - gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). - gsub(/([a-z\d])([A-Z])/,'\1_\2'). - tr("-", "_"). - downcase + gsub(/::/, '/') + .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') + .gsub(/([a-z\d])([A-Z])/, '\1_\2') + .tr('-', '_') + .downcase end end module DribbbleAPI class Base < Sinatra::Base @@ -103,13 +105,13 @@ content_type :json status status_code headers response_headers { - message: "Validation failed.", + message: 'Validation failed.', errors: [ - { attribute: "user", message: "reached the daily limit of 5 shots" } + { attribute: 'user', message: 'reached the daily limit of 5 shots' } ] }.to_json end end @@ -120,85 +122,30 @@ end class AttachmentDeleted < Deleted end - class CommentsSuccess < Found - end - - class CommentSuccess < Found - end - - class CommentCreated < Created - end - - class CommentUpdated < Updated - end - - class CommentDeleted < Deleted - end - - class CommentLikesSuccess < Found - end - - class CommentLikeSuccess < Found - end - - class CommentLikeNotFound < NotFound - end - - class CommentLikeCreated < Created - end - - class CommentLikeDeleted < Deleted - end - class CurrentUserSuccess < Found end - class BucketSuccess < Found + class ProjectSuccess < Found end - class BucketCreated < Created + # TODO: pending + class ProjectsSuccess < Found end - class BucketUpdated < Updated + class ProjectsAccepted < Found end - class BucketDeleted < Deleted + class ProjectsDeleted < Found end - class BucketsSuccess < Found + class ProjectsUpdated < Found end + # END - class FollowersSuccess < Found - end - - class FollowingSuccess < Found - end - - class UserFollowSuccess < Found - end - - class UserFollowNotFound < NotFound - end - - class UserFollowCreated < NoContent - end - - class UserFollowDeleted < Deleted - end - - class UserLikesSuccess < Found - end - - class ProjectSuccess < Found - end - - class ProjectsSuccess < Found - end - class ShotUpdated < Updated end class ShotDeleted < Deleted end @@ -207,33 +154,15 @@ end class ShotAccepted < Accepted def response_headers { - 'Location' => 'https://api.dribbble.com/v1/shots/471756' + 'Location' => 'https://api.dribbble.com/v2/shots/471756' } end end - class ShotLikeSuccess < Found - end - - class ShotLikeNotFound < NotFound - end - - class ShotLikeCreated < Created - end - - class ShotLikeDeleted < Deleted - end - - class ShotLikesSuccess < Found - end - class ShotsSuccess < Found - end - - class TeamsSuccess < Found end class UserSuccess < Found end