google-cloud-pubsub 0.26.0 → 2.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/.yardopts +12 -2
  3. data/AUTHENTICATION.md +178 -0
  4. data/CHANGELOG.md +659 -0
  5. data/CODE_OF_CONDUCT.md +40 -0
  6. data/CONTRIBUTING.md +187 -0
  7. data/EMULATOR.md +37 -0
  8. data/LICENSE +2 -2
  9. data/LOGGING.md +32 -0
  10. data/OVERVIEW.md +528 -0
  11. data/TROUBLESHOOTING.md +31 -0
  12. data/lib/google/cloud/pubsub/async_publisher/batch.rb +310 -0
  13. data/lib/google/cloud/pubsub/async_publisher.rb +402 -0
  14. data/lib/google/cloud/pubsub/batch_publisher.rb +100 -0
  15. data/lib/google/cloud/pubsub/convert.rb +91 -0
  16. data/lib/google/cloud/pubsub/credentials.rb +26 -10
  17. data/lib/google/cloud/pubsub/errors.rb +85 -0
  18. data/lib/google/cloud/pubsub/message.rb +80 -17
  19. data/lib/google/cloud/pubsub/policy.rb +17 -14
  20. data/lib/google/cloud/pubsub/project.rb +364 -250
  21. data/lib/google/cloud/pubsub/publish_result.rb +103 -0
  22. data/lib/google/cloud/pubsub/received_message.rb +162 -24
  23. data/lib/google/cloud/pubsub/retry_policy.rb +88 -0
  24. data/lib/google/cloud/pubsub/schema/list.rb +180 -0
  25. data/lib/google/cloud/pubsub/schema.rb +310 -0
  26. data/lib/google/cloud/pubsub/service.rb +281 -265
  27. data/lib/google/cloud/pubsub/snapshot/list.rb +21 -21
  28. data/lib/google/cloud/pubsub/snapshot.rb +55 -15
  29. data/lib/google/cloud/pubsub/subscriber/enumerator_queue.rb +54 -0
  30. data/lib/google/cloud/pubsub/subscriber/inventory.rb +173 -0
  31. data/lib/google/cloud/pubsub/subscriber/sequencer.rb +115 -0
  32. data/lib/google/cloud/pubsub/subscriber/stream.rb +400 -0
  33. data/lib/google/cloud/pubsub/subscriber/timed_unary_buffer.rb +230 -0
  34. data/lib/google/cloud/pubsub/subscriber.rb +417 -0
  35. data/lib/google/cloud/pubsub/subscription/list.rb +28 -28
  36. data/lib/google/cloud/pubsub/subscription/push_config.rb +268 -0
  37. data/lib/google/cloud/pubsub/subscription.rb +900 -172
  38. data/lib/google/cloud/pubsub/topic/list.rb +21 -21
  39. data/lib/google/cloud/pubsub/topic.rb +674 -95
  40. data/lib/google/cloud/pubsub/version.rb +6 -4
  41. data/lib/google/cloud/pubsub.rb +104 -439
  42. data/lib/google-cloud-pubsub.rb +60 -29
  43. metadata +88 -50
  44. data/README.md +0 -69
  45. data/lib/google/cloud/pubsub/topic/publisher.rb +0 -86
  46. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +0 -77
  47. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +0 -223
  48. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +0 -81
  49. data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +0 -503
  50. data/lib/google/cloud/pubsub/v1/publisher_client.rb +0 -605
  51. data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -96
  52. data/lib/google/cloud/pubsub/v1/subscriber_client.rb +0 -1104
  53. data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -127
  54. data/lib/google/cloud/pubsub/v1.rb +0 -17
  55. data/lib/google/pubsub/v1/pubsub_pb.rb +0 -187
  56. data/lib/google/pubsub/v1/pubsub_services_pb.rb +0 -159
@@ -1,10 +1,10 @@
1
- # Copyright 2016 Google Inc. All rights reserved.
1
+ # Copyright 2016 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
5
5
  # You may obtain a copy of the License at
6
6
  #
7
- # http://www.apache.org/licenses/LICENSE-2.0
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
8
  #
9
9
  # Unless required by applicable law or agreed to in writing, software
10
10
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -12,14 +12,17 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  ##
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.
17
+ # This file is here to be autorequired by bundler, so that the
18
+ # Google::Cloud.pubsub and Google::Cloud#pubsub methods can be available, but
19
+ # the library and all dependencies won't be loaded until required and used.
19
20
 
