Class: DynamicPDFApi::HtmlResource
- Defined in:
- lib/ruby_client/HtmlResource.rb
Overview
Represents a pdf resource.
Instance Attribute Summary
Attributes inherited from Resource
#_file_path, #_mime_type, #data, #resource_name
Instance Method Summary collapse
-
#initialize(html, resourceName = nil) ⇒ HtmlResource
constructor
Initializes a new instance of the HtmlResource class.
- #to_json(_options = {}) ⇒ Object
Methods inherited from Resource
#_file_extension, _get_file_data
Constructor Details
#initialize(html, resourceName = nil) ⇒ HtmlResource
Initializes a new instance of the HtmlResource class.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ruby_client/HtmlResource.rb', line 12 def initialize(html, resourceName = nil) @_file_extension = ".html" @_mime_type = "text/html" @data = html @resource_name = if resource_name.nil? SecureRandom.uuid + @_file_extension else resource_name end _type = ResourceType::HTML end |
Instance Method Details
#to_json(_options = {}) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/ruby_client/HtmlResource.rb', line 26 def to_json( = {}) json_array = {} json_array["type"] = "html" json_array["resourceName"] = @resource_name JSON.pretty_generate(json_array) end |