Class: Uploadcare::Entity::Group
- Inherits:
-
Uploadcare::Entity
- Object
- Uploadcare::Entity
- Uploadcare::Entity::Group
- Defined in:
- lib/uploadcare/entity/group.rb
Overview
Groups serve a purpose of better organizing files in your Uploadcare projects.
You can create one from a set of files by using their UUIDs.
Class Method Summary collapse
- .delete(uuid) ⇒ Object
-
.group_info(uuid) ⇒ Object
Get a file group by its ID.
-
.store(uuid) ⇒ Object
Remove these lines and bump api_struct version when this PR is accepted:.
Instance Method Summary collapse
-
#id ⇒ String
gets groups's id - even if it's only initialized with cdn_url.
-
#load ⇒ Object
loads group metadata, if it's initialized with url or id.
Class Method Details
.delete(uuid) ⇒ Object
30 31 32 |
# File 'lib/uploadcare/entity/group.rb', line 30 def self.delete(uuid) rest_delete(uuid).success || '200 OK' end |
.group_info(uuid) ⇒ Object
Get a file group by its ID.
26 27 28 |
# File 'lib/uploadcare/entity/group.rb', line 26 def self.group_info(uuid) rest_info(uuid) end |
.store(uuid) ⇒ Object
Remove these lines and bump api_struct version when this PR is accepted:
21 22 23 |
# File 'lib/uploadcare/entity/group.rb', line 21 def self.store(uuid) rest_store(uuid).success || '200 OK' end |
Instance Method Details
#id ⇒ String
gets groups's id - even if it's only initialized with cdn_url
36 37 38 39 40 41 |
# File 'lib/uploadcare/entity/group.rb', line 36 def id return @entity.id if @entity.id id = @entity.cdn_url.gsub('https://ucarecdn.com/', '') id.gsub(%r{/.*}, '') end |
#load ⇒ Object
loads group metadata, if it's initialized with url or id
44 45 46 |
# File 'lib/uploadcare/entity/group.rb', line 44 def load initialize(Group.info(id).entity) end |