google-cloud-dns 0.27.0 → 0.28.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
2
  SHA256:
3
- metadata.gz: 2902040425bfc9edf2d23b29871cf6e0ad1fef4d4cd21b8f202cf273ad468ffb
4
- data.tar.gz: ac4997dccb8fbd1c7308e1cddedfdc6f86e17210356b9f2b2aaf0b2fc09a20d1
3
+ metadata.gz: 9e8272d440a9dc2b377529facd35cc0383a896b2bcee3d5b66c9f8d20f67f528
4
+ data.tar.gz: 903d26ed7c8451264513f34a183a6b849e1c4379f14927661b4449ce911590a6
5
5
  SHA512:
6
- metadata.gz: 65e7eac5bfbc6bdcc5cc90f0c342b1d8c2a95fa8a2fb5b67a2c39eb1acf59ae4f0cf35db6a1d6290f5134d33515a091c1c9e759a03c4a3c46a193682855b4ba1
7
- data.tar.gz: 26810cfcf5449c54b746aa780dca37193c706219de9a30fb37ba348fe3bade65b9cbd2772d24c026384ad53bc188f71890bc3a0bb95b370a436b2576748c33e0
6
+ metadata.gz: 905ca17843ed70325d936bcc03a5d8ae1c735e24b015500f2d1d5a8b586bbe5aa9b45faabb800cae74dc94cde7388d48676ca3ab661dd60d293509811d38416c
7
+ data.tar.gz: 4ac52e9a95892a6fb7c33d3e238a563b9ac0b83f169f37f8d84ce44d9725049a122b130fcceb37abe1588cf96e0c1bf26ca4921f58f683b8baea7f40a983e593
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  Apache License
2
2
  Version 2.0, January 2004
3
- http://www.apache.org/licenses/
3
+ https://www.apache.org/licenses/
4
4
 
5
5
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
6
 
@@ -192,7 +192,7 @@
192
192
  you may not use this file except in compliance with the License.
193
193
  You may obtain a copy of the License at
194
194
 
195
- http://www.apache.org/licenses/LICENSE-2.0
195
+ https://www.apache.org/licenses/LICENSE-2.0
196
196
 
197
197
  Unless required by applicable law or agreed to in writing, software
198
198
  distributed under the License is distributed on an "AS IS" BASIS,
@@ -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,
@@ -20,6 +20,8 @@
20
20
 
21
21
  gem "google-cloud-core"
22
22
  require "google/cloud"
23
+ require "google/cloud/config"
24
+ require "googleauth"
23
25
 
24
26
  module Google
25
27
  module Cloud
@@ -108,3 +110,26 @@ module Google
108
110
  end
109
111
  end
110
112
  end
113
+
114
+ # Set the default dns configuration
115
+ Google::Cloud.configure.add_config! :dns do |config|
116
+ default_project = Google::Cloud::Config.deferred do
117
+ ENV["DNS_PROJECT"]
118
+ end
119
+ default_creds = Google::Cloud::Config.deferred do
120
+ Google::Cloud::Config.credentials_from_env(
121
+ "DNS_CREDENTIALS", "DNS_CREDENTIALS_JSON",
122
+ "DNS_KEYFILE", "DNS_KEYFILE_JSON"
123
+ )
124
+ end
125
+
126
+ config.add_field! :project_id, default_project, match: String, allow_nil: true
127
+ config.add_alias! :project, :project_id
128
+ config.add_field! :credentials, default_creds,
129
+ match: [String, Hash, Google::Auth::Credentials],
130
+ allow_nil: true
131
+ config.add_alias! :keyfile, :credentials
132
+ config.add_field! :scope, nil, match: [String, Array]
133
+ config.add_field! :retries, nil, match: Integer
134
+ config.add_field! :timeout, nil, match: Integer
135
+ end
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 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,
@@ -15,6 +15,8 @@
15
15
 
16
16
  require "google-cloud-dns"
17
17
  require "google/cloud/dns/project"
