Class: DynamicPDFApi::PdfResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/ruby_client/PdfResource.rb

Overview

Represents a pdf resource.

Instance Attribute Summary

Attributes inherited from Resource

#_file_path, #_mime_type, #data, #resource_name

Instance Method Summary collapse

Methods inherited from Resource

_get_file_data

Constructor Details

#initialize(file, resource_name = nil) ⇒ PdfResource

Initializes a new instance of the PdfResource class.

Parameters:

  • file (String)

    |[Array]| The pdf file path or the byte array of the pdf file or the stream of the pdf file.

  • resource_name (String) (defaults to: nil)

    The name of the resource.



15
16
17
18
# File 'lib/ruby_client/PdfResource.rb', line 15

def initialize(file, resource_name = nil)
  super(file, resource_name)
  @_mime_type = "application/pdf"
end

Instance Method Details

#_file_extensionObject



22
23
24
# File 'lib/ruby_client/PdfResource.rb', line 22

def _file_extension
  ".pdf"
end

#to_json(_options = {}) ⇒ Object

?string ResourcePath



28
29
30
31
32
33
34
# File 'lib/ruby_client/PdfResource.rb', line 28

def to_json(_options = {})
  @input_json = {}
  @input_json["type"] = @_type

  @input_json["resourceName"] = @resource_name
  JSON.pretty_generate(@input_json)
end