Class: DynamicPDFApi::LayoutDataResource
- Defined in:
- lib/ruby_client/LayoutDataResource.rb
Overview
Represents the Layout data resource used to create the PDF reports.
Instance Attribute Summary collapse
-
#layout_data_resource_name ⇒ Object
Gets or sets name of the layout data resource.
Attributes inherited from Resource
#_file_path, #_mime_type, #data, #resource_name
Instance Method Summary collapse
- #_file_extension ⇒ Object
-
#initialize(layout = nil, layout_data_resource_name = nil) ⇒ LayoutDataResource
constructor
Initializes a new instance of the LayoutDataResource class using the layout data object and a resource name.
- #to_json(_options = {}) ⇒ Object
Methods inherited from Resource
Constructor Details
#initialize(layout = nil, layout_data_resource_name = nil) ⇒ LayoutDataResource
Initializes a new instance of the LayoutDataResource class using the layout data object and a resource name.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ruby_client/LayoutDataResource.rb', line 17 def initialize(layout = nil, layout_data_resource_name = nil) super() @data = if layout.is_a?(String) Resource._get_file_data(layout) else layout.to_json end @layout_data_resource_name = if layout_data_resource_name.nil? "#{SecureRandom.uuid}.json" else layout_data_resource_name end @_mime_type = 'application/json' @_type = ResourceType::LAYOUT_DATA @resource_name = @layout_data_resource_name end |
Instance Attribute Details
#layout_data_resource_name ⇒ Object
Gets or sets name of the layout data resource.
42 43 44 |
# File 'lib/ruby_client/LayoutDataResource.rb', line 42 def layout_data_resource_name @layout_data_resource_name end |
Instance Method Details
#_file_extension ⇒ Object
35 36 37 |
# File 'lib/ruby_client/LayoutDataResource.rb', line 35 def _file_extension '.json' end |
#to_json(_options = {}) ⇒ Object
44 45 46 |
# File 'lib/ruby_client/LayoutDataResource.rb', line 44 def to_json( = {}) JSON.pretty_generate({}) end |