s3_media_server_api 0.1.2.3 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +7 -1
- data/lib/s3_media_server_api/media/collection.rb +22 -0
- data/lib/s3_media_server_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67018ae4f90696f2fa81b06b936110085bec5450
|
4
|
+
data.tar.gz: e95740f4eb10984181c94954ce077b4e83cc8ad5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a04bc0d82a6df3c02bdcef17c34a1d3e95d1d05ab372284774080805f0732ca31cf29df218b9853ff129d736e6d637900c26c2a200a69bb7b51762dec7676f69
|
7
|
+
data.tar.gz: f67aaf2bac2869af08cdbc8ff51156f613c1cf2c4d0e0b5f2025cba1a46bdf67eaa5489ccdf6f5f043cbd4ce56dd72870e9f38fb7ede7721680e6a3fd72f46de
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -170,6 +170,13 @@ Use S3MediaServerApi::Media::Collection to interact with Collection resource
|
|
170
170
|
owner_uuid = "4edbfdf9-9517-4902-8e92-2212215b0de5"
|
171
171
|
collection = S3MediaServerApi::Media::Collection.create(owner_uuid)
|
172
172
|
|
173
|
+
# to add new element to the collection, use add_item method
|
174
|
+
# firstly create aws_file then provide its uuid and kind of media you want to create
|
175
|
+
# method returns media file object that was created
|
176
|
+
# available media types
|
177
|
+
# images, documents, videos, audios
|
178
|
+
params = { kind: 'images', media_file_uuid: aws_file.uuid }
|
179
|
+
image = S3MediaServerApi::Media::Collection.add_item(collection.uuid, params)
|
173
180
|
|
174
181
|
# to resolve document, use resolve method
|
175
182
|
resolved_collection = S3MediaServerApi::Media::Collection.resolve(created_collection.uuid)
|
@@ -198,7 +205,6 @@ aws_file = S3MediaServerApi::Uploader.upload('/Users/ayrat/Development/s3_media_
|
|
198
205
|
image_url = "https://d2l3jyjp24noqc.cloudfront.net/uploads/image/img/269/Test-Driven_APIs_with_Phoenix_and_Elixir.png"
|
199
206
|
file = S3MediaServerApi::Uploader.upload_from_url(image_url)
|
200
207
|
|
201
|
-
|
202
208
|
# to resolve aws file, use resolve method
|
203
209
|
resolved_aws_file = S3MediaServerApi::AwsFile.resolve(aws_file.uuid)
|
204
210
|
|
@@ -25,6 +25,28 @@ module S3MediaServerApi
|
|
25
25
|
|
26
26
|
class << self
|
27
27
|
|
28
|
+
def add_item(uuid, kind:, media_file_uuid:)
|
29
|
+
kind = kind.to_s
|
30
|
+
return unless uuid || media_file_uuid || kind
|
31
|
+
return unless ['videos', 'documents', 'images', 'audios'].include? kind
|
32
|
+
|
33
|
+
params = media_type.to_s == 'videos' ? {uuid: media_file_uuid} : {aws_file_uuid: media_file_uuid}
|
34
|
+
params.merge!({kind: kind, collection_uuid: uuid})
|
35
|
+
|
36
|
+
response = custom_sync_request(:add_item, params)
|
37
|
+
|
38
|
+
case kind
|
39
|
+
when 'videos'
|
40
|
+
Video.new(response)
|
41
|
+
when 'images'
|
42
|
+
Image.new(response)
|
43
|
+
when 'audios'
|
44
|
+
Audio.new(response)
|
45
|
+
when 'documents'
|
46
|
+
Docuemnt.new(response)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
28
50
|
private
|
29
51
|
|
30
52
|
def media_type; COLLECTION; end
|