htmlcsstoimage-api 0.1.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -3
  3. data/.ruby-version +1 -1
  4. data/Gemfile.lock +42 -35
  5. data/README.md +183 -11
  6. data/htmlcsstoimage.gemspec +4 -2
  7. data/lib/htmlcsstoimage/client.rb +36 -0
  8. data/lib/htmlcsstoimage/images.rb +173 -0
  9. data/lib/htmlcsstoimage/signed_urls.rb +130 -0
  10. data/lib/htmlcsstoimage/templates.rb +99 -0
  11. data/lib/htmlcsstoimage/version.rb +2 -1
  12. data/lib/htmlcsstoimage.rb +8 -151
  13. metadata +24 -30
  14. data/cassettes/HTMLCSSToImage/_create_image/accepts_additional_params.yml +0 -66
  15. data/cassettes/HTMLCSSToImage/_create_image/creates_an_image.yml +0 -64
  16. data/cassettes/HTMLCSSToImage/_create_template/creates_a_new_template.yml +0 -62
  17. data/cassettes/HTMLCSSToImage/_delete_image/deletes_an_image.yml +0 -60
  18. data/cassettes/HTMLCSSToImage/_templates/retrieves_templates.yml +0 -110
  19. data/cassettes/HTMLCSSToImage/_url_to_image/accepts_additional_params.yml +0 -64
  20. data/cassettes/HTMLCSSToImage/_url_to_image/creates_an_image_from_a_url.yml +0 -64
  21. data/docs/HTMLCSSToImage/ApiResponse.html +0 -124
  22. data/docs/HTMLCSSToImage.html +0 -1340
  23. data/docs/_config.yml +0 -1
  24. data/docs/_index.html +0 -122
  25. data/docs/class_list.html +0 -51
  26. data/docs/css/common.css +0 -1
  27. data/docs/css/full_list.css +0 -58
  28. data/docs/css/style.css +0 -496
  29. data/docs/file.README.html +0 -187
  30. data/docs/file_list.html +0 -56
  31. data/docs/frames.html +0 -17
  32. data/docs/index.html +0 -187
  33. data/docs/js/app.js +0 -314
  34. data/docs/js/full_list.js +0 -216
  35. data/docs/js/jquery.js +0 -4
  36. data/docs/method_list.html +0 -107
  37. data/docs/top-level-namespace.html +0 -110