18
+ require "google/cloud/config"
19
+ require "google/cloud/env"
18
20
 
19
21
  module Google
20
22
  module Cloud
@@ -29,11 +31,12 @@ module Google
29
31
  # Cloud DNS?](https://cloud.google.com/dns/what-is-cloud-dns).
30
32
  #
31
33
  # The goal of google-cloud is to provide an API that is comfortable to
32
- # Rubyists. Authentication is handled by {Google::Cloud#dns}. You can
33
- # provide the project and credential information to connect to the Cloud DNS
34
- # service, or if you are running on Google Compute Engine this configuration
35
- # is taken care of for you. You can read more about the options for
36
- # connecting in the [Authentication
34
+ # Rubyists. Your authentication credentials are detected automatically in
35
+ # Google Cloud Platform environments such as Google Compute Engine, Google
36
+ # App Engine and Google Kubernetes Engine. In other environments you can
37
+ # configure authentication easily, either directly in your code or via
38
+ # environment variables. Read more about the options for connecting in the
39
+ # [Authentication
37
40
  # Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
38
41
  #
39
42
  # ## Creating Zones
@@ -312,18 +315,66 @@ module Google
312
315
  #
313
316
  def self.new project_id: nil, credentials: nil, scope: nil, retries: nil,
314
317
  timeout: nil, project: nil, keyfile: nil
315
- project_id ||= (project || Dns::Project.default_project_id)
318
+ project_id ||= (project || default_project_id)
316
319
  project_id = project_id.to_s # Always cast to a string
317
- fail ArgumentError, "project_id is missing" if project_id.empty?
320
+ raise ArgumentError, "project_id is missing" if project_id.empty?
318
321
 
319
- credentials ||= (keyfile || Dns::Credentials.default(scope: scope))
322
+ scope ||= configure.scope
323
+ retries ||= configure.retries
324
+ timeout ||= configure.timeout
325
+
326
+ credentials ||= (keyfile || default_credentials(scope: scope))
320
327
  unless credentials.is_a? Google::Auth::Credentials
321
328
  credentials = Dns::Credentials.new credentials, scope: scope
322
329
  end
323
330
 
324
331
  Dns::Project.new(
325
332
  Dns::Service.new(
326
- project_id, credentials, retries: retries, timeout: timeout))
333
+ project_id, credentials, retries: retries, timeout: timeout
334
+ )
335
+ )
336
+ end
337
+
338
+ ##
339
+ # Configure the Google Cloud DNS library.
340
+ #
341
+ # The following DNS configuration parameters are supported:
342
+ #
343
+ # * `project_id` - (String) Identifier for a DNS project. (The
344
+ # parameter `project` is considered deprecated, but may also be used.)
345
+ # * `credentials` - (String, Hash, Google::Auth::Credentials) The path to
346
+ # the keyfile as a String, the contents of the keyfile as a Hash, or a
347
+ # Google::Auth::Credentials object. (See {Dns::Credentials}) (The
348
+ # parameter `keyfile` is considered deprecated, but may also be used.)
349
+ # * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
350
+ # the set of resources and operations that the connection can access.
351
+ # * `retries` - (Integer) Number of times to retry requests on server
352
+ # error.
353
+ # * `timeout` - (Integer) Default timeout to use in requests.
354
+ #
355
+ # @return [Google::Cloud::Config] The configuration object the
356
+ # Google::Cloud::Dns library uses.
357
+ #
358
+ def self.configure
359
+ yield Google::Cloud.configure.dns if block_given?
360
+
361
+ Google::Cloud.configure.dns
362
+ end
363
+
364
+ ##
365
+ # @private Default project.
366
+ def self.default_project_id
367
+ Google::Cloud.configure.dns.project_id ||
368
+ Google::Cloud.configure.project_id ||
369
+ Google::Cloud.env.project_id
370
+ end
371
+
372
+ ##
373
+ # @private Default credentials.
374
+ def self.default_credentials scope: nil
375
+ Google::Cloud.configure.dns.credentials ||
376
+ Google::Cloud.configure.credentials ||
377
+ Dns::Credentials.default(scope: scope)
327
378
  end
