Class: OodAppkit::Urls::Files
- Inherits:
-
OodAppkit::Url
- Object
- OodAppkit::Url
- OodAppkit::Urls::Files
- Defined in:
- lib/ood_appkit/urls/files.rb
Overview
A class used to handle URLs for the system Files app.
Instance Attribute Summary
Attributes inherited from OodAppkit::Url
Instance Method Summary collapse
-
#api(opts = {}) ⇒ Addressable::URI
URL to access this app’s API for a given absolute file path.
-
#initialize(fs_url: '/fs', api_url: '/api/v1/fs', template: '{/url*}{+path}', **kwargs) ⇒ Files
constructor
A new instance of Files.
-
#url(opts = {}) ⇒ Addressable::URI
URL to access this app for a given absolute file path.
Constructor Details
#initialize(fs_url: '/fs', api_url: '/api/v1/fs', template: '{/url*}{+path}', **kwargs) ⇒ Files
Returns a new instance of Files.
8 9 10 11 12 |
# File 'lib/ood_appkit/urls/files.rb', line 8 def initialize(fs_url: '/fs', api_url: '/api/v1/fs', template: '{/url*}{+path}', **kwargs) super(template: template, **kwargs) @fs_url = parse_url_segments(fs_url.to_s) @api_url = parse_url_segments(api_url.to_s) end |
Instance Method Details
#api(opts = {}) ⇒ Addressable::URI
URL to access this app’s API for a given absolute file path
31 32 33 34 35 36 |
# File 'lib/ood_appkit/urls/files.rb', line 31 def api(opts = {}) opts = opts.to_h.compact.symbolize_keys path = opts.fetch(:path, "").to_s @template. url: @base_url + @api_url, path: path end |
#url(opts = {}) ⇒ Addressable::URI
URL to access this app for a given absolute file path
19 20 21 22 23 24 |
# File 'lib/ood_appkit/urls/files.rb', line 19 def url(opts = {}) opts = opts.to_h.compact.symbolize_keys path = opts.fetch(:path, "").to_s @template. url: @base_url + @fs_url, path: path end |