@@ -0,0 +1,130 @@
1
+ class HTMLCSSToImage
2
+ # Generates a signed URL for rendering an image from a saved template.
3
+ #
4
+ # This method makes no network requests. Hashes and arrays in
5
+ # `template_values` are encoded as JSON before the query string is signed.
6
+ #
7
+ # @see https://docs.htmlcsstoimage.com/getting-started/create-and-render/
8
+ #
9
+ # @param template_id [String] the saved template ID
10
+ # @param template_values [Hash] values to substitute into the template
11
+ # @param template_version [Integer, nil] a specific template version, or the latest when omitted
12
+ # @param format [String, nil] output format appended to the signed URL path: `png`, `jpg`, `webp`, or `pdf`
13
+ # @param keyword_values [Hash] template values passed as Ruby keyword arguments
14
+ # @return [HTMLCSSToImage::ApiResponse] signed URL available at `.url`
15
+ def generate_templated_image_url(
16
+ template_id,
17
+ template_values = {},
18
+ template_version: nil,
19
+ format: nil,
20
+ **keyword_values
21
+ )
22
+ template_values = template_values.merge(keyword_values)
23
+ pairs = []
24
+ pairs << ["template_version", template_version.to_s] unless template_version.nil?
25
+
26
+ template_values.sort_by { |key, _value| key.to_s }.each do |key, value|
27
+ next if value.nil?
28
+
29
+ pairs << [key.to_s, signed_value(value)]
30
+ end
31
+
32
+ query = Addressable::URI.form_encode(pairs)
33
+ token = generate_hmac_token(query)
34
+ separator = query.empty? ? "" : "?"
35
+ format_path = format.nil? ? "" : "/#{format}"
36
+
37
+ ApiResponse.new(
38
+ url: "https://hcti.io/v1/image/#{template_id}/#{token}#{format_path}#{separator}#{query}"
39
+ )
40
+ end
41
+
42
+ # Compatibility proxy for {#generate_templated_image_url}.
43
+ #
44
+ # The third positional hash was accepted by previous versions but was not
45
+ # used. Its `template_version` value is now honored when present.
46
+ #
47
+ # @deprecated Use {#generate_templated_image_url} instead.
48
+ # @param template_id [String] the saved template ID
49
+ # @param template_values [Hash] values to substitute into the template
50
+ # @param params [Hash] legacy options; only `template_version` is used
51
+ # @param template_version [Integer, nil] a specific template version
52
+ # @param format [String, nil] output format appended to the signed URL path: `png`, `jpg`, `webp`, or `pdf`
53
+ # @param keyword_values [Hash] template values passed as Ruby keyword arguments
54
+ # @return [HTMLCSSToImage::ApiResponse] signed URL available at `.url`
55
+ def create_image_from_template(
56
+ template_id,
57
+ template_values = {},
58
+ params = {},
59
+ template_version: nil,
60
+ format: nil,
61
+ **keyword_values
62
+ )
63
+ params ||= {}
64
+ template_values = template_values.merge(keyword_values)
65
+ legacy_version =
66
+ if params.is_a?(Hash)
67
+ params[:template_version] || params["template_version"]
68
+ end
69
+
70
+ options = { template_version: template_version || legacy_version }
71
+ options[:format] = format unless format.nil?
72
+
73
+ generate_templated_image_url(template_id, template_values, **options)
74
+ end
75
+
76
+ # Generates a signed create-and-render URL for a URL screenshot.
77
+ #
78
+ # This method makes no network requests. PDF options are omitted because the
79
+ # create-and-render endpoint does not support them. `dedupe_duration_s` is
80
+ # omitted because deduplication applies only to standard POST requests. False
81
+ # boolean values are omitted except for `transparent_background`, where both
82
+ # values are meaningful.
83
+ #
84
+ # @see https://docs.htmlcsstoimage.com/getting-started/create-and-render/
85
+ #
86
+ # @param url [String] the fully qualified URL to capture
87
+ # @param params [Hash] URL screenshot options; `format` may be `png`, `jpg`, `webp`, or `pdf` and is appended to the signed URL path instead of the query string
88
+ # @return [HTMLCSSToImage::ApiResponse] signed URL available at `.url`
89
+ def generate_create_and_render_url(url, params = {})
90
+ pairs = [["url", url.to_s]]
91
+ format = params[:format] || params["format"]
92
+
93
+ params
94
+ .reject do |key, _value|
95
+ %w[url format pdf_options dedupe_duration_s].include?(key.to_s)
96
+ end
97
+ .sort_by { |key, _value| key.to_s }
98
+ .each do |key, value|
99
+ next if value.nil?
100
+ next if value == false && key.to_s != "transparent_background"
101
+
102
+ case key.to_s
103
+ when "headers"
104
+ value.each { |name, header_value| pairs << ["headers", "#{name}:#{header_value}"] }
105
+ when "additional_header_origins"
106
+ value.each { |origin| pairs << ["additional_header_origins", origin.to_s] }
107
+ else
108
+ pairs << [key.to_s, signed_value(value)]
109
+ end
110
+ end
111
+
112
+ query = Addressable::URI.form_encode(pairs)
113
+ token = generate_hmac_token(query)
114
+ format_path = format.nil? ? "" : "/#{format}"
115
+
116
+ ApiResponse.new(
117
+ url: "https://hcti.io/v1/image/create-and-render/#{@auth[:username]}/#{token}#{format_path}?#{query}"
118
+ )
119
+ end
120
+
121
+ private
122
+
123
+ def generate_hmac_token(query)
124
+ OpenSSL::HMAC.hexdigest("sha256", @auth[:password], query)
125
+ end
126
+
127
+ def signed_value(value)
128
+ value.is_a?(Array) || value.is_a?(Hash) ? JSON.generate(value) : value.to_s
129
+ end
130
+ end
@@ -0,0 +1,99 @@
1
+ class HTMLCSSToImage
2
+ # Retrieves saved templates.
3
+ #
4
+ # @see https://docs.htmlcsstoimage.com/getting-started/templates/
5
+ #
6
+ # @param params [Hash] pagination options
7
+ # @option params [Integer] :count number of templates to return, up to 100
8
+ # @option params [Integer] :max_version pagination cursor returned by the previous request
9
+ # @return [HTMLCSSToImage::ApiResponse] paginated template response
10
+ def list_templates(params = {})
11
+ self.class.get(
12
+ "/v1/template",
13
+ basic_auth: @auth,
14
+ query: params
15
+ )
16
+ end
17
+
18
+ # Compatibility proxy for {#list_templates}.
19
+ #
20
+ # @param params [Hash] pagination options
21
+ # @return [HTMLCSSToImage::ApiResponse] paginated template response
22
+ def templates(params = {})
23
+ list_templates(params)
24
+ end
25
+
26
+ # Retrieves versions of a saved template.
27
+ #
28
+ # @see https://docs.htmlcsstoimage.com/getting-started/templates/
29
+ #
30
+ # @param template_id [String] the saved template ID
31
+ # @param params [Hash] pagination options
32
+ # @option params [Integer] :count number of versions to return, up to 100
33
+ # @option params [Integer] :max_version pagination cursor returned by the previous request
34
+ # @return [HTMLCSSToImage::ApiResponse] paginated template version response
35
+ def list_template_versions(template_id, params = {})
36
+ self.class.get(
37
+ "/v1/template/#{template_id}",
38
+ basic_auth: @auth,
39
+ query: params
40
+ )
41
+ end
42
+
43
+ # Creates an image template.
44
+ #
45
+ # @see https://docs.htmlcsstoimage.com/getting-started/templates/
46
+ #
47
+ # @param html [String] HTML for the template
48
+ # @param params [Hash] template and rendering options
49
+ # @option params [String] :name A short name to identify the template. Maximum length: 64.
50
+ # @option params [String] :description A description of the template. Maximum length: 1024.
51
+ # @option params [String] :css The CSS for the template.
52
+ # @option params [Numeric] :device_scale The pixel ratio for the screenshot. Minimum: `0.1`, Maximum: `3`.
53
+ # @option params [String] :google_fonts Google Fonts to load. Separate multiple fonts with `|`.
54
+ # @option params [Integer] :max_wait_ms The maximum time to wait before taking the screenshot. Minimum: `500`, Maximum: `10000`.
55
+ # @option params [Integer] :ms_delay Extra time in milliseconds to wait before taking the screenshot. Maximum: `10000`.
56
+ # @option params [Boolean] :render_when_ready Wait until `ScreenshotReady()` is called from JavaScript before taking the screenshot.
57
+ # @option params [Boolean] :max_render_once Ensure images created from the template are only rendered and saved once.
58
+ # @option params [String] :selector A CSS selector for the element to capture.
59
+ # @option params [Integer] :viewport_height The Chrome viewport height. Both viewport dimensions must be set if using either.
60
+ # @option params [Integer] :viewport_width The Chrome viewport width. Both viewport dimensions must be set if using either.
61
+ # @option params [Boolean] :disable_twemoji Disable the Twemoji fallback and use native emoji fonts.
62
+ # @option params [String] :color_scheme Render using the `light` or `dark` browser color scheme.
63
+ # @option params [String] :timezone The browser timezone as an IANA timezone identifier, such as `America/New_York`.
64
+ # @option params [Boolean] :viewport_mobile Whether to honor the page's mobile viewport behavior.
65
+ # @option params [Boolean] :viewport_landscape Whether to render the viewport in landscape mode.
66
+ # @option params [Boolean] :viewport_touch Whether the viewport supports touch events.
67
+ # @option params [String] :media_type Render using `print` or `screen` media.
68
+ # @option params [Integer] :jumbo_max_height Maximum output height in jumbo mode. Requires `jumbo_max_width`.
69
+ # @option params [Integer] :jumbo_max_width Maximum output width in jumbo mode. Requires `jumbo_max_height`.
70
+ # @option params [String] :proxy_id The ID of an organization proxy to use for the render.
71
+ # @option params [String] :storage_destination_id The ID of an organization storage destination inherited by images created from the template.
72
+ # @option params [Boolean] :transparent_background Whether images created from the template should use a transparent background.
73
+ # @return [HTMLCSSToImage::ApiResponse] created template details
74
+ def create_template(html, params = {})
75
+ create_template_at_path("/v1/template", html, params)
76
+ end
77
+
78
+ # Creates a new version of a saved template.
79
+ #
80
+ # Accepts the same options as {#create_template}.
81
+ #
82
+ # @see https://docs.htmlcsstoimage.com/getting-started/templates/
83
+ #
84
+ # @param template_id [String] the saved template ID
85
+ # @param html [String] HTML for the new template version
86
+ # @param params [Hash] template and rendering options
87
+ # @return [HTMLCSSToImage::ApiResponse] created template version details
88
+ def create_template_version(template_id, html, params = {})
89
+ create_template_at_path("/v1/template/#{template_id}", html, params)
90
+ end
91
+
92
+ private
93
+
94
+ def create_template_at_path(path, html, params)
95
+ body = { html: html }.merge(params).to_json
96
+
97
+ self.class.post(path, basic_auth: @auth, body: body)
98
+ end
99
+ end
@@ -1,3 +1,4 @@
1
1
  class HTMLCSSToImage