328
379
  end
329
380
  end
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 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,
@@ -100,7 +100,7 @@ module Google
100
100
  #
101
101
  def started_at
102
102
  Time.parse @gapi.start_time
103
- rescue
103
+ rescue StandardError
104
104
  nil
105
105
  end
106
106
 
@@ -110,7 +110,7 @@ module Google
110
110
  ensure_service!
111
111
  @gapi = zone.service.get_change @zone.id, id
112
112
  end
113
- alias_method :refresh!, :reload!
113
+ alias refresh! reload!
114
114
 
115
115
  ##
116
116
  # Refreshes the change until the status is `done`.
@@ -150,7 +150,7 @@ module Google
150
150
  ##
151
151
  # Raise an error unless an active service is available.
152
152
  def ensure_service!
153
- fail "Must have active connection" unless zone && zone.service
153
+ raise "Must have active connection" unless zone && zone.service
154
154
  end
155
155
  end
156
156
  end
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 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,
@@ -162,7 +162,7 @@ module Google
162
162
  ##
163
163
  # Raise an error unless an active connection is available.
164
164
  def ensure_zone!
165
- fail "Must have active connection" unless @zone
165
+ raise "Must have active connection" unless @zone
166
166
  end
167
167
  end
168
168
  end
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 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,
@@ -38,19 +38,20 @@ module Google
38
38
  # dns.project_id #=> "my-project"
39
39
  #
40
40
  class Credentials < Google::Auth::Credentials
41
- SCOPE = ["https://www.googleapis.com/auth/ndev.clouddns.readwrite"]
42
- PATH_ENV_VARS = %w(DNS_CREDENTIALS
41
+ SCOPE =
42
+ ["https://www.googleapis.com/auth/ndev.clouddns.readwrite"].freeze
43
+ PATH_ENV_VARS = %w[DNS_CREDENTIALS
43
44
  DNS_KEYFILE
44
45
  GOOGLE_CLOUD_CREDENTIALS
45
46
  GOOGLE_CLOUD_KEYFILE
46
- GCLOUD_KEYFILE)
47
- JSON_ENV_VARS = %w(DNS_CREDENTIALS_JSON
47
+ GCLOUD_KEYFILE].freeze
48
+ JSON_ENV_VARS = %w[DNS_CREDENTIALS_JSON
48
49
  DNS_KEYFILE_JSON
49
50
  GOOGLE_CLOUD_CREDENTIALS_JSON
50
51
  GOOGLE_CLOUD_KEYFILE_JSON
51
- GCLOUD_KEYFILE_JSON)
52
+ GCLOUD_KEYFILE_JSON].freeze
52
53
  DEFAULT_PATHS = \
53
- ["~/.config/gcloud/application_default_credentials.json"]
54
+ ["~/.config/gcloud/application_default_credentials.json"].freeze
54
55
  end
55
56
  end
56
57
  end
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 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,
@@ -123,54 +123,62 @@ module Google
123
123
  end
124
124
 
125
125
  # rubocop:disable all
126
+
127
+ ##
126
128
  # Rubocop's line-length and branch condition restrictions prevent
127
129
  # the most straightforward approach to converting zonefile's records
128
130
  # to our own. So disable rubocop for this operation.
129
-
130
131
  def data_from_zonefile_record type, zf_record
131
132
  case type.to_s.upcase
132
133
  when "A"
133
- "#{zf_record[:host]}"
134
+ String zf_record[:host]
134
135
  when "AAAA"
135
- "#{zf_record[:host]}"
136
+ String zf_record[:host]
136
137
  when "CNAME"
137
- "#{zf_record[:host]}"
138
+ String zf_record[:host]
138
139
  when "MX"
139
140
  "#{zf_record[:pri]} #{zf_record[:host]}"
140
141
  when "NAPTR"
