Class: Vidload::Mp4::Api::DownloaderBuilder
- Inherits:
-
Object
- Object
- Vidload::Mp4::Api::DownloaderBuilder
- Defined in:
- lib/vidload/mp4/api.rb
Constant Summary collapse
- REQUIRED_ARGS =
%i[video_url video_hub_url playwright_cli_path].freeze
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize ⇒ DownloaderBuilder
constructor
A new instance of DownloaderBuilder.
- #with_kwargs(**kwargs) ⇒ Object
- #with_playwright_cli_path(playwright_cli_path) ⇒ Object
- #with_video_hub_url(video_hub_url) ⇒ Object
- #with_video_name(video_name) ⇒ Object
- #with_video_url(video_url) ⇒ Object
Constructor Details
#initialize ⇒ DownloaderBuilder
Returns a new instance of DownloaderBuilder.
15 16 17 |
# File 'lib/vidload/mp4/api.rb', line 15 def initialize @kwargs = {} end |
Instance Method Details
#build ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/vidload/mp4/api.rb', line 44 def build REQUIRED_ARGS.each do |required_arg| raise ArgumentError, "#{required_arg} must be provided" unless @kwargs[required_arg] end @kwargs[:video_name] = @kwargs[:video_url].split('/').last unless @kwargs[:video_name] Downloader.new(**@kwargs) end |
#with_kwargs(**kwargs) ⇒ Object
19 20 21 22 |
# File 'lib/vidload/mp4/api.rb', line 19 def with_kwargs(**kwargs) @kwargs = kwargs self end |
#with_playwright_cli_path(playwright_cli_path) ⇒ Object
39 40 41 42 |
# File 'lib/vidload/mp4/api.rb', line 39 def with_playwright_cli_path(playwright_cli_path) @kwargs[:playwright_cli_path] = playwright_cli_path self end |
#with_video_hub_url(video_hub_url) ⇒ Object
34 35 36 37 |
# File 'lib/vidload/mp4/api.rb', line 34 def with_video_hub_url(video_hub_url) @kwargs[:video_hub_url] = video_hub_url self end |
#with_video_name(video_name) ⇒ Object
24 25 26 27 |
# File 'lib/vidload/mp4/api.rb', line 24 def with_video_name(video_name) @kwargs[:video_name] = video_name self end |
#with_video_url(video_url) ⇒ Object
29 30 31 32 |
# File 'lib/vidload/mp4/api.rb', line 29 def with_video_url(video_url) @kwargs[:video_url] = video_url self end |