Class: Bazuro::Pdf2docx
- Inherits:
-
Object
- Object
- Bazuro::Pdf2docx
- Defined in:
- lib/bazuro.rb
Instance Attribute Summary collapse
-
#docname ⇒ Object
Returns the value of attribute docname.
-
#docx ⇒ Object
Returns the value of attribute docx.
-
#pdf ⇒ Object
Returns the value of attribute pdf.
Instance Method Summary collapse
- #convert(path = Bazuro.config["local"]["temp_path"]) ⇒ Object
-
#initialize(pdf) ⇒ Pdf2docx
constructor
A new instance of Pdf2docx.
- #request ⇒ Object
- #test ⇒ Object
Constructor Details
#initialize(pdf) ⇒ Pdf2docx
Returns a new instance of Pdf2docx.
18 19 20 21 22 |
# File 'lib/bazuro.rb', line 18 def initialize(pdf) @pdf = pdf @docx = nil @docname = nil end |
Instance Attribute Details
#docname ⇒ Object
Returns the value of attribute docname.
16 17 18 |
# File 'lib/bazuro.rb', line 16 def docname @docname end |
#docx ⇒ Object
Returns the value of attribute docx.
16 17 18 |
# File 'lib/bazuro.rb', line 16 def docx @docx end |
#pdf ⇒ Object
Returns the value of attribute pdf.
16 17 18 |
# File 'lib/bazuro.rb', line 16 def pdf @pdf end |
Instance Method Details
#convert(path = Bazuro.config["local"]["temp_path"]) ⇒ Object
40 41 42 43 44 |
# File 'lib/bazuro.rb', line 40 def convert(path = Bazuro.config["local"]["temp_path"]) @docname = @pdf.split('/').last.gsub(".pdf", ".docx") @docx = "#{path}/#{@docname}" system("cd #{path} && #{Bazuro.config["local"]["winword_path"]} /mPDF2DOC /q #{@pdf}") end |
#request ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bazuro.rb', line 24 def request RestClient::Request.new( :method => :post, :url => Bazuro.config["remote"]["url"], :user => Bazuro.config["remote"]["username"], :password => Bazuro.config["remote"]["password"], :payload => { :file => @pdf } ).execute end |
#test ⇒ Object
36 37 38 |
# File 'lib/bazuro.rb', line 36 def test end |