lib/yoti/protobuf/v1/protobuf.rb in yoti-1.0.3 vs lib/yoti/protobuf/v1/protobuf.rb in yoti-1.1.0
- old
+ new
@@ -27,17 +27,22 @@
case content_type
when CT_UNDEFINED
raise ProtobufError, 'The content type is invalid.'
when CT_STRING
value.encode('utf-8')
- when CT_JPEG
- 'data:image/jpeg;base64,'.concat(Base64.strict_encode64(value))
when CT_DATE
value.encode('utf-8')
- when CT_PNG
- 'data:image/png;base64,'.concat(Base64.strict_encode64(value))
else
value
+ end
+ end
+
+ def image_uri_based_on_content_type(value, content_type = nil)
+ case content_type
+ when CT_JPEG
+ 'data:image/jpeg;base64,'.concat(Base64.strict_encode64(value))
+ when CT_PNG
+ 'data:image/png;base64,'.concat(Base64.strict_encode64(value))
end
end
private