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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53c8229ea9ed330f81029c2540676c46bfdf13cd
4
- data.tar.gz: 59c87a40dba0dbd1d591d64e6ce4363a43e0a80d
3
+ metadata.gz: 67018ae4f90696f2fa81b06b936110085bec5450
4
+ data.tar.gz: e95740f4eb10984181c94954ce077b4e83cc8ad5
5
5
  SHA512:
6
- metadata.gz: d95169c68211219acb6f501420a2938c5dfca34964c3f570fa64c7a450169851c8dbaf8b64630cb13fa08cedac7cf4ef362b2f93e75c1b8bda7819c5d24ef64f
7
- data.tar.gz: 019bfce35828c2c02ecd2f855d2b42106e4498241a6dc05fc328814c404483ac82d965aefc73bec90c878b19f2a4b3c8e22e26bf9215e30a554569627ff75d11
6
+ metadata.gz: a04bc0d82a6df3c02bdcef17c34a1d3e95d1d05ab372284774080805f0732ca31cf29df218b9853ff129d736e6d637900c26c2a200a69bb7b51762dec7676f69
7
+ data.tar.gz: f67aaf2bac2869af08cdbc8ff51156f613c1cf2c4d0e0b5f2025cba1a46bdf67eaa5489ccdf6f5f043cbd4ce56dd72870e9f38fb7ede7721680e6a3fd72f46de
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- s3_media_server_api (0.1.2.2)
4
+ s3_media_server_api (0.1.2.3)
5
5
  asynk (>= 0.0.1)
6
6
  curb
7
7
  faraday
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
@@ -1,3 +1,3 @@
1
1
  module S3MediaServerApi
2
- VERSION = "0.1.2.3"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_media_server_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2.3
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ayrat Badykov