Class: Mushy::Pdf
Instance Attribute Summary
Attributes inherited from Flux
#config, #flow, #id, #masher, #parent_fluxs, #subscribed_to, #type
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Browser
#get_the_cookies_from, #get_the_headers_from, #process
Methods inherited from Flux
#convert_this_to_an_array, #convert_to_symbolized_hash, #execute, #execute_single_event, #group_these_results, #guard, #ignore_these_results, inherited, #initialize, #join_these_results, #limit_these_results, #merge_these_results, #model_these_results, #outgoing_split_these_results, #process, #shape_these, #sort_these_results, #standardize_these
Constructor Details
This class inherits a constructor from Mushy::Flux
Class Method Details
.details ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/mushy/fluxs/pdf.rb', line 5 def self.details details = Browser.details details[:name] = 'Pdf' details[:title] = 'PDF' details[:description] = 'Turn a URL into a PDF.' details[:config][:path] = { description: 'The path of the PDF file to save.', type: 'text', value: 'picture.pdf', } details[:config][:landscape] = { description: 'Build the PDF in landscape. Defaults to false.', type: 'boolean', shrink: true, value: '', } details.tap do |config| config[:examples] = { "PDF of google.com" => { description: 'This will open https://www.google.com and take a screenshot.', config: { url: "https://www.google.com", file: 'file.pdf' }, result: { url: "https://www.google.com/", status: 200, title: "Google", cookies: [ { name: "1P_JAR", value: "2021-10-07-21", domain: ".google.com", path: "/", expires: 1636232420.005369, size: 19, httpOnly: false, secure: true, session: false, sameSite: "None", priority: "Medium" } ], headers: {}, time: 1.520785498, body: "...", options: { path: "file.pdf", full: true, quality: 100 }, file: { inode: "439545", hard_links: 1, owner: "pi", group: "pi", size: 54269, date: { year: 2021, month: 10, day: 7, hour: 16, minute: 0, second: 20, nanosecond: 444437482, utc_offset: -18000, weekday: 4, day_of_month: 7, day_of_year: 280, string: "2021-10-07 16:00:20 -0500", epoch_integer: 1633640420, epoch_float: 1633640420.4444375, seconds_ago: 0.016297478 }, name: "file.pdf", type: "-", owner_permission: "rw-", group_permission: "r--", other_permission: "r--", directory: "/home/pi/Desktop/mushy", path: "/home/pi/Desktop/mushy/file.pdf" } } }, } config[:fluxGroup] = { name: 'Export' } end end |
Instance Method Details
#adjust(input) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/mushy/fluxs/pdf.rb', line 97 def adjust input the_browser = input[:browser] the_result = input[:result] the_config = input[:config] = { path: the_config[:path], } [:landscape] = true if the_config[:landscape].to_s == 'true' the_browser.pdf { options: , file: Mushy::Ls.new.process({}, { path: [:path] })[0] } end |