2
- VERSION = "0.1.3"
2
+ # Current version of the Ruby client gem.
3
+ VERSION = "0.3.0"
3
4
  end
@@ -1,154 +1,11 @@
1
1
  require "htmlcsstoimage/version"
2
+ require "json"
3
+ require "openssl"
2
4
  require "httparty"
3
- require "addressable"
5
+ require "addressable/uri"
6
+ require "ostruct"
4
7
 
5
- class HTMLCSSToImage
6
- include HTTParty
7
- base_uri 'https://hcti.io'
8
- headers 'Content-Type' => 'application/json'
9
- format :json
10
-
11
- SIGNED_URL_TEMPLATE = Addressable::Template.new("https://hcti.io/v1/image/{template_id}/{signed_token}{/format*}{?query*}")
12
-
13
- class ApiResponse < OpenStruct
14
- end
15
-
16
- parser(
17
- proc do |body, format|
18
- case format
19
- when :json
20
- JSON.parse(body, object_class: ApiResponse)
21
- else
22
- body
23
- end
24
- end
25
- )
26
-
27
- # Creates an instance of HTMLCSSToImage with API credentials.
28
- # If credentials are not provided, will try to use environment variables.
29
- # `HCTI_USER_ID` and `HCTI_API_KEY`.
30
- #
31
- # @see https://htmlcsstoimage.com/dashboard
32
- #
33
- # @param user_id [String] the user_id for the account.
34
- # @param api_key [String] the api_key for the account.
35
- # @return [HTMLCSSToImage] an instance of the api client.
36
- def initialize(user_id: ENV["HCTI_USER_ID"], api_key: ENV["HCTI_API_KEY"])
37
- @auth = { username: user_id, password: api_key }
38
- end
39
-
40
- # Converts HTML/CSS to an image with the API
41
- #
42
- # @see https://docs.htmlcsstoimage.com/getting-started/using-the-api
43
- #
44
- # @param html [String] This is the HTML you want to render. You can send an HTML snippet (`<div>Your content</div>`) or an entire webpage.
45
- #
46
- # @option params [String] :css The CSS for your image.
47
- # @option params [String] :google_fonts [Google fonts](https://docs.htmlcsstoimage.com/guides/using-google-fonts/) to be loaded. Example: `Roboto`. Multiple fonts can be loaded like this: `Roboto|Open Sans`
48
- # @option params [String] :selector A CSS selector for an element on the webpage. We'll crop the image to this specific element. For example: `section#complete-toolkit.container-lg`
49
- # @option params [Integer] :ms_delay The number of milliseconds the API should delay before generating the image. This is useful when waiting for JavaScript. We recommend starting with `500`. Large values slow down the initial render time.
50
- # @option params [Double] :device_scale This adjusts the pixel ratio for the screenshot. Minimum: `1`, Maximum: `3`.
51
- # @option params [Boolean] :render_when_ready Set to true to control when the image is generated. Call `ScreenshotReady()` from JavaScript to generate the image. [Learn more](https://docs.htmlcsstoimage.com/guides/render-when-ready/).
52
- # @option params [Integer] :viewport_width Set the width of Chrome's viewport. This will disable automatic cropping. Both height and width parameters must be set if using either.
53
- # @option params [Integer] :viewport_height Set the height of Chrome's viewport. This will disable automatic cropping. Both height and width parameters must be set if using either.
54
- #
55
- # @return [HTMLCSSToImage::ApiResponse] image URL available at `.url`.
56
- def create_image(html, params = {})
57
- body = { html: html }.merge(params).to_json
58
- options = { basic_auth: @auth, body: body, query: { includeId: true } }
59
-
60
- self.class.post("/v1/image", options)
61
- end
62
-
63
- # Deletes an image
64
- #
65
- # @see https://docs.htmlcsstoimage.com/getting-started/using-the-api
66
- #
67
- # @param image_id [String] The ID for the image you would like to delete
68
- def delete_image(image_id)
69
- response = self.class.delete("/v1/image/#{image_id}", basic_auth: @auth)
70
-
71
- return true if response.success?
72
-
73
- response
74
- end
75
-
76
- # Creates a signed URL for generating an image from a template
77
- # This URL contains the template_values in it. It is signed with HMAC so that it cannot be changed
78
- # by anyone without the API Key.
79
- #
80
- # Does not make any network requests.
81
- #
82
- # @see https://docs.htmlcsstoimage.com/getting-started/using-the-api
83
- #
84
- # @param template_id [String] The ID for the template
85
- # @param template_values [Hash] A hash containing the values to replace in the template
86
- def create_image_from_template(template_id, template_values = {}, params = {})
87
- template = SIGNED_URL_TEMPLATE.partial_expand({
88
- template_id: template_id,
89
- query: template_values
90
- })
91
-
92
- query = Addressable::URI.parse(template.expand(signed_token: nil).to_s).query
93
- digest = OpenSSL::Digest.new('sha256')
94
- signed_token = OpenSSL::HMAC.hexdigest(digest, @auth[:password], CGI.unescape(query))
95
-
96
- url = template.expand({
97
- signed_token: signed_token
98
- }).to_s
99
-
100
- ApiResponse.new(url: url)
101
- end
102
-
103
- # Generate a screenshot of a URL
104
- #
105
- # @see https://docs.htmlcsstoimage.com/getting-started/url-to-image/
106
- #
107
- # @param url [String] The fully qualified URL to a public webpage. Such as https://htmlcsstoimage.com.
108
- # @option params [String] :css The CSS for your image. Gets injected into the webpage.
109
- # @option params [String] :selector A CSS selector for an element on the webpage. We'll crop the image to this specific element. For example: `section#complete-toolkit.container-lg`
110
- # @option params [Integer] :ms_delay The number of milliseconds the API should delay before generating the image. This is useful when waiting for JavaScript. We recommend starting with `500`. Large values slow down the initial render time.
111
- # @option params [Double] :device_scale This adjusts the pixel ratio for the screenshot. Minimum: `1`, Maximum: `3`.
112
- # @option params [Boolean] :render_when_ready Set to true to control when the image is generated. Call `ScreenshotReady()` from JavaScript to generate the image. [Learn more](https://docs.htmlcsstoimage.com/guides/render-when-ready/).
113
- # @option params [Integer] :viewport_width Set the width of Chrome's viewport. This will disable automatic cropping. Both height and width parameters must be set if using either.
114
- # @option params [Integer] :viewport_height Set the height of Chrome's viewport. This will disable automatic cropping. Both height and width parameters must be set if using either.
115
- def url_to_image(url, params = {})
116
- body = { url: url }.merge(params).to_json
117
- options = { basic_auth: @auth, body: body, query: { includeId: true } }
118
-
119
- self.class.post("/v1/image", options)
120
- end
121
-
122
- # Retrieves all available templates
123
- #
124
- # @see https://docs.htmlcsstoimage.com/getting-started/templates/
125
- def templates(params = {})
126
- options = params.merge({ basic_auth: @auth })
127
- self.class.get("/v1/template", options)
128
- end
129
-
130
- # Creates an image template
131
- #
132
- # @see https://docs.htmlcsstoimage.com/getting-started/templates/
133
- #
134
- # @param html [String] This is the HTML you want to render. You can send an HTML snippet (`<div>Your content</div>`) or an entire webpage.
135
- #
136
- # @option params [String] :name A short name to identify your template max length 64
137
- # @option params [String] :description Description to elaborate on the use of your template max length 1024
138
- # @option params [String] :css The CSS for your image.
139
- # @option params [String] :google_fonts [Google fonts](https://docs.htmlcsstoimage.com/guides/using-google-fonts/) to be loaded. Example: `Roboto`. Multiple fonts can be loaded like this: `Roboto|Open Sans`
140
- # @option params [String] :selector A CSS selector for an element on the webpage. We'll crop the image to this specific element. For example: `section#complete-toolkit.container-lg`
141
- # @option params [Integer] :ms_delay The number of milliseconds the API should delay before generating the image. This is useful when waiting for JavaScript. We recommend starting with `500`. Large values slow down the initial render time.
142
- # @option params [Double] :device_scale This adjusts the pixel ratio for the screenshot. Minimum: `1`, Maximum: `3`.
143
- # @option params [Boolean] :render_when_ready Set to true to control when the image is generated. Call `ScreenshotReady()` from JavaScript to generate the image. [Learn more](https://docs.htmlcsstoimage.com/guides/render-when-ready/).
144
- # @option params [Integer] :viewport_width Set the width of Chrome's viewport. This will disable automatic cropping. Both height and width parameters must be set if using either.
145
- # @option params [Integer] :viewport_height Set the height of Chrome's viewport. This will disable automatic cropping. Both height and width parameters must be set if using either.
146
- #
147
- # @return [HTMLCSSToImage::ApiResponse] image URL available at `.url`.
148
- def create_template(html, params = {})
149
- body = { html: html }.merge(params).to_json
150
- options = { basic_auth: @auth, body: body }
151
-
152
- self.class.post("/v1/template", options)
153
- end
154
- end
8
+ require "htmlcsstoimage/client"
9
+ require "htmlcsstoimage/images"
10
+ require "htmlcsstoimage/signed_urls"
11
+ require "htmlcsstoimage/templates"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htmlcsstoimage-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Coutermarsh
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-12-19 00:00:00.000000000 Z
12
+ date: 2026-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -137,8 +137,22 @@ dependencies:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
- description: 'Ruby client for the HTML/CSS to Image API. Generate a png, jpg or webp
141
- images with Ruby. Renders exactly like Google Chrome. '
140
+ - !ruby/object:Gem::Dependency
141
+ name: yard
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '0.9'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '0.9'
154
+ description: 'Ruby client for the HTML/CSS to Image API. Generate PNG, JPG, WebP,
155
+ or PDF files with Ruby. Renders exactly like Google Chrome. '
142
156
  email:
