s3_media_server_api 0.1.0.7 → 0.1.0.8

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: 9dd5d2438d4686aef0f18d3bf611f72e4916dd34
4
- data.tar.gz: bc6826997c05d221a2af7a902da1d954ce511dea
3
+ metadata.gz: 6137959049d0ca304ce6a9fb54a4d554329ad952
4
+ data.tar.gz: b4f3db29a96fb7fc14793ff39004f7161b81c381
5
5
  SHA512:
6
- metadata.gz: d665f7356ee6ceda17205ef6ab8b3bdb47c067aeb0c03fc53acfe33e50719f47fc0d0d315fa9dd35d7e62dc93f871588d4723b4648067078a1578f7c21455788
7
- data.tar.gz: 6abd0d44ea37b137b63dfb8d3a1368fbcc081233eea23322ea76e0c4b33eae8315c371ff6460bbcf33b6c0f48c2ad99f860d57c01fb7308f774c5b1f7d8af7fb
6
+ metadata.gz: 6412204c30d589b5eed399c86890259f1d793d29805b8f5ae96045760b52f8ddf35ea181a86cfc381b2dca4250de3e318f34b8db2c927d2c3c2d3114d7e2a561
7
+ data.tar.gz: 98844fb3bd9e607246fd24d5329a7cde836e19e14e61e41051ba17320b0f71dfedd0854f7f3577b2ecdd940c8570262d64d4039acd5ef9140961c6092e6b3159
data/README.md CHANGED
@@ -23,10 +23,13 @@ Or install it yourself as:
23
23
  ### Available resources
24
24
 
25
25
  #### S3MediaServerApi::Media::Document
26
- Use S3MediaServerApi::Media::Document to interact Document resource
26
+ Use S3MediaServerApi::Media::Document to interact with Document resource
27
27
  ```ruby
28
+ # to create document from existing aws file uuid, use create method
29
+ document = S3MediaServerApi::Media::Document.create("4edbfdf9-9517-4902-8e92-2212215b0de5")
30
+
28
31
  # if you want create document from file path, use create method
29
- created_document = S3MediaServerApi::Media::Document.create('/Users/ayrat/Development/s3_media_server_api/tmp/sample_mpeg4.mp4')
32
+ created_document = S3MediaServerApi::Media::Document.create_from_path('/Users/ayrat/Development/s3_media_server_api/tmp/sample_mpeg4.mp4')
30
33
 
31
34
 
32
35
  # to resolve document, use resolve method
@@ -44,10 +47,13 @@ resolved_document.name # url of document
44
47
  S3MediaServerApi::Media::Document.destroy(created_document.uuid)
45
48
  ```
46
49
  #### S3MediaServerApi::Media::Image
47
- Use S3MediaServerApi::Media::Image to interact Image resource
50
+ Use S3MediaServerApi::Media::Image to interact with Image resource
48
51
  ```ruby
52
+ # to create image from existing aws file uuid, use create method
53
+ image = S3MediaServerApi::Media::Image.create("4edbfdf9-9517-4902-8e92-2212215b0de5")
54
+
49
55
  # if you want create image from file path, use create method
50
- created_image = S3MediaServerApi::Media::Image.create('/Users/ayrat/Development/s3_media_server_api/tmp/test_image.jpg')
56
+ created_image = S3MediaServerApi::Media::Image.create_from_path('/Users/ayrat/Development/s3_media_server_api/tmp/test_image.jpg')
51
57
 
52
58
  # to resolve image, use resolve method
53
59
  resolved_image = S3MediaServerApi::Media::Image.resolve(created_image.uuid)
@@ -78,10 +84,13 @@ copied_image = S3MediaServerApi::Media::Image.copy(created_image.uuid)
78
84
  S3MediaServerApi::Media::Image.destroy(created_image.uuid)
79
85
  ```
80
86
  #### S3MediaServerApi::Media::Audio
81
- Use S3MediaServerApi::Media::Audio to interact Audio resource
87
+ Use S3MediaServerApi::Media::Audio to interact with Audio resource
82
88
  ```ruby
89
+ # to create audio from existing aws file uuid, use create method
90
+ audio = S3MediaServerApi::Media::Audio.create("4edbfdf9-9517-4902-8e92-2212215b0de5")
91
+
83
92
  # to create audio file from its path, use create method
84
- created_audio = S3MediaServerApi::Media::Audio.create('/Users/ayrat/Development/s3_media_server_api/tmp/music_test.mp3')
93
+ created_audio = S3MediaServerApi::Media::Audio.create_from_path('/Users/ayrat/Development/s3_media_server_api/tmp/music_test.mp3')
85
94
  # to resolve image, use resolve method
86
95
  resolved_audio = S3MediaServerApi::Media::Audio.resolve(created_audio.uuid)
87
96
 
@@ -114,10 +123,13 @@ cutted_audio.sample_duration
114
123
  S3MediaServerApi::Media::Audio.destroy(created_audio.uuid)
115
124
  ```
116
125
  #### S3MediaServerApi::Media::Video
