lib/gcloud/resource_manager/project/updater.rb in gcloud-0.6.3 vs lib/gcloud/resource_manager/project/updater.rb in gcloud-0.7.0
- old
+ new
@@ -1,6 +1,5 @@
-#--
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -11,22 +10,24 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
require "time"
require "gcloud/resource_manager/errors"
module Gcloud
module ResourceManager
class Project
##
- # = Project Updater
+ # # Project Updater
#
# This object is used by Project#update when passed a block. These methods
# are used to update the project data in a single API call.
#
+ # @example
# require "gcloud"
#
# gcloud = Gcloud.new
# resource_manager = gcloud.resource_manager
# project = resource_manager.project "tokyo-rain-123"
@@ -35,24 +36,23 @@
# p.labels["env"] = "production"
# end
#
class Updater < DelegateClass(Project)
##
- # Create an Updater object.
- def initialize project #:nodoc:
+ # @private Create an Updater object.
+ def initialize project
super project
end
##
# Updates the user-assigned name of the project. This field is optional
# and can remain unset.
#
# Allowed characters are: lowercase and uppercase letters, numbers,
# hyphen, single-quote, double-quote, space, and exclamation point.
#
- # === Example
- #
+ # @example
# require "gcloud"
#
# gcloud = Gcloud.new
# resource_manager = gcloud.resource_manager
# project = resource_manager.project "tokyo-rain-123"
@@ -73,14 +73,13 @@
#
# Label values must be between 0 and 63 characters long and must conform
# to the regular expression <code>([a-z]([-a-z0-9]*[a-z0-9])?)?</code>.
#
# No more than 256 labels can be associated with a given resource.
- # (+Hash+)
+ # (`Hash`)
#
- # === Example
- #
+ # @example
# require "gcloud"
#
# gcloud = Gcloud.new
# resource_manager = gcloud.resource_manager
# project = resource_manager.project "tokyo-rain-123"
@@ -101,14 +100,13 @@
#
# Label values must be between 0 and 63 characters long and must conform
# to the regular expression <code>([a-z]([-a-z0-9]*[a-z0-9])?)?</code>.
#
# No more than 256 labels can be associated with a given resource.
- # (+Hash+)
+ # (`Hash`)
#
- # === Example
- #
+ # @example
# require "gcloud"
#
# gcloud = Gcloud.new
# resource_manager = gcloud.resource_manager
# project = resource_manager.project "tokyo-rain-123"
@@ -119,11 +117,11 @@
def labels= new_labels
gapi["labels"] = new_labels
end
##
- # Create an Updater object.
- def self.from_project project #:nodoc:
+ # @private Create an Updater object.
+ def self.from_project project
dupe_gapi = project.gapi.dup
dupe_gapi = dupe_gapi.to_hash if dupe_gapi.respond_to? :to_hash
if dupe_gapi["labels"].respond_to? :to_hash
dupe_gapi["labels"] = dupe_gapi["labels"].to_hash
end