143
157
  - support@htmlcsstoimage.com
144
158
  executables: []
@@ -158,32 +172,12 @@ files:
158
172
  - Rakefile
159
173
  - bin/console
160
174
  - bin/setup
161
- - cassettes/HTMLCSSToImage/_create_image/accepts_additional_params.yml
162
- - cassettes/HTMLCSSToImage/_create_image/creates_an_image.yml
163
- - cassettes/HTMLCSSToImage/_create_template/creates_a_new_template.yml
164
- - cassettes/HTMLCSSToImage/_delete_image/deletes_an_image.yml
165
- - cassettes/HTMLCSSToImage/_templates/retrieves_templates.yml
166
- - cassettes/HTMLCSSToImage/_url_to_image/accepts_additional_params.yml
167
- - cassettes/HTMLCSSToImage/_url_to_image/creates_an_image_from_a_url.yml
168
- - docs/HTMLCSSToImage.html
169
- - docs/HTMLCSSToImage/ApiResponse.html
170
- - docs/_config.yml
171
- - docs/_index.html
172
- - docs/class_list.html
173
- - docs/css/common.css
174
- - docs/css/full_list.css
175
- - docs/css/style.css
176
- - docs/file.README.html
177
- - docs/file_list.html
178
- - docs/frames.html
179
- - docs/index.html
180
- - docs/js/app.js
181
- - docs/js/full_list.js
182
- - docs/js/jquery.js
183
- - docs/method_list.html
184
- - docs/top-level-namespace.html
185
175
  - htmlcsstoimage.gemspec
