google-cloud-storage 1.7.1 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2de136120911e5c72a76a2ffa060403a99d96f90
4
- data.tar.gz: 6971158f443390b81e15a280a4509bcdee543909
2
+ SHA256:
3
+ metadata.gz: 2561a9dd9f138630b772a0f6ba3dcbe292892761a3dad92f5b5cab785625b11c
4
+ data.tar.gz: 5c6ff780bf83212017dd7b82d655925af91fff9653ebb8c8585222790f5501d4
5
5
  SHA512:
6
- metadata.gz: 3ecd9ade1eb8173d73c80b58b84ddb2f51529225e7b9ef457ac53f036533346f98a2e15b254682247bfc9ddd73801bd007b38f82b9f61c923e45a70a95ed5fbc
7
- data.tar.gz: 3f2e892024bbe6a67124051567ea73e1546dcb69a8750bac1282f5fee472b48e6b2ca90226c5cdafeebd5efa6bb5e1b2cf22fed9c9c71372984e936bd2cda628
6
+ metadata.gz: 5d2d95049bf9257957b7c2f5406015caa9e3411af768d79004c133ca25d2907a0e6cb008eb0d935b088818789ec77d91739aac89037e93dfec3de164764700a3
7
+ data.tar.gz: f3b3c0bc9422b651d378f361f274d1a4a5354dbe4dc862fb02199c5de40071079f2920a984d9bccd5081abfd2836aed5652aa86af97dd58329b724a6b1e54aee
data/README.md CHANGED
@@ -24,8 +24,8 @@ Instructions and configuration options are covered in the [Authentication Guide]
24
24
  require "google/cloud/storage"
25
25
 
26
26
  storage = Google::Cloud::Storage.new(
27
- project: "my-todo-project",
28
- keyfile: "/path/to/keyfile.json"
27
+ project_id: "my-project",
28
+ credentials: "/path/to/keyfile.json"
29
29
  )
30
30
 
31
31
  bucket = storage.bucket "task-attachments"
@@ -13,9 +13,9 @@
13
13
  # limitations under the License.
14
14
 
15
15
  ##
16
- # This file is here to be autorequired by bundler, so that the .bigquery and
17
- # #bigquery methods can be available, but the library and all dependencies won't
18
- # be loaded until required and used.
16
+ # This file is here to be autorequired by bundler, so that the
17
+ # Google::Cloud.storage and Google::Cloud#storage methods can be available, but
18
+ # the library and all dependencies won't be loaded until required and used.
19
19
 
20
20
 
21
21
  gem "google-cloud-core"
@@ -75,10 +75,12 @@ module Google
75
75
  # For more information on connecting to Google Cloud see the [Authentication
76
76
  # Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
77
77
  #
78
- # @param [String] project Project identifier for the Storage service you are
79
- # connecting to.
80
- # @param [String, Hash] keyfile Keyfile downloaded from Google Cloud. If
81
- # file path the file must be readable.
78
+ # @param [String] project_id Project identifier for the Storage service
79
+ # you are connecting to. If not present, the default project for the
80
+ # credentials is used.
81
+ # @param [String, Hash, Google::Auth::Credentials] credentials The path to
82
+ # the keyfile as a String, the contents of the keyfile as a Hash, or a
83
+ # Google::Auth::Credentials object. (See {Storage::Credentials})
82
84
  # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
83
85
  # set of resources and operations that the connection can access. See
84
86
  # [Using OAuth 2.0 to Access Google
@@ -96,16 +98,17 @@ module Google
96
98
  # @example
97
99
  # require "google/cloud/storage"
98
100
  #
99
- # storage = Google::Cloud.storage "my-todo-project",
101
+ # storage = Google::Cloud.storage "my-project",
100
102
  # "/path/to/keyfile.json"
101
103
  #
102
104
  # bucket = storage.bucket "my-bucket"
103
105
  # file = bucket.file "path/to/my-file.ext"
104
106
  #
105
- def self.storage project = nil, keyfile = nil, scope: nil, retries: nil,
106
- timeout: nil
107
+ def self.storage project_id = nil, credentials = nil, scope: nil,
108
+ retries: nil, timeout: nil
107
109
  require "google/cloud/storage"
