Class: Egree::Document
- Inherits:
-
Object
- Object
- Egree::Document
- Defined in:
- lib/egree/document.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #add_form_field(form_field) ⇒ Object
- #content_type ⇒ Object
- #data ⇒ Object
- #filename ⇒ Object
- #form_fields ⇒ Object
-
#initialize(path, filename: nil, username: nil, password: nil) ⇒ Document
constructor
A new instance of Document.
- #size ⇒ Object
Constructor Details
#initialize(path, filename: nil, username: nil, password: nil) ⇒ Document
Returns a new instance of Document.
10 11 12 13 14 15 |
# File 'lib/egree/document.rb', line 10 def initialize path, filename: nil, username: nil, password: nil @path = path @filename = filename @username = username @password = password end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
8 9 10 |
# File 'lib/egree/document.rb', line 8 def password @password end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/egree/document.rb', line 8 def path @path end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
8 9 10 |
# File 'lib/egree/document.rb', line 8 def username @username end |
Instance Method Details
#add_form_field(form_field) ⇒ Object
33 34 35 |
# File 'lib/egree/document.rb', line 33 def add_form_field form_field self.form_fields << form_field end |
#content_type ⇒ Object
25 26 27 |
# File 'lib/egree/document.rb', line 25 def content_type "application/pdf" end |
#data ⇒ Object
29 30 31 |
# File 'lib/egree/document.rb', line 29 def data Base64.encode64 file_contents end |
#filename ⇒ Object
17 18 19 |
# File 'lib/egree/document.rb', line 17 def filename @filename || File.basename(path) end |
#form_fields ⇒ Object
37 38 39 |
# File 'lib/egree/document.rb', line 37 def form_fields @form_fields ||= [] end |
#size ⇒ Object
21 22 23 |
# File 'lib/egree/document.rb', line 21 def size file.size end |