117
- Use S3MediaServerApi::Media::Video to interact Video resource
126
+ Use S3MediaServerApi::Media::Video to interact with Video resource
118
127
  ```ruby
128
+ # to create video from existing aws file uuid, use create method
129
+ video = S3MediaServerApi::Media::Video.create("4edbfdf9-9517-4902-8e92-2212215b0de5")
130
+
119
131
  # to create video from its path, use create method
120
- video = S3MediaServerApi::Media::Video.create('/Users/ayrat/Development/s3_media_server_api/tmp/sample_mpeg4.mp4')
132
+ video = S3MediaServerApi::Media::Video.create_from_path('/Users/ayrat/Development/s3_media_server_api/tmp/sample_mpeg4.mp4')
121
133
 
122
134
  # to resolve video, use resolve method
123
135
  video = S3MediaServerApi::Media::Video.resolve(video.uuid)
@@ -20,7 +20,11 @@ module S3MediaServerApi
20
20
  end
21
21
 
22
22
  class << self
23
- def create(path)
23
+ def create(uuid)
24
+ Audio.new(super(path))
25
+ end
26
+
27
+ def create_from_path(path)
24
28
  Audio.new(super(path))
25
29
  end
26
30
 
@@ -0,0 +1,38 @@
1
+ module S3MediaServerApi
2
+ module Media
3
+ class COLLECTION < CommonMediaApi
4
+ COLLECTION = 'collection'
5
+
6
+ def videos
7
+ @params[:videos].map { |video| Video.new(video) } if @params[:videos]
8
+ end
9
+
10
+ def images
11
+ @params[:images].map { |image| Image::ImageObject.new(image) } if @params[:images]
12
+ end
13
+
14
+ def documents
15
+ @params[:documents].map { |documents| Video.new(document) } if @params[:documents]
16
+ end
17
+
18
+ def audios
19
+ @params[:audios].map { |audios| Audio.new(audio) } if @params[:audios]
20
+ end
21
+
22
+ def owner_uuid
23
+ @params[:owner_uuid]
24
+ end
25
+
26
+ class << self
27
+
28
+ def resolve(uuid)
29
+ Collection.new(super(uuid))
30
+ end
31
+
32
+ private
33
+
34
+ def media_type; COLLECTION; end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -34,19 +34,22 @@ module S3MediaServerApi
34
34
  end
35
35
 
36
36
  class << self
37
+ def create(uuid)
38
+ params = (media_type == 'video') ? { uuid: uuid } : { aws_file_uuid: uuid }
39
+ response = AsynkRequest.sync_request(base_path, :create, params)
40
+ raise CreationError.message_from_asynk_response(response) unless response.success?
41
+ response
42
+ end
37
43
  #
38
44
  # creates media file
39
45
  # parameters: path - file path in file system
40
46
  #
41
47
  # returns: response with created AwsFile information
42
48
  #
43
- def create(path)
49
+ def create_from_path(path)
44
50
  aws_file = S3MediaServerApi::Config.mocked ? Mocked::Uploader.upload(path) : Uploader.upload(path)
45
51
  uuid = aws_file.uuid
46
- params = (media_type == 'video') ? { uuid: uuid } : { aws_file_uuid: uuid }
47
- response = AsynkRequest.sync_request(base_path, :create, params)
48
- raise CreationError.message_from_asynk_response(response) unless response.success?
49
- response
52
+ create(uuid)
50
53
  end
51
54
  #
52
55
  # destroys media file
@@ -8,8 +8,11 @@ module S3MediaServerApi
8
8
  end
9
9
 
10
10
  class << self
11
+ def create(uuid)
12
+ Document.new(super(path))
13
+ end
11
14
 
12
- def create(path)
15
+ def create_from_path(path)
13
16
  Document.new(super(path))
14
17
  end
15
18
 
@@ -35,8 +35,11 @@ module S3MediaServerApi
35
35
  end
36
36
 
37
37
  class << self
38
+ def create(uuid)
39
+ Image.new(super(path))
40
+ end
38
41
 
39
- def create(path)
42
+ def create_from_path(path)
40
43
  Image.new(super(path))
41
44
  end
42
45
 
@@ -54,8 +54,11 @@ module S3MediaServerApi
54
54
  end
55
55
 
56
56
  class << self
57
+ def create(uuid)
58
+ Video.new(super(path))
59
+ end
57
60
 
58
- def create(path)
61
+ def create_from_path(path)
59
62
  Video.new(super(path))
60
63
  end
61
64
 
@@ -1,3 +1,3 @@
1
1
  module S3MediaServerApi
2
- VERSION = "0.1.0.7"
2
+ VERSION = "0.1.0.8"
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.0.7
4
+ version: 0.1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ayrat Badykov
@@ -146,6 +146,7 @@ files:
146
146
  - lib/s3_media_server_api/file_part.rb
147
147
  - lib/s3_media_server_api/media.rb
148
148
  - lib/s3_media_server_api/media/audio.rb
149
+ - lib/s3_media_server_api/media/collection.rb
149
150
  - lib/s3_media_server_api/media/common_media_api.rb
150
151
  - lib/s3_media_server_api/media/document.rb
151
152
  - lib/s3_media_server_api/media/image.rb