Class: PkiExpress::PadesPageOptimization
- Inherits:
-
Object
- Object
- PkiExpress::PadesPageOptimization
- Defined in:
- lib/pki_express/pades_page_optimization.rb
Instance Attribute Summary collapse
-
#custom_paper_size ⇒ Object
Returns the value of attribute custom_paper_size.
-
#page_orientation ⇒ Object
Returns the value of attribute page_orientation.
-
#paper_size ⇒ Object
Returns the value of attribute paper_size.
Instance Method Summary collapse
-
#initialize(paper_size = nil, custom_paper_size = nil) ⇒ PadesPageOptimization
constructor
A new instance of PadesPageOptimization.
- #to_model ⇒ Object
Constructor Details
#initialize(paper_size = nil, custom_paper_size = nil) ⇒ PadesPageOptimization
Returns a new instance of PadesPageOptimization.
5 6 7 8 9 10 11 12 13 |
# File 'lib/pki_express/pades_page_optimization.rb', line 5 def initialize(paper_size=nil, custom_paper_size=nil) @page_orientation = PadesPageOrientation::AUTO if custom_paper_size @paper_size = PadesPaperSize::CUSTOM @custom_paper_size = custom_paper_size else @paper_size = paper_size end end |
Instance Attribute Details
#custom_paper_size ⇒ Object
Returns the value of attribute custom_paper_size.
3 4 5 |
# File 'lib/pki_express/pades_page_optimization.rb', line 3 def custom_paper_size @custom_paper_size end |
#page_orientation ⇒ Object
Returns the value of attribute page_orientation.
3 4 5 |
# File 'lib/pki_express/pades_page_optimization.rb', line 3 def page_orientation @page_orientation end |
#paper_size ⇒ Object
Returns the value of attribute paper_size.
3 4 5 |
# File 'lib/pki_express/pades_page_optimization.rb', line 3 def paper_size @paper_size end |
Instance Method Details
#to_model ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/pki_express/pades_page_optimization.rb', line 34 def to_model custom_paper_size = nil if @paper_size == PadesPaperSize::CUSTOM if @custom_paper_size custom_paper_size = @custom_paper_size&.to_model else raise 'paper_size is set to :custom but no custom_paper_size was set' end end { 'pageSize': @paper_size, 'customPageSize': custom_paper_size, 'pageOrientation': @page_orientation, } end |