Class: Uploader::Service
- Includes:
- Helpers
- Defined in:
- lib/uploader/service.rb
Direct Known Subclasses
Constant Summary collapse
- @@services =
{}
Class Method Summary collapse
-
.is_registered?(service) ⇒ Boolean
Returns whether this service appears in the Service class’s registry.
-
.register(kwds = {}) ⇒ Object
Registers the Service in the registry, so clients of the service can access it by name.
- .services ⇒ Object
Instance Method Summary collapse
-
#close! ⇒ Object
Closes the service connection, if required.
-
#connect! ⇒ Object
Called to connect to remote services like FTP and S3.
-
#initialize(config) ⇒ Service
constructor
A new instance of Service.
- #initialized? ⇒ Boolean
-
#upload(remote_path, contents) ⇒ Object
Perform the upload operation to this service.
Constructor Details
#initialize(config) ⇒ Service
Returns a new instance of Service.
13 14 15 |
# File 'lib/uploader/service.rb', line 13 def initialize(config) @config = config end |
Class Method Details
.is_registered?(service) ⇒ Boolean
Returns whether this service appears in the Service class’s registry.
47 48 49 |
# File 'lib/uploader/service.rb', line 47 def self.is_registered?(service) @@services.keys.include?(service) end |
.register(kwds = {}) ⇒ Object
Registers the Service in the registry, so clients of the service can access it by name.
52 53 54 |
# File 'lib/uploader/service.rb', line 52 def self.register(kwds={}) @@services.update(kwds) end |
.services ⇒ Object
42 43 44 |
# File 'lib/uploader/service.rb', line 42 def self.services @@services end |
Instance Method Details
#close! ⇒ Object
Closes the service connection, if required.
33 34 |
# File 'lib/uploader/service.rb', line 33 def close! end |
#connect! ⇒ Object
Called to connect to remote services like FTP and S3.
18 19 |
# File 'lib/uploader/service.rb', line 18 def connect! end |
#initialized? ⇒ Boolean
36 37 38 |
# File 'lib/uploader/service.rb', line 36 def initialized? false end |
#upload(remote_path, contents) ⇒ Object
Perform the upload operation to this service.
29 30 |
# File 'lib/uploader/service.rb', line 29 def upload(remote_path, contents) end |