gcs-signer 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gcs_signer.rb +5 -6
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fcc753e1262301f1f25d2bc0637ad2c03fbe0da7
4
- data.tar.gz: f8bf159daf4ac001b8999e563cb87f09c6e44b74
3
+ metadata.gz: 987f3aadc106b9ecf39f92c61722587746a2793b
4
+ data.tar.gz: 00ce402d313a94af0090c0a0f32fb17ab83d2ec1
5
5
  SHA512:
6
- metadata.gz: 8dce4c13fe146f462926ab4c8b124f756a5a5b9fa525b7e38ee4c2502990d80bd030e49f42d6b9838199b054cf7deb4acb48cb465bc6342ef045d9995c3a0579
7
- data.tar.gz: 8b563b219fdd62a91775b6c4ed2f85b138c433dcffad7f6db3ade618622fe967e06abbf6e1be3646cf1acb9e53e190e166a319dae22242c543dc6505a718958d
6
+ metadata.gz: 185e0bfed9f2fe6b25cf205e54e50893d44fe24cd2be6d6ac31d7e5022fd207d10fd1af8f66c748f62e6608bc3c19ab47eb3276e96d1dce6cc5a34c36ad8d89b
7
+ data.tar.gz: 29cb30b52c1d738ba9cf6c0ffc3b5cb75733372190ebdba454b5fefc61089a89636d0670633a454f911bd7c4d66124e7599caeda632f0dbdd9f4fc674c93935c
data/lib/gcs_signer.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
-
3
2
  require "uri"
4
3
  require "openssl"
5
4
  require "base64"
@@ -11,16 +10,16 @@ require "json"
11
10
  # signer.sign "your-bucket", "object/name"
12
11
  # # => "https://storage.googleapis.com/your-bucket/object/name?..."
13
12
  class GcsSigner
14
- VERSION = "0.2.2"
13
+ VERSION = "0.3.0"
15
14
 
16
15
  # gcs-signer requires credential that can access to GCS.
17
16
  # [path] the path of the service_account json file.
18
17
  # [json_string] ...or the content of the service_account json file.
19
- # [gcs_host] Custom GCS host when signing a url.
18
+ # [gcs_url] Custom GCS url when signing a url.
20
19
  #
21
20
  # or if you also use \+google-cloud+ gem. you can authenticate
22
21
  # using environment variable that uses.
23
- def initialize(path: nil, json_string: nil, gcs_host: nil)
22
+ def initialize(path: nil, json_string: nil, gcs_url: nil)
24
23
  json_string ||= File.read(path) unless path.nil?
25
24
  json_string = look_for_environment_variables if json_string.nil?
26
25
 
@@ -28,7 +27,7 @@ class GcsSigner
28
27
  @credentials = JSON.parse(json_string)
29
28
  @key = OpenSSL::PKey::RSA.new(@credentials["private_key"])
30
29
 
31
- @gcs_host = gcs_host || "https://storage.googleapis.com"
30
+ @gcs_url = gcs_url || "https://storage.googleapis.com"
32
31
  end
33
32
 
34
33
  # @return [String] Signed url
@@ -66,7 +65,7 @@ class GcsSigner
66
65
  options = apply_default_options(options)
67
66
 
68
67
  url = URI.join(
69
- @gcs_host,
68
+ @gcs_url,
70
69
  URI.escape("/#{bucket}/"), URI.escape(object_name)
71
70
  )
72
71
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gcs-signer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sangwon Yi
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-30 00:00:00.000000000 Z
12
+ date: 2017-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 0.49.1
48
+ version: 0.40.0
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 0.49.1
55
+ version: 0.40.0
56
56
  description: |2
57
57
  Simple signed URL generator for Google Cloud Storage.
58
58
  No additional gems and API requests required to generate signed URL.