Sha256: e4dbea8ec3ab277f43dae0248fab4bd639ae31a103f08c992174f4371b4605cb
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
module Uploadcare module GroupApi def group uuid_or_cdn_url group = Uploadcare::Api::Group.new self, uuid_or_cdn_url end def create_group ary unless ary.kind_of?(Array) raise ArgumentError.new "You should send and array of files or valid UUIDs" else if ary.select {|f| !!f.kind_of?(Uploadcare::Api::File) }.any? files = Hash.new ary.each_with_index do |file, i| files["files[#{i}]"] = file.uuid end elsif ary.select {|f| !!f.kind_of?(String) }.any? files = Hash.new ary.each_with_index do |uuid, i| files["files[#{i}]"] = uuid end else raise ArgumentError.new "You should send and array of files or valid UUIDs" end end data = { pub_key: @options[:public_key], } data.merge! files post = parse(upload_request :post, "/group/", data) group = Uploadcare::Api::Group.new self, post["id"], post end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
uploadcare-ruby-1.0.1.rc2 | lib/uploadcare/api/group_api.rb |
uploadcare-ruby-1.0.1.rc1 | lib/uploadcare/api/group_api.rb |