Class: PkiExpress::PadesVisualImage
- Inherits:
-
Object
- Object
- PkiExpress::PadesVisualImage
- Defined in:
- lib/pki_express/pades_visual_image.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#horizontal_align ⇒ Object
Returns the value of attribute horizontal_align.
-
#mime_type ⇒ Object
Returns the value of attribute mime_type.
-
#opacity ⇒ Object
Returns the value of attribute opacity.
-
#url ⇒ Object
Returns the value of attribute url.
-
#vertical_align ⇒ Object
Returns the value of attribute vertical_align.
Instance Method Summary collapse
-
#initialize(image_content = nil, image_url = nil, image_mime_type = nil) ⇒ PadesVisualImage
constructor
A new instance of PadesVisualImage.
- #to_model ⇒ Object
Constructor Details
#initialize(image_content = nil, image_url = nil, image_mime_type = nil) ⇒ PadesVisualImage
Returns a new instance of PadesVisualImage.
7 8 9 10 11 12 13 14 |
# File 'lib/pki_express/pades_visual_image.rb', line 7 def initialize(image_content=nil, image_url = nil, image_mime_type=nil) @opacity = 100 @horizontal_align = PadesHorizontalAlign::CENTER @vertical_align = PadesVerticalAlign::CENTER @content = image_content @url = image_url @mime_type = image_mime_type end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
4 5 6 |
# File 'lib/pki_express/pades_visual_image.rb', line 4 def content @content end |
#horizontal_align ⇒ Object
Returns the value of attribute horizontal_align.
3 4 5 |
# File 'lib/pki_express/pades_visual_image.rb', line 3 def horizontal_align @horizontal_align end |
#mime_type ⇒ Object
Returns the value of attribute mime_type.
4 5 6 |
# File 'lib/pki_express/pades_visual_image.rb', line 4 def mime_type @mime_type end |
#opacity ⇒ Object
Returns the value of attribute opacity.
4 5 6 |
# File 'lib/pki_express/pades_visual_image.rb', line 4 def opacity @opacity end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/pki_express/pades_visual_image.rb', line 4 def url @url end |
#vertical_align ⇒ Object
Returns the value of attribute vertical_align.
3 4 5 |
# File 'lib/pki_express/pades_visual_image.rb', line 3 def vertical_align @vertical_align end |
Instance Method Details
#to_model ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/pki_express/pades_visual_image.rb', line 32 def to_model resource_model = { 'mimeType': @mime_type, } if @content resource_model['content'] = Base64.encode64(@content) elsif @url resource_model['url'] = @url else raise 'The image content was not set, neither its URL' end { resource: resource_model, opacity: @opacity, horizontal_align: @horizontal_align, vertical_align: @vertical_align, } end |