s3_media_server_api 0.1.0.3 → 0.1.0.4

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: 08a2de75389b8b5e69730bdc44e6533be43d9a4d
4
- data.tar.gz: 4275759bd4415a705a08024502d3b5cf483d176d
3
+ metadata.gz: b1d6c3199b40b9c3ff7ece6a08b5f686c4216357
4
+ data.tar.gz: 334651586a453a121158806530716034a3a029da
5
5
  SHA512:
6
- metadata.gz: 08c052f17bac376dbacc05ddb2f6ddaf141ddcc1b3ca9b6e56da18e178970cdbaad6544cd897f87fede6a5e01776beeb7f16db9efddd58300dc320923b270046
7
- data.tar.gz: e9b1d1156d42f2f6b6aa83d0a9f769c55c2b94809b0d140012f1dbfe81db8278dd575c8c99b9badabb8545d2397a5c0dfe49eac8186e48b0957efb69e4edc1c1
6
+ metadata.gz: c0307f0a595c7cb67d4e84d11e6a4aad4fb41085a07cc5bc1ac53e73f533d950f5e65d839f67aa3e9672ab60ce70946ad69bc79dee2cf14e892673a40d2f0e6c
7
+ data.tar.gz: f1ddc8898e315d1d5b5df431d0096e5c6da02a5e55a86f730c57e97f8cbe51e4fc9c8a06d4491de2b3658e7cb76fb72e56e4daddd3a7d96bfe8d89fdd3b71496
data/README.md CHANGED
@@ -172,6 +172,56 @@ aws_file.name
172
172
  ```
173
173
  NOTE: you can't remove aws file without creating media resource
174
174
 
175
+ ## Configuration
176
+
177
+ You can configure the following values by overriding these values using S3MediaServerApi::Config.configure method.
178
+
179
+ ```ruby
180
+ # in how many threads file will be uploaded
181
+ # by default upload_thread_count value is 4
182
+ upload_thread_count
183
+ # class that will cache queries to S3 Media Server
184
+ cache_class
185
+ ```
186
+
187
+ Example
188
+ ```ruby
189
+
190
+ S3MediaServerApi::Config.configure do |config|
191
+ config.upload_thread_count = 10
192
+ end
193
+ ```
194
+
195
+ #### Configuring cache class
196
+
197
+ Define class with class method fetch
198
+ ```ruby
199
+
200
+ class Infrastructure::S3MediaServerCacheService
201
+
202
+ class << self
203
+ def fetch(key, params={}, &block)
204
+ Rails.cache.fetch(key, expires_in: 24.hours) do
205
+ yield
206
+ end
207
+ end
208
+ end
209
+ end
210
+
211
+ ```
212
+ Then override cache_class in S3MediaServerApi::Config.configure
213
+ ```ruby
214
+
215
+ S3MediaServerApi::Config.configure do |config|
216
+ config.cache_class = Infrastructure::S3MediaServerCacheService
217
+ end
218
+ ```
219
+
220
+
221
+
222
+
223
+
224
+
175
225
  ## Development
176
226
 
177
227
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -31,10 +31,9 @@ module S3MediaServerApi
31
31
  end
32
32
  end
33
33
 
34
- add_config :mocked
35
34
  add_config :cache_class, S3MediaServerApi::Cache
36
35
  add_config :upload_thread_count, 4
37
36
 
38
- required :mocked, :cache_class, :upload_thread_count
37
+ required :cache_class, :upload_thread_count
39
38
  end
40
39
  end
@@ -10,19 +10,19 @@ module S3MediaServerApi
10
10
  class CommonMediaApi
11
11
 
12
12
  def initialize(response)
13
- @params = response[:data]
13
+ @params = response[:data].nil? ? {} : response[:data]
14
14
  end
15
15
 
16
16
  def uuid
17
- @params[:uuid] if exist?
17
+ @params[:uuid]
18
18
  end
19
19
 
20
20
  def name
21
- @params[:name] if exist?
21
+ @params[:name]
22
22
  end
23
23
 
24
24
  def size
25
- @params[:size] if exist?
25
+ @params[:size]
26
26
  end
27
27
 
28
28
  def as_hash
@@ -30,7 +30,7 @@ module S3MediaServerApi
30
30
  end
31
31
 
32
32
  def exist?
33
- !@params.nil?
33
+ @params.empty?
34
34
  end
35
35
 
36
36
  class << self
@@ -4,7 +4,7 @@ module S3MediaServerApi
4
4
  DOCUMENT = 'document'
5
5
 
6
6
  def url
7
- @params[:url] if exist?
7
+ @params[:url]
8
8
  end
9
9
 
10
10
  class << self
@@ -6,7 +6,7 @@ module S3MediaServerApi
6
6
  class ImageObject
7
7
 
8
8
  def initialize(params)
9
- @params = params
9
+ @params = params.nil? ? {} : params
10
10
  end
11
11
 
12
12
  def url
@@ -27,11 +27,11 @@ module S3MediaServerApi
27
27
  end
28
28
 
29
29
  def source
30
- ImageObject.new(@params[:source]) if exist?
30
+ ImageObject.new(@params[:source])
31
31
  end
32
32
 
33
33
  def thumb
34
- ImageObject.new(@params[:thumb]) if exist?
34
+ ImageObject.new(@params[:thumb])
35
35
  end
36
36
 
37
37
  class << self
@@ -26,31 +26,31 @@ module S3MediaServerApi
26
26
  end
27
27
 
28
28
  def preview
29
- @params[:preview] if exist?
29
+ @params[:preview]
30
30
  end
31
31
 
32
32
  def duration
33
- @params[:duration] if exist?
33
+ @params[:duration]
34
34
  end
35
35
 
36
36
  def transcoded
37
- @params[:transcoded] if exist?
37
+ @params[:transcoded]
38
38
  end
39
39
 
40
40
  def embed_url
41
- @params[:embed_url] if exist?
41
+ @params[:embed_url]
42
42
  end
43
43
 
44
44
  def provider
45
- @params[:provider] if exist?
45
+ @params[:provider]
46
46
  end
47
47
 
48
48
  def screenshots
49
- @params[:screenshots].map { |screenshot| Image::ImageObject.new(screenshot) } if exist?
49
+ @params[:screenshots].map { |screenshot| Image::ImageObject.new(screenshot) } if @params[:screenshots]
50
50
  end
51
51
 
52
52
  def versions
53
- @params[:versions].map { |version| Version.new(version) } if exist?
53
+ @params[:versions].map { |version| Version.new(version) } if @params[:versions]
54
54
  end
55
55
 
56
56
  class << self
@@ -1,3 +1,3 @@
1
1
  module S3MediaServerApi
2
- VERSION = "0.1.0.3"
2
+ VERSION = "0.1.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.3
4
+ version: 0.1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ayrat Badykov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-14 00:00:00.000000000 Z
11
+ date: 2016-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler