cloudrunpdf 0.1.0 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c8765a2e71265ad504fe4ebb22f24c8d89a657713a14be7cec9a30086f484ec
4
- data.tar.gz: 2ca2e90a46caebcd28c101ec0bdb73071414db6e2701721dee83685b23c8d955
3
+ metadata.gz: fd42ad0d28f30d92c080b40612bacd0f31fb1bc1148845c62cb425596c1fcb6e
4
+ data.tar.gz: f13744dd16439f8bdf96bc77b878f6b97972f7f26307a775419cb5ba7845cfb9
5
5
  SHA512:
6
- metadata.gz: ceea27573623960a24d8f8260cbd2fd29c7e0c6c096295543255c6a9dbe3be414ee89be428526df38946f13445e7463e0f60c92f97c9494f404b475c2ed0e749
7
- data.tar.gz: a29114a6573c3d62c1f43b326f6223a5caacf00f03803db3c759110047b21ab528ed8b21a4f5d755a3759546739fedf097d82c06449c3995048e445df50c84eb
6
+ metadata.gz: 948aa4bcc5e24b531dc2d4708411d1c2bf0a67fd51466b063e53e89ef88d11053d721e9d407ec0c72d451e127b382ddd6beb40fc8dad33c03a2db8578a6e77df
7
+ data.tar.gz: 8bef79deec940fb9b359c6b25be2d0ae8ea44e13aaecc9a399f77765bb6af244aa8f7e0db5ea0f253f11c4675b1bd257c2106353a4e862854b1d518b8cf1201b
@@ -5,14 +5,14 @@ require 'combine_pdf'
5
5
  module Cloudrunpdf
6
6
  class Builder
7
7
  def initialize
8
- @token = retrieve_authentication_token
9
8
  @configuration = Cloudrunpdf.configuration
9
+ @token = retrieve_authentication_token
10
10
  end
11
11
 
12
12
  def print(data)
13
13
  threads = []
14
14
 
15
- data.map.each do |entry|
15
+ Array.wrap(data).each do |entry|
16
16
  threads.append(
17
17
  Thread.new { Thread.current[:pdf] = generate_pdf(entry) }
18
18
  )
@@ -38,12 +38,13 @@ module Cloudrunpdf
38
38
  private
39
39
 
40
40
  def retrieve_authentication_token
41
- if Rails.env.in?(['development', 'test'])
41
+ if ENV['GCLOUD_AUTH_TOKEN'].present?
42
+ @token ||= ENV['GCLOUD_AUTH_TOKEN']
43
+ elsif Rails.env.in?(['development', 'test'])
42
44
  @token ||= `gcloud auth print-identity-token`.strip
43
45
  else
44
46
  @token ||= Faraday.get(
45
- @configuration.token_base_url +
46
- "/identity?audience=#{PdfService::FUNCTION}&format=full",
47
+ "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity?audience=#{@configuration.cloud_function_url}&format=full",
47
48
  {},
48
49
  { metadata_flavor: 'Google' }
49
50
  ).body
@@ -3,11 +3,10 @@
3
3
  module Cloudrunpdf
4
4
  # Configuration options for gem
5
5
  class Configuration
6
- attr_accessor :cloud_function_url, :token_base_url
6
+ attr_accessor :cloud_function_url
7
7
 
8
8
  def initialize
9
- @cloud_function_url = 'https://neo-htmlpdf-7zhay37huq-ew.a.run.app'
10
- @token_base_url = "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default"
9
+ @cloud_function_url = 'https://htmlpdf-newer-7zhay37huq-ew.a.run.app'.freeze
11
10
  end
12
11
  end
13
12
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cloudrunpdf
4
- VERSION = "0.1.0"
4
+ VERSION = '0.1.3'
5
5
  end
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.0
4
+ version: 0.1.3
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: 2022-06-10 00:00:00.000000000 Z
12
+ date: 2022-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: combine_pdf