Class: DynamicPDFApi::DlexResource

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

Overview

Represents a Dlex resource object that is created using the DLEX file and a name.

Instance Attribute Summary collapse

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(dlex, resource_name = nil) ⇒ DlexResource

Initializes a new instance of the DlexResource class with DLEX file path and resource name as parameters.

Parameters:

  • dlex (String)

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

  • resource_name (String) (defaults to: nil)

    The name of the resource.



15
16
17
18
19
20
# File 'lib/ruby_client/DlexResource.rb', line 15

def initialize(dlex, resource_name = nil)
  @layout_data_resource_name = nil
  @_type = ResourceType::DLEX
  @_mime_type = 'application/xml'
  super(dlex, resource_name)
end

Instance Attribute Details

#layout_data_resource_nameObject

Gets or sets name for layout data resource.



29
30
31
# File 'lib/ruby_client/DlexResource.rb', line 29

def layout_data_resource_name
  @layout_data_resource_name
end

Instance Method Details

#_file_extensionObject



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

def _file_extension
  '.dlex'
end

#to_json(_options = {}) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/ruby_client/DlexResource.rb', line 31

def to_json(_options = {})
  json_array = {}
  json_array['type'] = 'dlex'

  json_array['layoutDataResourceName'] = @layout_data_resource_name
  json_array['resourceName'] = @resource_name
  JSON.pretty_generate(json_array)
end