lib/sorenson/services/group.rb in 360_services-1.0.1 vs lib/sorenson/services/group.rb in 360_services-1.0.2
- old
+ new
@@ -1,11 +1,23 @@
module Sorenson
module Services
class Group < Base
attr_accessor :name, :description, :account_id, :id, :guid
+ def self.presets(group_id)
+ get_from("/groups/#{group_id}/presets")
+ end
+
def self.create(name, attributes={})
data = post_to("/groups", :group => attributes.merge(:name => name))
+ new(data['group'])
+ end
+
+ def self.update(name, attributes={})
+ return nil if attributes[:preset_ids].nil?
+ attributes[:preset_ids] = attributes[:preset_ids].join(",")
+ guid = attributes.delete(:group_id)
+ data = put_to("/groups/#{guid}", :group => attributes.merge({:name => name, :id => guid}))
new(data['group'])
end
def self.all
collection = Base.get_from("/groups")
\ No newline at end of file