20
21
 
21
22
  gem "google-cloud-core"
22
- require "google/cloud"
23
+ require "google/cloud" unless defined? Google::Cloud.new
24
+ require "google/cloud/config"
25
+ require "googleauth"
23
26
 
24
27
  module Google
25
28
  module Cloud
@@ -27,8 +30,8 @@ module Google
27
30
  # Creates a new object for connecting to the Pub/Sub service.
28
31
  # Each call creates a new connection.
29
32
  #
30
- # For more information on connecting to Google Cloud see the [Authentication
31
- # Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
33
+ # For more information on connecting to Google Cloud see the
34
+ # {file:AUTHENTICATION.md Authentication Guide}.
32
35
  #
33
36
  # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
34
37
  # set of resources and operations that the connection can access. See
@@ -39,10 +42,8 @@ module Google
39
42
  #
40
43
  # * `https://www.googleapis.com/auth/pubsub`
41
44
  # @param [Integer] timeout Default timeout to use in requests. Optional.
42
- # @param [Hash] client_config A hash of values to override the default
43
- # behavior of the API client. Optional.
44
45
  #
45
- # @return [Google::Cloud::Pubsub::Project]
46
+ # @return [Google::Cloud::PubSub::Project]
46
47
  #
47
48
  # @example
48
49
  # require "google/cloud"
@@ -59,23 +60,25 @@ module Google
59
60
  # platform_scope = "https://www.googleapis.com/auth/cloud-platform"
60
61
  # pubsub = gcloud.pubsub scope: platform_scope
61
62
  #
62
- def pubsub scope: nil, timeout: nil, client_config: nil
63
- Google::Cloud.pubsub @project, @keyfile, scope: scope,
64
- timeout: (timeout || @timeout),
65
- client_config: client_config
63
+ def pubsub scope: nil, timeout: nil
64
+ timeout ||= @timeout
65
+ Google::Cloud.pubsub @project, @keyfile, scope: scope, timeout: timeout
66
66
  end
67
67
 
68
68
  ##
69
69
  # Creates a new object for connecting to the Pub/Sub service.
70
70
  # Each call creates a new connection.
71
71
  #
72
- # For more information on connecting to Google Cloud see the [Authentication
73
- # Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
72
+ # For more information on connecting to Google Cloud see the
73
+ # {file:AUTHENTICATION.md Authentication Guide}.
74
74
  #
75
- # @param [String] project Project identifier for the Pub/Sub service you are
76
- # connecting to.
77
- # @param [String, Hash] keyfile Keyfile downloaded from Google Cloud. If
78
- # file path the file must be readable.
75
+ # @param [String] project_id Project identifier for the Pub/Sub service you
76
+ # are connecting to. If not present, the default project for the
77
+ # credentials is used.
78
+ # @param [String, Hash, Google::Auth::Credentials] credentials The path to
79
+ # the keyfile as a String, the contents of the keyfile as a Hash, or a
80
+ # Google::Auth::Credentials object.
81
+ # (See {Google::Cloud::PubSub::Credentials})
79
82
  # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
80
83
  # set of resources and operations that the connection can access. See
81
84
  # [Using OAuth 2.0 to Access Google
@@ -85,10 +88,8 @@ module Google
85
88
  #
86
89
  # * `https://www.googleapis.com/auth/pubsub`
87
90
  # @param [Integer] timeout Default timeout to use in requests. Optional.
88
- # @param [Hash] client_config A hash of values to override the default
89
- # behavior of the API client. Optional.
90
91
  #
91
- # @return [Google::Cloud::Pubsub::Project]
92
+ # @return [Google::Cloud::PubSub::Project]
92
93
  #
93
94
  # @example
94
95
  # require "google/cloud"
@@ -98,12 +99,42 @@ module Google
98
99
  # topic = pubsub.topic "my-topic"
99
100
  # topic.publish "task completed"
100
101
  #
101
- def self.pubsub project = nil, keyfile = nil, scope: nil, timeout: nil,
102
- client_config: nil
102
+ def self.pubsub project_id = nil,
103
+ credentials = nil,
104
+ scope: nil,
105
+ timeout: nil
103
106
  require "google/cloud/pubsub"