108
- Google::Cloud::Storage.new project: project, keyfile: keyfile,
110
+ Google::Cloud::Storage.new project_id: project_id,
111
+ credentials: credentials,
109
112
  scope: scope, retries: retries,
110
113
  timeout: timeout
111
114
  end
@@ -37,8 +37,8 @@ module Google
37
37
  # require "google/cloud/storage"
38
38
  #
39
39
  # storage = Google::Cloud::Storage.new(
40
- # project: "my-todo-project",
41
- # keyfile: "/path/to/keyfile.json"
40
+ # project_id: "my-project",
41
+ # credentials: "/path/to/keyfile.json"
42
42
  # )
43
43
  #
44
44
  # bucket = storage.bucket "my-bucket"
@@ -551,10 +551,12 @@ module Google
551
551
  # [Authentication
552
552
  # Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
553
553
  #
554
- # @param [String] project Project identifier for the Storage service you
555
- # are connecting to.
556
- # @param [String, Hash] keyfile Keyfile downloaded from Google Cloud. If
557
- # file path the file must be readable.
554
+ # @param [String] project_id Project identifier for the Storage service
555
+ # you are connecting to. If not present, the default project for the
556
+ # credentials is used.
557
+ # @param [String, Hash, Google::Auth::Credentials] credentials The path to
558
+ # the keyfile as a String, the contents of the keyfile as a Hash, or a
559
+ # Google::Auth::Credentials object. (See {Storage::Credentials})
558
560
  # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling
559
561
  # the set of resources and operations that the connection can access.
560
562
  # See [Using OAuth 2.0 to Access Google
@@ -566,6 +568,9 @@ module Google
566
568
  # @param [Integer] retries Number of times to retry requests on server
567
569
  # error. The default value is `3`. Optional.
568
570
  # @param [Integer] timeout Default timeout to use in requests. Optional.
571
+ # @param [String] project Alias for the `project_id` argument. Deprecated.
572
+ # @param [String] keyfile Alias for the `credentials` argument.
573
+ # Deprecated.
569
574
  #
570
575
  # @return [Google::Cloud::Storage::Project]
571
576
  #
@@ -573,29 +578,27 @@ module Google
573
578
  # require "google/cloud/storage"
574
579
  #
575
580
  # storage = Google::Cloud::Storage.new(
576
- # project: "my-todo-project",
577
- # keyfile: "/path/to/keyfile.json"
581
+ # project_id: "my-project",
582
+ # credentials: "/path/to/keyfile.json"
578
583
  # )
579
584
  #
580
585
  # bucket = storage.bucket "my-bucket"
581
586
  # file = bucket.file "path/to/my-file.ext"
582
587
  #
583
- def self.new project: nil, keyfile: nil, scope: nil, retries: nil,
584
- timeout: nil
585
- project ||= Google::Cloud::Storage::Project.default_project
586
- project = project.to_s # Always cast to a string
587
- fail ArgumentError, "project is missing" if project.empty?
588
+ def self.new project_id: nil, credentials: nil, scope: nil, retries: nil,
589
+ timeout: nil, project: nil, keyfile: nil
590
+ project_id ||= (project || Storage::Project.default_project_id)
591
+ project_id = project_id.to_s # Always cast to a string
592
+ fail ArgumentError, "project_id is missing" if project_id.empty?
588
593
 
589
- if keyfile.nil?
590
- credentials = Google::Cloud::Storage::Credentials.default scope: scope
591
- else
592
- credentials = Google::Cloud::Storage::Credentials.new(
593
- keyfile, scope: scope)
594
+ credentials ||= (keyfile || Storage::Credentials.default(scope: scope))
595
+ unless credentials.is_a? Google::Auth::Credentials
596
+ credentials = Storage::Credentials.new credentials, scope: scope
594
597
  end
595
598
 
596
- Google::Cloud::Storage::Project.new(
597
- Google::Cloud::Storage::Service.new(
598
- project, credentials, retries: retries, timeout: timeout))
599
+ Storage::Project.new(
600
+ Storage::Service.new(
601
+ project_id, credentials, retries: retries, timeout: timeout))
599
602
  end
600
603
  end
601
604
  end
