Class: PrintNode::PrintJob
- Inherits:
-
Object
- Object
- PrintNode::PrintJob
- Defined in:
- lib/printnode/printjob.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#printer_id ⇒ Object
Returns the value of attribute printer_id.
-
#source ⇒ Object
Returns the value of attribute source.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(printer_id, title, content_type, content, source) ⇒ PrintJob
constructor
A new instance of PrintJob.
- #to_hash ⇒ Object
Constructor Details
#initialize(printer_id, title, content_type, content, source) ⇒ PrintJob
Returns a new instance of PrintJob.
24 25 26 27 28 29 30 |
# File 'lib/printnode/printjob.rb', line 24 def initialize(printer_id, title, content_type, content, source) @printer_id = printer_id @title = title @content_type = content_type @content = content @source = source end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
7 8 9 |
# File 'lib/printnode/printjob.rb', line 7 def content @content end |
#content_type ⇒ Object
Returns the value of attribute content_type.
6 7 8 |
# File 'lib/printnode/printjob.rb', line 6 def content_type @content_type end |
#printer_id ⇒ Object
Returns the value of attribute printer_id.
4 5 6 |
# File 'lib/printnode/printjob.rb', line 4 def printer_id @printer_id end |
#source ⇒ Object
Returns the value of attribute source.
8 9 10 |
# File 'lib/printnode/printjob.rb', line 8 def source @source end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/printnode/printjob.rb', line 5 def title @title end |
Instance Method Details
#to_hash ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/printnode/printjob.rb', line 10 def to_hash hash = {} hash['printerId'] = @printer_id hash['title'] = @title hash['contentType'] = @content_type if @content_type.match('base64$') hash ['content'] = base64.encode(IO.read(@content)) else hash ['content'] = @content end hash['source'] = @source hash end |