lib/dribbble/bucket.rb in dribbble-0.0.4 vs lib/dribbble/bucket.rb in dribbble-1.0.0.beta1
- old
+ new
@@ -1,4 +1,35 @@
+require 'dribbble/utils/findable'
+require 'dribbble/utils/creatable'
+require 'dribbble/utils/updatable'
+require 'dribbble/utils/deletable'
+
module Dribbble
class Bucket < Dribbble::Base
+ include Dribbble::Utils::Findable
+ include Dribbble::Utils::Creatable
+ include Dribbble::Utils::Updatable
+ include Dribbble::Utils::Deletable
+
+ def shots(attrs = {})
+ Dribbble::Shot.batch_new token, html_get("/bucket/#{id}/shots", attrs)
+ end
+
+ def add_shot(shot)
+ shot_id = shot.is_a?(Dribbble::Shot) ? shot.id : shot
+ res = html_put("/buckets/#{id}/shots") do |payload|
+ payload[:shot_id] = shot_id
+ end
+ res.code == 204 ? true : false
+ end
+
+ def remove_shot(shot)
+ shot_id = shot.is_a?(Dribbble::Shot) ? shot.id : shot
+ res = html_delete "/buckets/#{id}/shots", shot_id: shot_id
+ res.code == 204 ? true : false
+ end
+
+ def self.available_fields
+ %i(name description)
+ end
end
end