Class: DocRaptor::PrinceOptions
- Inherits:
-
Object
- Object
- DocRaptor::PrinceOptions
- Defined in:
- lib/docraptor/models/prince_options.rb
Instance Attribute Summary collapse
-
#baseurl ⇒ Object
Set the baseurl for assets.
-
#css_dpi ⇒ Object
Set the DPI when rendering CSS.
-
#disallow_annotate ⇒ Object
Disallow annotation of this PDF.
-
#disallow_copy ⇒ Object
Disallow copying of this PDF.
-
#disallow_modify ⇒ Object
Disallow modification of this PDF.
-
#disallow_print ⇒ Object
Disallow printing of this PDF.
-
#encrypt ⇒ Object
Encrypt PDF output.
-
#http_password ⇒ Object
Set the password for HTTP authentication.
-
#http_proxy ⇒ Object
Set the HTTP proxy server.
-
#http_timeout ⇒ Object
Set the HTTP request timeout.
-
#http_user ⇒ Object
Set the user for HTTP authentication.
-
#input ⇒ Object
Specify the input format.
-
#insecure ⇒ Object
Disable SSL verification.
-
#javascript ⇒ Object
Enable PrinceXML JavaScript.
-
#key_bits ⇒ Object
Set encryption key size.
-
#media ⇒ Object
Specify the CSS media type.
-
#no_author_style ⇒ Object
Ignore author stylesheets.
-
#no_compress ⇒ Object
Disable PDF compression.
-
#no_default_style ⇒ Object
Ignore default stylesheets.
-
#no_embed_fonts ⇒ Object
Disable font embedding in PDFs.
-
#no_network ⇒ Object
Disable network access.
-
#no_subset_fonts ⇒ Object
Disable font subsetting in PDFs.
-
#no_xinclude ⇒ Object
Disable XML inclusion.
-
#owner_password ⇒ Object
Set the PDF owner password.
-
#profile ⇒ Object
In Prince 9.0 and up you can set the PDF profile.
-
#user_password ⇒ Object
Set the PDF user password.
-
#version ⇒ Object
Specify a specific verison of PrinceXML to use.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Check equality by comparing each attribute.
- #_deserialize(type, value) ⇒ Object
-
#_to_hash(value) ⇒ Object
Method to output non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
build the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Object
Calculate hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ PrinceOptions
constructor
A new instance of PrinceOptions.
-
#to_body ⇒ Object
to_body is an alias to to_body (backward compatibility)).
-
#to_hash ⇒ Object
return the object in the form of hash.
- #to_s ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ PrinceOptions
Returns a new instance of PrinceOptions.
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/docraptor/models/prince_options.rb', line 181 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} if attributes[:'baseurl'] self.baseurl = attributes[:'baseurl'] end if attributes[:'no_xinclude'] self.no_xinclude = attributes[:'no_xinclude'] end if attributes[:'no_network'] self.no_network = attributes[:'no_network'] end if attributes[:'http_user'] self.http_user = attributes[:'http_user'] end if attributes[:'http_password'] self.http_password = attributes[:'http_password'] end if attributes[:'http_proxy'] self.http_proxy = attributes[:'http_proxy'] end if attributes[:'http_timeout'] self.http_timeout = attributes[:'http_timeout'] end if attributes[:'insecure'] self.insecure = attributes[:'insecure'] end if attributes[:'media'] self.media = attributes[:'media'] else self.media = "print" end if attributes[:'no_author_style'] self. = attributes[:'no_author_style'] end if attributes[:'no_default_style'] self.no_default_style = attributes[:'no_default_style'] end if attributes[:'no_embed_fonts'] self. = attributes[:'no_embed_fonts'] end if attributes[:'no_subset_fonts'] self.no_subset_fonts = attributes[:'no_subset_fonts'] end if attributes[:'no_compress'] self.no_compress = attributes[:'no_compress'] end if attributes[:'encrypt'] self.encrypt = attributes[:'encrypt'] end if attributes[:'key_bits'] self.key_bits = attributes[:'key_bits'] end if attributes[:'user_password'] self.user_password = attributes[:'user_password'] end if attributes[:'owner_password'] self.owner_password = attributes[:'owner_password'] end if attributes[:'disallow_print'] self.disallow_print = attributes[:'disallow_print'] end if attributes[:'disallow_copy'] self.disallow_copy = attributes[:'disallow_copy'] end if attributes[:'disallow_annotate'] self.disallow_annotate = attributes[:'disallow_annotate'] end if attributes[:'disallow_modify'] self.disallow_modify = attributes[:'disallow_modify'] end if attributes[:'input'] self.input = attributes[:'input'] else self.input = "html" end if attributes[:'version'] self.version = attributes[:'version'] end if attributes[:'javascript'] self.javascript = attributes[:'javascript'] end if attributes[:'css_dpi'] self.css_dpi = attributes[:'css_dpi'] end if attributes[:'profile'] self.profile = attributes[:'profile'] end end |
Instance Attribute Details
#baseurl ⇒ Object
Set the baseurl for assets.
6 7 8 |
# File 'lib/docraptor/models/prince_options.rb', line 6 def baseurl @baseurl end |
#css_dpi ⇒ Object
Set the DPI when rendering CSS. Defaults to 96 but can be set with Prince 9.0 and up.
81 82 83 |
# File 'lib/docraptor/models/prince_options.rb', line 81 def css_dpi @css_dpi end |
#disallow_annotate ⇒ Object
Disallow annotation of this PDF.
66 67 68 |
# File 'lib/docraptor/models/prince_options.rb', line 66 def disallow_annotate @disallow_annotate end |
#disallow_copy ⇒ Object
Disallow copying of this PDF.
63 64 65 |
# File 'lib/docraptor/models/prince_options.rb', line 63 def disallow_copy @disallow_copy end |
#disallow_modify ⇒ Object
Disallow modification of this PDF.
69 70 71 |
# File 'lib/docraptor/models/prince_options.rb', line 69 def disallow_modify @disallow_modify end |
#disallow_print ⇒ Object
Disallow printing of this PDF.
60 61 62 |
# File 'lib/docraptor/models/prince_options.rb', line 60 def disallow_print @disallow_print end |
#encrypt ⇒ Object
Encrypt PDF output.
48 49 50 |
# File 'lib/docraptor/models/prince_options.rb', line 48 def encrypt @encrypt end |
#http_password ⇒ Object
Set the password for HTTP authentication.
18 19 20 |
# File 'lib/docraptor/models/prince_options.rb', line 18 def http_password @http_password end |
#http_proxy ⇒ Object
Set the HTTP proxy server.
21 22 23 |
# File 'lib/docraptor/models/prince_options.rb', line 21 def http_proxy @http_proxy end |
#http_timeout ⇒ Object
Set the HTTP request timeout.
24 25 26 |
# File 'lib/docraptor/models/prince_options.rb', line 24 def http_timeout @http_timeout end |
#http_user ⇒ Object
Set the user for HTTP authentication.
15 16 17 |
# File 'lib/docraptor/models/prince_options.rb', line 15 def http_user @http_user end |
#input ⇒ Object
Specify the input format.
72 73 74 |
# File 'lib/docraptor/models/prince_options.rb', line 72 def input @input end |
#insecure ⇒ Object
Disable SSL verification.
27 28 29 |
# File 'lib/docraptor/models/prince_options.rb', line 27 def insecure @insecure end |
#javascript ⇒ Object
Enable PrinceXML JavaScript. DocRaptor JavaScript parsing is also available elsewhere.
78 79 80 |
# File 'lib/docraptor/models/prince_options.rb', line 78 def javascript @javascript end |
#key_bits ⇒ Object
Set encryption key size.
51 52 53 |
# File 'lib/docraptor/models/prince_options.rb', line 51 def key_bits @key_bits end |
#media ⇒ Object
Specify the CSS media type. Defaults to "print" but you may want to use "screen" for web styles.
30 31 32 |
# File 'lib/docraptor/models/prince_options.rb', line 30 def media @media end |
#no_author_style ⇒ Object
Ignore author stylesheets.
33 34 35 |
# File 'lib/docraptor/models/prince_options.rb', line 33 def @no_author_style end |
#no_compress ⇒ Object
Disable PDF compression.
45 46 47 |
# File 'lib/docraptor/models/prince_options.rb', line 45 def no_compress @no_compress end |
#no_default_style ⇒ Object
Ignore default stylesheets.
36 37 38 |
# File 'lib/docraptor/models/prince_options.rb', line 36 def no_default_style @no_default_style end |
#no_embed_fonts ⇒ Object
Disable font embedding in PDFs.
39 40 41 |
# File 'lib/docraptor/models/prince_options.rb', line 39 def @no_embed_fonts end |
#no_network ⇒ Object
Disable network access.
12 13 14 |
# File 'lib/docraptor/models/prince_options.rb', line 12 def no_network @no_network end |
#no_subset_fonts ⇒ Object
Disable font subsetting in PDFs.
42 43 44 |
# File 'lib/docraptor/models/prince_options.rb', line 42 def no_subset_fonts @no_subset_fonts end |
#no_xinclude ⇒ Object
Disable XML inclusion.
9 10 11 |
# File 'lib/docraptor/models/prince_options.rb', line 9 def no_xinclude @no_xinclude end |
#owner_password ⇒ Object
Set the PDF owner password.
57 58 59 |
# File 'lib/docraptor/models/prince_options.rb', line 57 def owner_password @owner_password end |
#profile ⇒ Object
In Prince 9.0 and up you can set the PDF profile.
84 85 86 |
# File 'lib/docraptor/models/prince_options.rb', line 84 def profile @profile end |
#user_password ⇒ Object
Set the PDF user password.
54 55 56 |
# File 'lib/docraptor/models/prince_options.rb', line 54 def user_password @user_password end |
#version ⇒ Object
Specify a specific verison of PrinceXML to use.
75 76 77 |
# File 'lib/docraptor/models/prince_options.rb', line 75 def version @version end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/docraptor/models/prince_options.rb', line 87 def self.attribute_map { :'baseurl' => :'baseurl', :'no_xinclude' => :'no_xinclude', :'no_network' => :'no_network', :'http_user' => :'http_user', :'http_password' => :'http_password', :'http_proxy' => :'http_proxy', :'http_timeout' => :'http_timeout', :'insecure' => :'insecure', :'media' => :'media', :'no_author_style' => :'no_author_style', :'no_default_style' => :'no_default_style', :'no_embed_fonts' => :'no_embed_fonts', :'no_subset_fonts' => :'no_subset_fonts', :'no_compress' => :'no_compress', :'encrypt' => :'encrypt', :'key_bits' => :'key_bits', :'user_password' => :'user_password', :'owner_password' => :'owner_password', :'disallow_print' => :'disallow_print', :'disallow_copy' => :'disallow_copy', :'disallow_annotate' => :'disallow_annotate', :'disallow_modify' => :'disallow_modify', :'input' => :'input', :'version' => :'version', :'javascript' => :'javascript', :'css_dpi' => :'css_dpi', :'profile' => :'profile' } end |
.swagger_types ⇒ Object
Attribute type mapping.
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/docraptor/models/prince_options.rb', line 148 def self.swagger_types { :'baseurl' => :'String', :'no_xinclude' => :'BOOLEAN', :'no_network' => :'BOOLEAN', :'http_user' => :'String', :'http_password' => :'String', :'http_proxy' => :'String', :'http_timeout' => :'Integer', :'insecure' => :'BOOLEAN', :'media' => :'String', :'no_author_style' => :'BOOLEAN', :'no_default_style' => :'BOOLEAN', :'no_embed_fonts' => :'BOOLEAN', :'no_subset_fonts' => :'BOOLEAN', :'no_compress' => :'BOOLEAN', :'encrypt' => :'BOOLEAN', :'key_bits' => :'Integer', :'user_password' => :'String', :'owner_password' => :'String', :'disallow_print' => :'BOOLEAN', :'disallow_copy' => :'BOOLEAN', :'disallow_annotate' => :'BOOLEAN', :'disallow_modify' => :'BOOLEAN', :'input' => :'String', :'version' => :'String', :'javascript' => :'BOOLEAN', :'css_dpi' => :'Integer', :'profile' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Check equality by comparing each attribute.
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/docraptor/models/prince_options.rb', line 312 def ==(o) return true if self.equal?(o) self.class == o.class && baseurl == o.baseurl && no_xinclude == o.no_xinclude && no_network == o.no_network && http_user == o.http_user && http_password == o.http_password && http_proxy == o.http_proxy && http_timeout == o.http_timeout && insecure == o.insecure && media == o.media && == o. && no_default_style == o.no_default_style && == o. && no_subset_fonts == o.no_subset_fonts && no_compress == o.no_compress && encrypt == o.encrypt && key_bits == o.key_bits && user_password == o.user_password && owner_password == o.owner_password && disallow_print == o.disallow_print && disallow_copy == o.disallow_copy && disallow_annotate == o.disallow_annotate && disallow_modify == o.disallow_modify && input == o.input && version == o.version && javascript == o.javascript && css_dpi == o.css_dpi && profile == o.profile end |
#_deserialize(type, value) ⇒ Object
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
# File 'lib/docraptor/models/prince_options.rb', line 374 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value =~ /^(true|t|yes|y|1)$/i true else false end when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model _model = DocRaptor.const_get(type).new _model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Object
Method to output non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/docraptor/models/prince_options.rb', line 431 def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
build the object from hash
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/docraptor/models/prince_options.rb', line 355 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) else #TODO show warning in debug mode end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) else # data not found in attributes(hash), not an issue as the data can be optional end end self end |
#eql?(o) ⇒ Boolean
345 346 347 |
# File 'lib/docraptor/models/prince_options.rb', line 345 def eql?(o) self == o end |
#hash ⇒ Object
Calculate hash code according to all attributes.
350 351 352 |
# File 'lib/docraptor/models/prince_options.rb', line 350 def hash [baseurl, no_xinclude, no_network, http_user, http_password, http_proxy, http_timeout, insecure, media, , no_default_style, , no_subset_fonts, no_compress, encrypt, key_bits, user_password, owner_password, disallow_print, disallow_copy, disallow_annotate, disallow_modify, input, version, javascript, css_dpi, profile].hash end |
#to_body ⇒ Object
to_body is an alias to to_body (backward compatibility))
414 415 416 |
# File 'lib/docraptor/models/prince_options.rb', line 414 def to_body to_hash end |
#to_hash ⇒ Object
return the object in the form of hash
419 420 421 422 423 424 425 426 427 |
# File 'lib/docraptor/models/prince_options.rb', line 419 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ Object
409 410 411 |
# File 'lib/docraptor/models/prince_options.rb', line 409 def to_s to_hash.to_s end |