htmlcsstoimage-api 0.1.2 → 0.1.4
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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -3
- data/.ruby-version +1 -1
- data/Gemfile.lock +41 -35
- data/README.md +4 -2
- data/lib/htmlcsstoimage/version.rb +1 -1
- data/lib/htmlcsstoimage.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c33bcd3c7a212ce188b7016c5910a5053f801005a2eb93d367b2cc2722a98aee
|
4
|
+
data.tar.gz: de1d090df2591e9c37b2a60b9331b83cb700c106e971782d2bce16345086e6cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaebdc8ab7326430a86bbca299376e94cf890ba4f7e4bceaf2b7aa7e4ef18d974ce3223defba69015dcccfaf78bc1ed2aa101069d626f36130d53b55f5633f83
|
7
|
+
data.tar.gz: 490e852085597ab9c65bf6c9a812853f3585a5c4c9ec0a26a0a816dba86d64e3db436249ff6bcf77d360c770828728685ca2d0a3392b8f6c3a8dade3ec092d1d
|
data/.github/workflows/ruby.yml
CHANGED
@@ -12,11 +12,9 @@ jobs:
|
|
12
12
|
runs-on: ubuntu-latest
|
13
13
|
|
14
14
|
steps:
|
15
|
-
- uses: actions/checkout@
|
15
|
+
- uses: actions/checkout@v4
|
16
16
|
- name: Set up Ruby
|
17
17
|
uses: ruby/setup-ruby@v1
|
18
|
-
with:
|
19
|
-
ruby-version: 2.6
|
20
18
|
- name: Install dependencies
|
21
19
|
run: bundle install
|
22
20
|
- name: Run tests
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.3.5
|
data/Gemfile.lock
CHANGED
@@ -1,53 +1,59 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
htmlcsstoimage-api (0.1.
|
4
|
+
htmlcsstoimage-api (0.1.3)
|
5
|
+
addressable (> 2.5.0)
|
5
6
|
httparty (> 0.10)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
|
-
addressable (2.7
|
11
|
-
public_suffix (>= 2.0.2, <
|
11
|
+
addressable (2.8.7)
|
12
|
+
public_suffix (>= 2.0.2, < 7.0)
|
13
|
+
base64 (0.2.0)
|
14
|
+
bigdecimal (3.1.8)
|
12
15
|
byebug (11.1.3)
|
13
16
|
coderay (1.1.3)
|
14
|
-
crack (0.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
crack (1.0.0)
|
18
|
+
bigdecimal
|
19
|
+
rexml
|
20
|
+
csv (3.3.0)
|
21
|
+
diff-lcs (1.5.1)
|
22
|
+
hashdiff (1.1.1)
|
23
|
+
httparty (0.22.0)
|
24
|
+
csv
|
25
|
+
mini_mime (>= 1.0.0)
|
20
26
|
multi_xml (>= 0.5.2)
|
21
|
-
method_source (1.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
pry (0.13.1)
|
27
|
+
method_source (1.1.0)
|
28
|
+
mini_mime (1.1.5)
|
29
|
+
multi_xml (0.7.1)
|
30
|
+
bigdecimal (~> 3.1)
|
31
|
+
pry (0.14.2)
|
27
32
|
coderay (~> 1.1)
|
28
33
|
method_source (~> 1.0)
|
29
|
-
pry-byebug (3.
|
34
|
+
pry-byebug (3.10.1)
|
30
35
|
byebug (~> 11.0)
|
31
|
-
pry (
|
32
|
-
public_suffix (
|
33
|
-
rake (13.
|
34
|
-
|
35
|
-
|
36
|
-
rspec-
|
37
|
-
rspec-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
pry (>= 0.13, < 0.15)
|
37
|
+
public_suffix (6.0.1)
|
38
|
+
rake (13.2.1)
|
39
|
+
rexml (3.3.9)
|
40
|
+
rspec (3.13.0)
|
41
|
+
rspec-core (~> 3.13.0)
|
42
|
+
rspec-expectations (~> 3.13.0)
|
43
|
+
rspec-mocks (~> 3.13.0)
|
44
|
+
rspec-core (3.13.2)
|
45
|
+
rspec-support (~> 3.13.0)
|
46
|
+
rspec-expectations (3.13.3)
|
41
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.
|
43
|
-
rspec-mocks (3.
|
48
|
+
rspec-support (~> 3.13.0)
|
49
|
+
rspec-mocks (3.13.2)
|
44
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-support (3.
|
47
|
-
|
48
|
-
|
49
|
-
webmock (3.
|
50
|
-
addressable (>= 2.
|
51
|
+
rspec-support (~> 3.13.0)
|
52
|
+
rspec-support (3.13.1)
|
53
|
+
vcr (6.3.1)
|
54
|
+
base64
|
55
|
+
webmock (3.24.0)
|
56
|
+
addressable (>= 2.8.0)
|
51
57
|
crack (>= 0.3.2)
|
52
58
|
hashdiff (>= 0.4.0, < 2.0.0)
|
53
59
|
|
@@ -65,4 +71,4 @@ DEPENDENCIES
|
|
65
71
|
webmock
|
66
72
|
|
67
73
|
BUNDLED WITH
|
68
|
-
2.
|
74
|
+
2.5.23
|
data/README.md
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
|
5
5
|
Ruby client for the [HTML/CSS to Image API](https://htmlcsstoimage.com).
|
6
6
|
|
7
|
-
Generate
|
7
|
+
Generate png, jpg or webp images with Ruby. Renders exactly like Google Chrome.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
11
|
Add this line to your application's Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'htmlcsstoimage-api'
|
14
|
+
gem 'htmlcsstoimage-api', require: 'htmlcsstoimage'
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
@@ -27,6 +27,7 @@ Or install it yourself as:
|
|
27
27
|
Create a new instance of the API client.
|
28
28
|
|
29
29
|
```ruby
|
30
|
+
require "htmlcsstoimage"
|
30
31
|
# Retrieve your user id and api key from https://htmlcsstoimage.com/dashboard
|
31
32
|
client = HTMLCSSToImage.new(user_id: "user-id", api_key: "api-key")
|
32
33
|
```
|
@@ -36,6 +37,7 @@ client = HTMLCSSToImage.new(user_id: "user-id", api_key: "api-key")
|
|
36
37
|
Alternatively, you can set `ENV["HCTI_USER_ID"]` and `ENV["HCTI_API_KEY"]`. These will be loaded automatically.
|
37
38
|
|
38
39
|
```ruby
|
40
|
+
require "htmlcsstoimage"
|
39
41
|
client = HTMLCSSToImage.new
|
40
42
|
```
|
41
43
|
|
data/lib/htmlcsstoimage.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "htmlcsstoimage/version"
|
2
2
|
require "httparty"
|
3
3
|
require "addressable"
|
4
|
+
require "ostruct"
|
4
5
|
|
5
6
|
class HTMLCSSToImage
|
6
7
|
include HTTParty
|
@@ -89,7 +90,7 @@ class HTMLCSSToImage
|
|
89
90
|
query: template_values
|
90
91
|
})
|
91
92
|
|
92
|
-
query = Addressable::URI.parse(template.
|
93
|
+
query = Addressable::URI.parse(template.expand(signed_token: nil).to_s).query
|
93
94
|
digest = OpenSSL::Digest.new('sha256')
|
94
95
|
signed_token = OpenSSL::HMAC.hexdigest(digest, @auth[:password], CGI.unescape(query))
|
95
96
|
|
@@ -105,6 +106,7 @@ class HTMLCSSToImage
|
|
105
106
|
# @see https://docs.htmlcsstoimage.com/getting-started/url-to-image/
|
106
107
|
#
|
107
108
|
# @param url [String] The fully qualified URL to a public webpage. Such as https://htmlcsstoimage.com.
|
109
|
+
# @option params [String] :css The CSS for your image. Gets injected into the webpage.
|
108
110
|
# @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`
|
109
111
|
# @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.
|
110
112
|
# @option params [Double] :device_scale This adjusts the pixel ratio for the screenshot. Minimum: `1`, Maximum: `3`.
|
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.
|
4
|
+
version: 0.1.4
|
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:
|
12
|
+
date: 2024-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
204
|
- !ruby/object:Gem::Version
|
205
205
|
version: '0'
|
206
206
|
requirements: []
|
207
|
-
rubygems_version: 3.
|
207
|
+
rubygems_version: 3.5.16
|
208
208
|
signing_key:
|
209
209
|
specification_version: 4
|
210
210
|
summary: Ruby client for the HTML/CSS to Image API.
|