186
176
  - lib/htmlcsstoimage.rb
177
+ - lib/htmlcsstoimage/client.rb
178
+ - lib/htmlcsstoimage/images.rb
179
+ - lib/htmlcsstoimage/signed_urls.rb
180
+ - lib/htmlcsstoimage/templates.rb
187
181
  - lib/htmlcsstoimage/version.rb
188
182
  homepage: https://docs.htmlcsstoimage.com/example-code/ruby
189
183
  licenses:
@@ -197,14 +191,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
191
  requirements:
198
192
  - - ">="
199
193
  - !ruby/object:Gem::Version
200
- version: '0'
194
+ version: 2.7.0
201
195
  required_rubygems_version: !ruby/object:Gem::Requirement
202
196
  requirements:
203
197
  - - ">="
204
198
  - !ruby/object:Gem::Version
205
199
  version: '0'
206
200
  requirements: []
207
- rubygems_version: 3.3.26
201
+ rubygems_version: 3.5.16
208
202
  signing_key:
209
203
  specification_version: 4
210
204
  summary: Ruby client for the HTML/CSS to Image API.
@@ -1,66 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://hcti.io/v1/image?includeId=true
6
- body:
7
- encoding: UTF-8
8
- string: '{"html":"<div>test</div>","css":"body { background-color: orange }","ms_delay":500,"google_fonts":"Roboto"}'
9
- headers:
10
- Content-Type:
11
- - application/json
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - "*/*"
16
- User-Agent:
17
- - Ruby
18
- Authorization:
19
- - Basic authentication-header
20
- response:
21
- status:
22
- code: 200
23
- message: OK
24
- headers:
25
- Date:
26
- - Fri, 07 Aug 2020 16:26:02 GMT
27
- Content-Type:
28
- - application/json; charset=utf-8
29
- Transfer-Encoding:
30
- - chunked
31
- Connection:
32
- - keep-alive
33
- Set-Cookie:
34
- - __cfduid=d2514bf66b55358e89144d7ce2e05ca431596817562; expires=Sun, 06-Sep-20
35
- 16:26:02 GMT; path=/; domain=.hcti.io; HttpOnly; SameSite=Lax
36
- Cf-Ray:
37
- - 5bf25b63d9e06d52-SJC
38
- Access-Control-Allow-Origin:
39
- - "*"
40
- Age:
41
- - '235'
42
- Cache-Control:
43
- - max-age=14400, 31536000
44
- Vary:
45
- - Accept-Encoding
46
- Cf-Cache-Status:
47
- - HIT
48
- Cf-Request-Id:
49
- - 046b57726600006d5284153200000001
50
- Expect-Ct:
51
- - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
52
- Request-Context:
53
- - appId=cid-v1:ef200074-f922-49b8-a889-360bb27d5561
54
- X-Is-Overage:
55
- - 'False'
56
- X-Renders-Allowed:
57
- - '500000'
58
- X-Renders-Used:
59
- - '4539'
60
- Server:
61
- - cloudflare
62
- body:
63
- encoding: ASCII-8BIT
64
- string: '{"url":"https://hcti.io/v1/image/254b444c-dd82-4cc1-94ef-aa4b3a6870a6","id":"254b444c-dd82-4cc1-94ef-aa4b3a6870a6"}'
65
- recorded_at: Fri, 07 Aug 2020 16:26:02 GMT
66
- recorded_with: VCR 6.0.0
@@ -1,64 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://hcti.io/v1/image?includeId=true
6
- body:
7
- encoding: UTF-8
8
- string: '{"html":"<div>test</div>"}'
9
- headers:
10
- Content-Type:
11
- - application/json
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - "*/*"
16
- User-Agent:
17
- - Ruby
18
- Authorization:
19
- - Basic authentication-header
20
- response:
21
- status:
22
- code: 200
23
- message: OK
24
- headers:
25
- Date:
26
- - Fri, 07 Aug 2020 16:26:01 GMT
27
- Content-Type:
28
- - application/json; charset=utf-8
29
- Transfer-Encoding:
30
- - chunked
31
- Connection:
32
- - keep-alive
33
- Set-Cookie:
34
- - __cfduid=d3a44d4dbf2273232e5acce7284a8582e1596817561; expires=Sun, 06-Sep-20
35
- 16:26:01 GMT; path=/; domain=.hcti.io; HttpOnly; SameSite=Lax
36
- Cf-Ray:
37
- - 5bf25b61183a93be-SJC
38
- Access-Control-Allow-Origin:
39
- - "*"
40
- Cache-Control:
41
- - max-age=public, 31536000
42
- Vary:
43
- - Accept-Encoding
44
- Cf-Cache-Status:
45
- - DYNAMIC
46
- Cf-Request-Id:
47
- - 046b5770aa000093be5f243200000001
48
- Expect-Ct:
49
- - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
50
- Request-Context:
51
- - appId=cid-v1:ef200074-f922-49b8-a889-360bb27d5561
52
- X-Is-Overage:
53
- - 'False'
54
- X-Renders-Allowed:
55
- - '500000'
56
- X-Renders-Used:
57
- - '4539'
58
- Server:
59
- - cloudflare
60
- body:
61
- encoding: ASCII-8BIT
62
- string: '{"url":"https://hcti.io/v1/image/b1021edd-0af3-4764-9a1c-6d9eae18985d","id":"b1021edd-0af3-4764-9a1c-6d9eae18985d"}'
63
- recorded_at: Fri, 07 Aug 2020 16:26:02 GMT
64
- recorded_with: VCR 6.0.0