cloudrunpdf 0.1.3 → 0.1.5
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/lib/cloudrunpdf/builder.rb +11 -7
- data/lib/cloudrunpdf/configuration.rb +14 -2
- data/lib/cloudrunpdf/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4dbe3b8044f5a3f789f04626bc507e1499e192c8ba8691791f57da94c33423b
|
4
|
+
data.tar.gz: 623e07fd2ed29a55219a81f7eefe5e48dfc22afcc2f8efd6cca301e2f81aea26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a8aad4483175c887cef1ad4ebe2eddfdcb9d37be1479303d17c22e602c8795677165d29d4d36ad267ef3943405484fb3cd3095982dec4f1521df01db5e57674
|
7
|
+
data.tar.gz: 30a352ec5b9656bce40559bd7e664b433e80df28550643d1ef8ca549c5a4b9bd1dbb264462887f68604ec729e20d5f8f2300a9d598f646df9fc6258ccdf08490
|
data/lib/cloudrunpdf/builder.rb
CHANGED
@@ -26,18 +26,22 @@ module Cloudrunpdf
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def generate_pdf(data)
|
29
|
-
Faraday.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
conn = Faraday.new
|
30
|
+
headers = { 'Content-Type' => 'application/json' }
|
31
|
+
headers['Authorization'] = 'Bearer ' + @token if @configuration.google?
|
32
|
+
|
33
|
+
conn.post(@configuration.cloud_function_url) do |req|
|
34
|
+
req.body = data.to_json
|
35
|
+
req.headers = headers
|
36
|
+
end
|
36
37
|
end
|
37
38
|
|
38
39
|
private
|
39
40
|
|
40
41
|
def retrieve_authentication_token
|
42
|
+
# We only auth to cloudrun
|
43
|
+
return unless @configuration.google?
|
44
|
+
|
41
45
|
if ENV['GCLOUD_AUTH_TOKEN'].present?
|
42
46
|
@token ||= ENV['GCLOUD_AUTH_TOKEN']
|
43
47
|
elsif Rails.env.in?(['development', 'test'])
|
@@ -3,10 +3,22 @@
|
|
3
3
|
module Cloudrunpdf
|
4
4
|
# Configuration options for gem
|
5
5
|
class Configuration
|
6
|
-
attr_accessor :cloud_function_url
|
6
|
+
attr_accessor :cloud_function_url, :auth
|
7
|
+
|
8
|
+
AUTHS = [
|
9
|
+
:google,
|
10
|
+
:aliyun
|
11
|
+
].freeze
|
7
12
|
|
8
13
|
def initialize
|
9
|
-
@cloud_function_url = 'https://
|
14
|
+
@cloud_function_url = 'https://cloudpdf-7zhay37huq-ew.a.run.app'.freeze
|
15
|
+
@auth = :google
|
16
|
+
end
|
17
|
+
|
18
|
+
AUTHS.each do |auth|
|
19
|
+
define_method "#{auth}?" do
|
20
|
+
@auth == auth
|
21
|
+
end
|
10
22
|
end
|
11
23
|
end
|
12
24
|
end
|
data/lib/cloudrunpdf/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudrunpdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bas Schoenmakers
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-04-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: combine_pdf
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: faraday
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
28
42
|
description:
|
29
43
|
email:
|
30
44
|
- bas.schoenmakers@remarkgroup.com
|
@@ -66,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
80
|
- !ruby/object:Gem::Version
|
67
81
|
version: '0'
|
68
82
|
requirements: []
|
69
|
-
rubygems_version: 3.
|
83
|
+
rubygems_version: 3.3.7
|
70
84
|
signing_key:
|
71
85
|
specification_version: 4
|
72
86
|
summary: Generate PDF with Google Cloud Function.
|