remote_files 3.0.2 → 3.3.0

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
- SHA1:
3
- metadata.gz: 7eb3bb17b8ce4eada434b51a093440ccdb5704e0
4
- data.tar.gz: 015a8bf9379626635aa58a73e15a8e9684effc4f
2
+ SHA256:
3
+ metadata.gz: f2bdd40ed1be30e3649f6089e603134e8cbc4bf8445d8b355f769b4ce29c2b25
4
+ data.tar.gz: 9a4d13593c4022eff78130eaf61d61e83a6bd8cfaae164636dfd81fca95fd7d2
5
5
  SHA512:
6
- metadata.gz: 07b76566a9048eabcd4608f29609a34259e0f7ef1c134ce8d6e6155630c74b0330d44000594ceb14bd5c9d2bb4ef7c3467424894de21f9b44c2c2bb9fd7dd15a
7
- data.tar.gz: 58d458f04016d0c72f0ea4339763bfb1d38d1f705c7e819e6528607c6ff2dd723a8af01005388e60b75b9aa3e9fe34df274d7b1ac95ddb453edffb547f38cc9a
6
+ metadata.gz: 648b24549307387c950a8ef5f72b0df42f6274eb53889b8c207e0aaba40618bbe1d1bbb43192baf6b037d43c885d492739994ee204a4e65e041321c4640e5d92
7
+ data.tar.gz: 8ad800c0ddd17a85e4631d6b38e960287c278127b88ec349cb2df890e37442e3fba4239e1219b6b54d66b6cebaf328bb92571607a6e3fd9817e2ef0dbc0ee7c0
@@ -1,9 +1,9 @@
1
1
  module RemoteFiles
2
2
  class File
3
- attr_reader :content, :content_type, :identifier, :stored_in, :configuration
3
+ attr_reader :content, :content_type, :identifier, :stored_in, :configuration, :populate_stored_in
4
4
 
5
5
  def initialize(identifier, options = {})
6
- known_keys = [:identifier, :stored_in, :content_type, :configuration, :content]
6
+ known_keys = [:identifier, :stored_in, :content_type, :configuration, :content, :populate_stored_in]
7
7
  known_keys.each do |key|
8
8
  options[key] ||= options.delete(key.to_s)
9
9
  end
@@ -14,6 +14,7 @@ module RemoteFiles
14
14
  @content_type = options[:content_type]
15
15
  @configuration = RemoteFiles::CONFIGURATIONS[(options[:configuration] || :default).to_sym]
16
16
  @logger = options[:logger]
17
+ @populate_stored_in = options[:populate_stored_in]
17
18
  @options = options
18
19
  end
19
20
 
@@ -34,7 +35,8 @@ module RemoteFiles
34
35
  :identifier => identifier,
35
36
  :stored_in => stored_in,
36
37
  :content_type => content_type,
37
- :configuration => configuration.name
38
+ :configuration => configuration.name,
39
+ :populate_stored_in => populate_stored_in
38
40
  )
39
41
  end
40
42
 
@@ -79,6 +81,8 @@ module RemoteFiles
79
81
  next unless file
80
82
  @content = file.content
81
83
  @content_type = file.content_type
84
+ # :populate_stored_in is a boolean
85
+ @stored_in = file.stored_in if @populate_stored_in
82
86
  return true
83
87
  rescue Error => e
84
88
  end
@@ -48,16 +48,22 @@ module RemoteFiles
48
48
  end
49
49
 
50
50
  def delete!(identifier)
51
- connection.delete_object(directory.key, identifier)
51
+ if identifier.to_s.chomp.empty?
52
+ message = "Empty identifier is not supported"
53
+ raise RemoteFiles::Error, message
54
+ end
55
+
56
+ connection.delete_object(directory_name, identifier)
52
57
  rescue Fog::Errors::NotFound, Excon::Errors::NotFound
53
58
  raise NotFoundError, $!.message, $!.backtrace
54
59
  end
55
60
 
56
61
  def connection
57
- connection_options = options.dup
58
- connection_options.delete(:directory)
59
- connection_options.delete(:public)
60
- @connection ||= Fog::Storage.new(connection_options)
62
+ opts = options.dup
63
+ opts.delete(:directory)
64
+ opts.delete(:public)
65
+ opts[:connection_options] ||= default_connection_options
66
+ @connection ||= Fog::Storage.new(opts)
61
67
  end
62
68
 
63
69
  def directory_name
@@ -70,6 +76,13 @@ module RemoteFiles
70
76
 
71
77
  protected
72
78
 
79
+ def default_connection_options
80
+ {
81
+ retry_limit: 0,
82
+ retry_interval: 0
83
+ }
84
+ end
85
+
73
86
  def aws_host
74
87
  case options[:region]
75
88
  when nil, 'us-east-1'
@@ -1,3 +1,3 @@
1
1
  module RemoteFiles
2
- VERSION = '3.0.2'
2
+ VERSION = '3.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_files
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mick Staugaard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-02 00:00:00.000000000 Z
11
+ date: 2022-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-aws
@@ -59,7 +59,7 @@ files:
59
59
  - lib/remote_files/version.rb
60
60
  homepage: https://github.com/zendesk/remote_files
61
61
  licenses:
62
- - Apache License Version 2.0
62
+ - Apache-2.0
63
63
  metadata: {}
64
64
  post_install_message:
65
65
  rdoc_options: []
@@ -76,8 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
- rubyforge_project:
80
- rubygems_version: 2.5.1
79
+ rubygems_version: 3.0.3.1
81
80
  signing_key:
82
81
  specification_version: 4
83
82
  summary: The purpose of the library is to implement a simple interface for uploading