104
- Google::Cloud::Pubsub.new project: project, keyfile: keyfile,
105
- scope: scope, timeout: timeout,
106
- client_config: client_config
107
+ Google::Cloud::PubSub.new project_id: project_id, credentials: credentials, scope: scope, timeout: timeout
107
108
  end
108
109
  end
109
110
  end
111
+
112
+ # Set the default pubsub configuration
113
+ Google::Cloud.configure.add_config! :pubsub do |config|
114
+ default_project = Google::Cloud::Config.deferred do
115
+ ENV["PUBSUB_PROJECT"]
116
+ end
117
+ default_creds = Google::Cloud::Config.deferred do
118
+ Google::Cloud::Config.credentials_from_env(
119
+ "PUBSUB_CREDENTIALS", "PUBSUB_CREDENTIALS_JSON", "PUBSUB_KEYFILE", "PUBSUB_KEYFILE_JSON"
120
+ )
121
+ end
122
+ default_emulator = Google::Cloud::Config.deferred do
123
+ ENV["PUBSUB_EMULATOR_HOST"]
124
+ end
125
+ default_scopes = [
126
+ "https://www.googleapis.com/auth/cloud-platform",
127
+ "https://www.googleapis.com/auth/pubsub"
128
+ ]
129
+
130
+ config.add_field! :project_id, default_project, match: String, allow_nil: true
131
+ config.add_alias! :project, :project_id
132
+ config.add_field! :credentials, default_creds, match: [String, Hash, Google::Auth::Credentials], allow_nil: true
133
+ config.add_alias! :keyfile, :credentials
134
+ config.add_field! :scope, default_scopes, match: [String, Array]
135
+ config.add_field! :quota_project, nil, match: String
136
+ config.add_field! :timeout, nil, match: Integer
137
+ config.add_field! :emulator_host, default_emulator, match: String, allow_nil: true
138
+ config.add_field! :on_error, nil, match: Proc
139
+ config.add_field! :endpoint, "pubsub.googleapis.com", match: String
140
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.0
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,108 +9,122 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-07-11 00:00:00.000000000 Z
12
+ date: 2021-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: google-cloud-core
15
+ name: concurrent-ruby
16
16
  requirement: !ruby/object:Gem::Requirement
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
- name: google-gax
29
+ name: google-cloud-core
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 0.8.0
34
+ version: '1.5'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 0.8.0
41
+ version: '1.5'
42
42
  - !ruby/object:Gem::Dependency
43
- name: grpc-google-iam-v1
43
+ name: google-cloud-pubsub-v1
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 0.6.8
48
+ version: '0.0'
49
49
  type: :runtime
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.6.8
55
+ version: '0.0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: minitest
57
+ name: autotest-suffix
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '5.10'
62
+ version: '1.1'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '5.10'
69
+ version: '1.1'
70
70
  - !ruby/object:Gem::Dependency
71
- name: minitest-autotest
71
+ name: avro
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '1.0'
76
+ version: '1.10'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '1.0'
83
+ version: '1.10'
84
84
  - !ruby/object:Gem::Dependency
85
- name: minitest-focus
85
+ name: google-style
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '1.1'
90
+ version: 1.25.1
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '1.1'
97
+ version: 1.25.1
98
98
  - !ruby/object:Gem::Dependency
99
- name: minitest-rg
99
+ name: minitest
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: '5.2'
104
+ version: '5.14'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: '5.2'
111
+ version: '5.14'
112
112
  - !ruby/object:Gem::Dependency
113
- name: autotest-suffix
113
+ name: minitest-autotest
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '1.0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '1.0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: minitest-focus
114
128
  requirement: !ruby/object:Gem::Requirement
115
129
  requirements:
116
130
  - - "~>"
@@ -124,19 +138,33 @@ dependencies:
124
138
  - !ruby/object:Gem::Version
125
139
  version: '1.1'
126
140
  - !ruby/object:Gem::Dependency
127
- name: rubocop
141
+ name: minitest-rg
128
142
  requirement: !ruby/object:Gem::Requirement
129
143
  requirements:
130
- - - "<="
144
+ - - "~>"
131
145
  - !ruby/object:Gem::Version
132
- version: 0.35.1
146
+ version: '5.2'
133
147
  type: :development
134
148
  prerelease: false
135
149
  version_requirements: !ruby/object:Gem::Requirement
136
150
  requirements:
137
- - - "<="
151
+ - - "~>"
138
152
  - !ruby/object:Gem::Version
139
- version: 0.35.1
153
+ version: '5.2'
154
+ - !ruby/object:Gem::Dependency
155
+ name: redcarpet
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '3.0'
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: '3.0'
140
168
  - !ruby/object:Gem::Dependency
141
169
  name: simplecov
142
170
  requirement: !ruby/object:Gem::Requirement
@@ -169,16 +197,16 @@ dependencies:
169
197
  name: yard-doctest
170
198
  requirement: !ruby/object:Gem::Requirement
171
199
  requirements:
172
- - - "<="
200
+ - - "~>"
173
201
  - !ruby/object:Gem::Version
174
- version: 0.1.8
202
+ version: 0.1.13
175
203
  type: :development
176
204
  prerelease: false
177
205
  version_requirements: !ruby/object:Gem::Requirement
178
206
  requirements:
179
- - - "<="
207
+ - - "~>"
180
208
  - !ruby/object:Gem::Version
181
- version: 0.1.8
209
+ version: 0.1.13
182
210
  description: google-cloud-pubsub is the official library for Google Cloud Pub/Sub.
183
211
  email:
184
212
  - mike@blowmage.com
@@ -188,36 +216,47 @@ extensions: []
188
216
  extra_rdoc_files: []
189
217
  files:
190
218
  - ".yardopts"
219
+ - AUTHENTICATION.md
220
+ - CHANGELOG.md
221
+ - CODE_OF_CONDUCT.md
222
+ - CONTRIBUTING.md
223
+ - EMULATOR.md
191
224
  - LICENSE
192
- - README.md
225
+ - LOGGING.md
226
+ - OVERVIEW.md
227
+ - TROUBLESHOOTING.md
193
228
  - lib/google-cloud-pubsub.rb
194
229
  - lib/google/cloud/pubsub.rb
230
+ - lib/google/cloud/pubsub/async_publisher.rb
231
+ - lib/google/cloud/pubsub/async_publisher/batch.rb
232
+ - lib/google/cloud/pubsub/batch_publisher.rb
233
+ - lib/google/cloud/pubsub/convert.rb
195
234
  - lib/google/cloud/pubsub/credentials.rb
235
+ - lib/google/cloud/pubsub/errors.rb
196
236
  - lib/google/cloud/pubsub/message.rb
197
237
  - lib/google/cloud/pubsub/policy.rb
198
238
  - lib/google/cloud/pubsub/project.rb
239
+ - lib/google/cloud/pubsub/publish_result.rb
199
240
  - lib/google/cloud/pubsub/received_message.rb
241
+ - lib/google/cloud/pubsub/retry_policy.rb
242
+ - lib/google/cloud/pubsub/schema.rb
243
+ - lib/google/cloud/pubsub/schema/list.rb
200
244
  - lib/google/cloud/pubsub/service.rb
201
245
  - lib/google/cloud/pubsub/snapshot.rb
202
246
  - lib/google/cloud/pubsub/snapshot/list.rb
247
+ - lib/google/cloud/pubsub/subscriber.rb
248
+ - lib/google/cloud/pubsub/subscriber/enumerator_queue.rb
249
+ - lib/google/cloud/pubsub/subscriber/inventory.rb
250
+ - lib/google/cloud/pubsub/subscriber/sequencer.rb
251
+ - lib/google/cloud/pubsub/subscriber/stream.rb
252
+ - lib/google/cloud/pubsub/subscriber/timed_unary_buffer.rb
203
253
  - lib/google/cloud/pubsub/subscription.rb
204
254
  - lib/google/cloud/pubsub/subscription/list.rb
255
+ - lib/google/cloud/pubsub/subscription/push_config.rb
205
256
  - lib/google/cloud/pubsub/topic.rb
206
257
  - lib/google/cloud/pubsub/topic/list.rb
207
- - lib/google/cloud/pubsub/topic/publisher.rb
208
- - lib/google/cloud/pubsub/v1.rb
209
- - lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb
210
- - lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb
211
- - lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb
212
- - lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb
213
- - lib/google/cloud/pubsub/v1/publisher_client.rb
214
- - lib/google/cloud/pubsub/v1/publisher_client_config.json
215
- - lib/google/cloud/pubsub/v1/subscriber_client.rb
216
- - lib/google/cloud/pubsub/v1/subscriber_client_config.json
217
258
  - lib/google/cloud/pubsub/version.rb