@@ -13,18 +13,44 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- require "google/cloud/credentials"
16
+ require "googleauth"
17
17
 
18
18
  module Google
19
19
  module Cloud
20
20
  module Storage
21
21
  ##
22
- # @private Represents the OAuth 2.0 signing logic for Storage.
23
- class Credentials < Google::Cloud::Credentials
22
+ # # Credentials
23
+ #
24
+ # Represents the authentication and authorization used to connect to the
25
+ # Storage API.
26
+ #
27
+ # @example
28
+ # require "google/cloud/storage"
29
+ #
30
+ # keyfile = "/path/to/keyfile.json"
31
+ # creds = Google::Cloud::Storage::Credentials.new keyfile
32
+ #
33
+ # storage = Google::Cloud::Storage.new(
34
+ # project_id: "my-project",
35
+ # credentials: creds
36
+ # )
37
+ #
38
+ # storage.project_id #=> "my-project"
39
+ #
40
+ class Credentials < Google::Auth::Credentials
24
41
  SCOPE = ["https://www.googleapis.com/auth/devstorage.full_control"]
25
- PATH_ENV_VARS = %w(STORAGE_KEYFILE GOOGLE_CLOUD_KEYFILE GCLOUD_KEYFILE)
26
- JSON_ENV_VARS = %w(STORAGE_KEYFILE_JSON GOOGLE_CLOUD_KEYFILE_JSON
42
+ PATH_ENV_VARS = %w(STORAGE_CREDENTIALS
43
+ STORAGE_KEYFILE
44
+ GOOGLE_CLOUD_CREDENTIALS
45
+ GOOGLE_CLOUD_KEYFILE
46
+ GCLOUD_KEYFILE)
47
+ JSON_ENV_VARS = %w(STORAGE_CREDENTIALS_JSON
48
+ STORAGE_KEYFILE_JSON
49
+ GOOGLE_CLOUD_CREDENTIALS_JSON
50
+ GOOGLE_CLOUD_KEYFILE_JSON
27
51
  GCLOUD_KEYFILE_JSON)
52
+ DEFAULT_PATHS = \
53
+ ["~/.config/gcloud/application_default_credentials.json"]
28
54
  end
29
55
  end
30
56
  end
@@ -66,19 +66,20 @@ module Google
66
66
  # require "google/cloud/storage"
67
67
  #
68
68
  # storage = Google::Cloud::Storage.new(
69
- # project: "my-todo-project",
70
- # keyfile: "/path/to/keyfile.json"
69
+ # project_id: "my-project",
70
+ # credentials: "/path/to/keyfile.json"
71
71
  # )
72
72
  #
73
- # storage.project #=> "my-todo-project"
73
+ # storage.project_id #=> "my-project"
74
74
  #
75
- def project
75
+ def project_id
76
76
  service.project
77
77
  end
78
+ alias_method :project, :project_id
78
79
 
79
80
  ##
80
81
  # @private Default project.
81
- def self.default_project
82
+ def self.default_project_id
82
83
  ENV["STORAGE_PROJECT"] ||
83
84
  ENV["GOOGLE_CLOUD_PROJECT"] ||
84
85
  ENV["GCLOUD_PROJECT"] ||
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Storage
19
- VERSION = "1.7.1"
19
+ VERSION = "1.8.0"
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-24 00:00:00.000000000 Z
12
+ date: 2017-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -17,28 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.0'
20
+ version: '1.1'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.0'
27
+ version: '1.1'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: google-api-client
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 0.14.2
34
+ version: 0.17.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.17.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: googleauth
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 0.6.2
35
49
  type: :runtime
36
50
  prerelease: false
37
51
  version_requirements: !ruby/object:Gem::Requirement
38
52
  requirements:
39
53
  - - "~>"
40
54
  - !ruby/object:Gem::Version
41
- version: 0.14.2
55
+ version: 0.6.2
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: digest-crc
44
58
  requirement: !ruby/object:Gem::Requirement
@@ -229,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
243
  version: '0'
230
244
  requirements: []
231
245
  rubyforge_project:
232
- rubygems_version: 2.6.14
246
+ rubygems_version: 2.7.2
233
247
  signing_key:
234
248
  specification_version: 4
235
249
  summary: API Client library for Google Cloud Storage