141
- "#{zf_record[:order]} #{zf_record[:preference]} #{zf_record[:flags]} #{zf_record[:service]} #{zf_record[:regexp]} #{zf_record[:replacement]}"
142
+ "#{zf_record[:order]} #{zf_record[:preference]} " \
143
+ "#{zf_record[:flags]} #{zf_record[:service]} " \
144
+ "#{zf_record[:regexp]} #{zf_record[:replacement]}"
142
145
  when "NS"
143
- "#{zf_record[:host]}"
146
+ String zf_record[:host]
144
147
  when "PTR"
145
- "#{zf_record[:host]}"
148
+ String zf_record[:host]
146
149
  when "SOA"
147
- "#{zf_record[:primary]} #{zf_record[:email]} #{zf_record[:serial]} #{zf_record[:refresh]} #{zf_record[:retry]} #{zf_record[:expire]} #{zf_record[:minimumTTL]}"
150
+ "#{zf_record[:primary]} #{zf_record[:email]} " \
151
+ "#{zf_record[:serial]} #{zf_record[:refresh]} " \
152
+ "#{zf_record[:retry]} #{zf_record[:expire]} " \
153
+ "#{zf_record[:minimumTTL]}"
148
154
  when "SPF"
149
- "#{zf_record[:data]}"
155
+ String zf_record[:data]
150
156
  when "SRV"
151
- "#{zf_record[:pri]} #{zf_record[:weight]} #{zf_record[:port]} #{zf_record[:host]}"
157
+ "#{zf_record[:pri]} #{zf_record[:weight]} " \
158
+ "#{zf_record[:port]} #{zf_record[:host]}"
152
159
  when "TXT"
153
- "#{zf_record[:text]}"
160
+ String zf_record[:text]
154
161
  else
155
- fail ArgumentError, "record type '#{type}' is not supported"
162
+ raise ArgumentError, "record type '#{type}' is not supported"
156
163
  end
157
164
  end
158
165
 
159
166
  # rubocop:enable all
160
167
 
161
- MULTIPLIER = { "s" => (1),
162
- "m" => (60),
168
+ ##
169
+ # @private
170
+ MULTIPLIER = { "s" => 1,
171
+ "m" => 60,
163
172
  "h" => (60 * 60),
164
173
  "d" => (60 * 60 * 24),
165
- "w" => (60 * 60 * 24 * 7) } # :nodoc:
174
+ "w" => (60 * 60 * 24 * 7) }.freeze # :nodoc:
166
175
 
167
176
  def ttl_to_i ttl
168
177
  if ttl.respond_to?(:to_int) || ttl.to_s =~ /\A\d+\z/
169
- return ttl.to_i
178
+ ttl.to_i
170
179
  elsif (m = /\A(\d+)(w|d|h|m|s)\z/.match ttl)
171
- return m[1].to_i * MULTIPLIER[m[2]].to_i
180
+ m[1].to_i * MULTIPLIER[m[2]].to_i
172
181
  end
173
- nil
174
182
  end
175
183
 
176
184
  def create_zonefile path_or_io # :nodoc:
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 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,
@@ -14,7 +14,6 @@
14
14
 
15
15
 
16
16
  require "google/cloud/errors"
17
- require "google/cloud/env"
18
17
  require "google/cloud/dns/service"
19
18
  require "google/cloud/dns/credentials"
20
19
  require "google/cloud/dns/zone"
@@ -73,8 +72,8 @@ module Google
73
72
  def project_id
74
73
  service.project
75
74
  end
76
- alias_method :project, :project_id
77
- alias_method :id, :project_id
75
+ alias project project_id
76
+ alias id project_id
78
77
 
79
78
  ##
80
79
  # The project number.
@@ -125,15 +124,6 @@ module Google
125
124
  @gapi.quota.total_rrdata_size_per_change if @gapi.quota
126
125
  end
127
126
 
128
- ##
129
- # @private Default project.
130
- def self.default_project_id
131
- ENV["DNS_PROJECT"] ||
132
- ENV["GOOGLE_CLOUD_PROJECT"] ||
133
- ENV["GCLOUD_PROJECT"] ||
134
- Google::Cloud.env.project_id
135
- end
136
-
137
127
  ##