218
- - lib/google/pubsub/v1/pubsub_pb.rb
219
- - lib/google/pubsub/v1/pubsub_services_pb.rb
220
- homepage: https://github.com/GoogleCloudPlatform/google-cloud-ruby/tree/master/google-cloud-pubsub
259
+ homepage: https://github.com/googleapis/google-cloud-ruby/tree/master/google-cloud-pubsub
221
260
  licenses:
222
261
  - Apache-2.0
223
262
  metadata: {}
@@ -229,15 +268,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
268
  requirements:
230
269
  - - ">="
231
270
  - !ruby/object:Gem::Version
232
- version: 2.0.0
271
+ version: '2.5'
233
272
  required_rubygems_version: !ruby/object:Gem::Requirement
234
273
  requirements:
235
274
  - - ">="
236
275
  - !ruby/object:Gem::Version
237
276
  version: '0'
238
277
  requirements: []
239
- rubyforge_project:
240
- rubygems_version: 2.6.12
278
+ rubygems_version: 3.2.16
241
279
  signing_key:
242
280
  specification_version: 4
243
281
  summary: API Client library for Google Cloud Pub/Sub
data/README.md DELETED
@@ -1,69 +0,0 @@
1
- # google-cloud-pubsub
2
-
3
- [Google Cloud Pub/Sub](https://cloud.google.com/pubsub/) ([docs](https://cloud.google.com/pubsub/docs/reference/rest/)) is designed to provide reliable, many-to-many, asynchronous messaging between applications. Publisher applications can send messages to a “topic” and other applications can subscribe to that topic to receive the messages. By decoupling senders and receivers, Google Cloud Pub/Sub allows developers to communicate between independently written applications.
4
-
5
- - [google-cloud-pubsub API documentation](http://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-pubsub/latest)
6
- - [google-cloud-pubsub on RubyGems](https://rubygems.org/gems/[google-cloud-pubsub)
7
- - [Google Cloud Pub/Sub documentation](https://cloud.google.com/pubsub/docs)
8
-
9
- ## Quick Start
10
-
11
- ```sh
12
- $ gem install google-cloud-pubsub
13
- ```
14
-
15
- ## Authentication
16
-
17
- This library uses Service Account credentials to connect to Google Cloud services. When running on Compute Engine the credentials will be discovered automatically. When running on other environments the Service Account credentials can be specified by providing the path to the JSON file, or the JSON itself, in environment variables.
18
-
19
- Instructions and configuration options are covered in the [Authentication Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-pubsub/guides/authentication).
20
-
21
- ## Example
22
-
23
- ```ruby
24
- require "google/cloud/pubsub"
25
-
26
- pubsub = Google::Cloud::Pubsub.new(
27
- project: "my-project",
28
- keyfile: "/path/to/keyfile.json"
29
- )
30
-
31
- # Retrieve a topic
32
- topic = pubsub.topic "my-topic"
33
-
34
- # Publish a new message
35
- msg = topic.publish "new-message"
36
-
37
- # Retrieve a subscription
38
- sub = pubsub.subscription "my-topic-sub"
39
-
40
- # Pull available messages
41
- msgs = sub.pull
42
- ```
43
-
44
- ## Supported Ruby Versions
45
-
46
- This library is supported on Ruby 2.0+.
47
-
48
- ## Versioning
49
-
50
- This library follows [Semantic Versioning](http://semver.org/).
51
-
52
- It is currently in major version zero (0.y.z), which means that anything may change at any time and the public API should not be considered stable.
53
-
54
- ## Contributing
55
-
56
- Contributions to this library are always welcome and highly encouraged.
57
-
58
- See the [Contributing Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/contributing) for more information on how to get started.
59
-
60
- Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See [Code of Conduct](../CODE_OF_CONDUCT.md) for more information.
61
-
62
- ## License
63
-
64
- This library is licensed under Apache 2.0. Full license text is available in [LICENSE](LICENSE).
65
-
66
- ## Support
67
-
68
- Please [report bugs at the project on Github](https://github.com/GoogleCloudPlatform/google-cloud-ruby/issues).
69
- Don't hesitate to [ask questions](http://stackoverflow.com/questions/tagged/google-cloud-platform+ruby) about the client or APIs on [StackOverflow](http://stackoverflow.com).