138
128
  # Retrieves an existing zone by name or id.
139
129
  #
@@ -156,8 +146,8 @@ module Google
156
146
  rescue Google::Cloud::NotFoundError
157
147
  nil
158
148
  end
159
- alias_method :find_zone, :zone
160
- alias_method :get_zone, :zone
149
+ alias find_zone zone
150
+ alias get_zone zone
161
151
 
162
152
  ##
163
153
  # Retrieves the list of zones belonging to the project.
@@ -192,7 +182,7 @@ module Google
192
182
  gapi = service.list_zones token: token, max: max
193
183
  Zone::List.from_gapi gapi, service, max
194
184
  end
195
- alias_method :find_zones, :zones
185
+ alias find_zones zones
196
186
 
197
187
  ##
198
188
  # Creates a new zone.
@@ -233,14 +223,14 @@ module Google
233
223
  ensure_service!
234
224
  @gapi = service.get_project
235
225
  end
236
- alias_method :refresh!, :reload!
226
+ alias refresh! reload!
237
227
 
238
228
  protected
239
229
 
240
230
  ##
241
231
  # Raise an error unless an active connection is available.
242
232
  def ensure_service!
243
- fail "Must have active connection" unless service
233
+ raise "Must have active connection" unless service
244
234
  end
245
235
  end
246
236
  end
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 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,
@@ -95,10 +95,10 @@ module Google
95
95
  # For example: ["10 mail.example.com.", "20 mail2.example.com."].
96
96
  #
97
97
  def initialize name, type, ttl, data
98
- fail ArgumentError, "name is required" unless name
99
- fail ArgumentError, "type is required" unless type
100
- fail ArgumentError, "ttl is required" unless ttl
101
- fail ArgumentError, "data is required" unless data
98
+ raise ArgumentError, "name is required" unless name
99
+ raise ArgumentError, "type is required" unless type
100
+ raise ArgumentError, "ttl is required" unless ttl
101
+ raise ArgumentError, "data is required" unless data
102
102
  @name = name.to_s
103
103
  @type = type.to_s.upcase
104
104
  @ttl = Integer(ttl)
@@ -154,11 +154,8 @@ module Google
154
154
  name == other.name && type == other.type &&
155
155
  ttl == other.ttl && data == other.data
156
156
  end
157
-
158
157
  # @private
159
- def == other
160
- self.eql? other
161
- end
158
+ alias == eql?
162
159
 
163
160
  # @private
164
161
  def <=> other
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 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,
@@ -163,7 +163,7 @@ module Google
163
163
  ##
164
164
  # Raise an error unless an active connection is available.
165
165
  def ensure_zone!
166
- fail "Must have active connection" unless @zone
166
+ raise "Must have active connection" unless @zone
167
167
  end
168
168
  end
169
169
  end
@@ -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,
@@ -137,7 +137,7 @@ module Google
137
137
  # Fully Qualified Domain Name
138
138
  def self.fqdn name, origin_dns
139
139
  name = name.to_s.strip
140
- return name if self.ip_addr? name
140
+ return name if ip_addr? name
141
141
  name = origin_dns if name.empty?
142
142
  name = origin_dns if name == "@"
143
143
  name = "#{name}.#{origin_dns}" unless name.include? "."
@@ -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,
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Dns
19
- VERSION = "0.27.0"
19
+ VERSION = "0.28.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 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,
@@ -112,7 +112,7 @@ module Google
112
112
  #
113
113
  def created_at
114
114
  Time.parse @gapi.creation_time
115
- rescue
115
+ rescue StandardError
116
116
  nil
117
117
  end
118
118
 
@@ -159,7 +159,7 @@ module Google
159
159
  # zone.clear!
160
160
  #
161
161
  def clear!
162
- non_essential = records.all.reject { |r| %w(SOA NS).include?(r.type) }
162
+ non_essential = records.all.reject { |r| %w[SOA NS].include?(r.type) }
163
163
  change = update [], non_essential
164
164
  change.wait_until_done! unless change.nil?
165
165
  end
@@ -189,8 +189,8 @@ module Google
189
189
  rescue Google::Cloud::NotFoundError
190
190
  nil
191
191
  end
192
- alias_method :find_change, :change
193
- alias_method :get_change, :change
192
+ alias find_change change
193
+ alias get_change change
194
194
 
195
195
  ##
196
196
  # Retrieves the list of changes belonging to the zone.
@@ -245,7 +245,7 @@ module Google
245
245
  order: order, sort: sort
246
246
  Change::List.from_gapi gapi, self, max, order
247
247
  end
248
- alias_method :find_changes, :changes
248
+ alias find_changes changes
249
249
 
250
250
  ##
251
251
  # Retrieves the list of records belonging to the zone. Records can be
@@ -302,7 +302,7 @@ module Google
302
302
  gapi = service.list_records id, name, type, token: token, max: max
303
303
  Record::List.from_gapi gapi, self, name, type, max
304
304
  end
305
- alias_method :find_records, :records
305
+ alias find_records records
306
306
 
307
307
  ##
308
308
  # Creates a new, unsaved Record that can be added to a Zone. See
@@ -321,7 +321,7 @@ module Google
321
321
  def record name, type, ttl, data
322
322
  Google::Cloud::Dns::Record.new fqdn(name), type, ttl, data
323
323
  end
324
- alias_method :new_record, :record
324
+ alias new_record record
325
325
 
326
326
  ##
327
327
  # Exports the zone to a local [DNS zone
@@ -396,7 +396,7 @@ module Google
396
396
  #
397
397
  def import path_or_io, only: nil, except: nil,
398
398
  skip_soa: nil, soa_serial: nil
399
- except = (Array(except).map(&:to_s).map(&:upcase) + %w(SOA NS)).uniq
399
+ except = (Array(except).map(&:to_s).map(&:upcase) + %w[SOA NS]).uniq
400
400
  importer = Google::Cloud::Dns::Importer.new self, path_or_io
401
401
  additions = importer.records only: only, except: except
402
402
  update additions, [], skip_soa: skip_soa, soa_serial: soa_serial
@@ -696,7 +696,7 @@ module Google
696
696
  ##
697
697
  # Raise an error unless an active connection is available.
698
698
  def ensure_service!
699
- fail "Must have active connection" unless service
699
+ raise "Must have active connection" unless service
700
700
  end
701
701
 
702
702
  def create_change additions, deletions
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 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,
@@ -156,7 +156,7 @@ module Google
156
156
  ##
157
157
  # Raise an error unless an active connection is available.
158
158
  def ensure_service!
159
- fail "Must have active connection" unless @service
159
+ raise "Must have active connection" unless @service
160
160
  end
161
161
  end
162
162
  end
@@ -1,10 +1,10 @@
1
- # Copyright 2015 Google Inc. All rights reserved.
1
+ # Copyright 2015 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,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-dns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.28.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-11-14 00:00:00.000000000 Z
12
+ date: 2018-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.1'
20
+ version: '1.2'
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.1'
27
+ version: '1.2'
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.17.0
34
+ version: 0.19.0
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.17.0
41
+ version: 0.19.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: googleauth
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -141,16 +141,16 @@ dependencies:
141
141
  name: rubocop
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - "<="
144
+ - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: 0.35.1
146
+ version: 0.50.0
147
147
  type: :development
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - "<="
151
+ - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: 0.35.1
153
+ version: 0.50.0
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: simplecov
156
156
  requirement: !ruby/object:Gem::Requirement
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
238
  version: '0'
239
239
  requirements: []
240
240
  rubyforge_project:
241
- rubygems_version: 2.7.2
241
+ rubygems_version: 2.7.6
242
242
  signing_key:
243
243
  specification_version: 4
244
244
  summary: API Client library for Google Cloud DNS