gcloud 0.6.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +8 -8
  2. data/AUTHENTICATION.md +13 -9
  3. data/CHANGELOG.md +8 -3
  4. data/OVERVIEW.md +46 -8
  5. data/lib/gcloud.rb +123 -117
  6. data/lib/gcloud/backoff.rb +43 -15
  7. data/lib/gcloud/bigquery.rb +211 -195
  8. data/lib/gcloud/bigquery/connection.rb +9 -9
  9. data/lib/gcloud/bigquery/copy_job.rb +15 -16
  10. data/lib/gcloud/bigquery/credentials.rb +3 -3
  11. data/lib/gcloud/bigquery/data.rb +12 -11
  12. data/lib/gcloud/bigquery/dataset.rb +162 -216
  13. data/lib/gcloud/bigquery/dataset/access.rb +59 -43
  14. data/lib/gcloud/bigquery/dataset/list.rb +3 -3
  15. data/lib/gcloud/bigquery/errors.rb +9 -5
  16. data/lib/gcloud/bigquery/extract_job.rb +18 -18
  17. data/lib/gcloud/bigquery/insert_response.rb +7 -4
  18. data/lib/gcloud/bigquery/job.rb +48 -44
  19. data/lib/gcloud/bigquery/job/list.rb +3 -3
  20. data/lib/gcloud/bigquery/load_job.rb +24 -25
  21. data/lib/gcloud/bigquery/project.rb +145 -204
  22. data/lib/gcloud/bigquery/query_data.rb +10 -9
  23. data/lib/gcloud/bigquery/query_job.rb +23 -32
  24. data/lib/gcloud/bigquery/table.rb +238 -280
  25. data/lib/gcloud/bigquery/table/list.rb +3 -3
  26. data/lib/gcloud/bigquery/table/schema.rb +79 -87
  27. data/lib/gcloud/bigquery/view.rb +69 -82
  28. data/lib/gcloud/credentials.rb +3 -9
  29. data/lib/gcloud/datastore.rb +194 -170
  30. data/lib/gcloud/datastore/connection.rb +12 -8
  31. data/lib/gcloud/datastore/credentials.rb +6 -4
  32. data/lib/gcloud/datastore/dataset.rb +74 -141
  33. data/lib/gcloud/datastore/dataset/lookup_results.rb +6 -4
  34. data/lib/gcloud/datastore/dataset/query_results.rb +6 -4
  35. data/lib/gcloud/datastore/entity.rb +81 -76
  36. data/lib/gcloud/datastore/errors.rb +10 -8
  37. data/lib/gcloud/datastore/key.rb +41 -77
  38. data/lib/gcloud/datastore/properties.rb +3 -3
  39. data/lib/gcloud/datastore/proto.rb +7 -4
  40. data/lib/gcloud/datastore/query.rb +26 -3
  41. data/lib/gcloud/datastore/transaction.rb +12 -8
  42. data/lib/gcloud/dns.rb +180 -152
  43. data/lib/gcloud/dns/change.rb +16 -16
  44. data/lib/gcloud/dns/change/list.rb +3 -3
  45. data/lib/gcloud/dns/connection.rb +9 -10
  46. data/lib/gcloud/dns/credentials.rb +3 -3
  47. data/lib/gcloud/dns/errors.rb +9 -5
  48. data/lib/gcloud/dns/importer.rb +17 -23
  49. data/lib/gcloud/dns/project.rb +42 -64
  50. data/lib/gcloud/dns/record.rb +58 -46
  51. data/lib/gcloud/dns/record/list.rb +6 -7
  52. data/lib/gcloud/dns/zone.rb +198 -289
  53. data/lib/gcloud/dns/zone/list.rb +3 -3
  54. data/lib/gcloud/dns/zone/transaction.rb +56 -72
  55. data/lib/gcloud/errors.rb +174 -3
  56. data/lib/gcloud/gce.rb +3 -4
  57. data/lib/gcloud/grpc_utils.rb +76 -0
  58. data/lib/gcloud/logging.rb +308 -0
  59. data/lib/gcloud/logging/credentials.rb +29 -0
  60. data/lib/gcloud/logging/entry.rb +303 -0
  61. data/lib/gcloud/logging/entry/http_request.rb +141 -0
  62. data/lib/gcloud/logging/entry/list.rb +111 -0
  63. data/lib/gcloud/logging/entry/operation.rb +90 -0
  64. data/lib/gcloud/logging/logger.rb +307 -0
  65. data/lib/gcloud/logging/metric.rb +175 -0
  66. data/lib/gcloud/logging/metric/list.rb +98 -0
  67. data/lib/gcloud/logging/project.rb +650 -0
  68. data/lib/gcloud/logging/resource.rb +95 -0
  69. data/lib/gcloud/logging/resource_descriptor.rb +140 -0
  70. data/lib/gcloud/logging/resource_descriptor/list.rb +78 -0
  71. data/lib/gcloud/logging/service.rb +258 -0
  72. data/lib/gcloud/logging/sink.rb +233 -0
  73. data/lib/gcloud/logging/sink/list.rb +97 -0
  74. data/lib/gcloud/pubsub.rb +241 -199
  75. data/lib/gcloud/pubsub/credentials.rb +3 -3
  76. data/lib/gcloud/pubsub/message.rb +26 -20
  77. data/lib/gcloud/pubsub/project.rb +166 -233
  78. data/lib/gcloud/pubsub/received_message.rb +28 -38
  79. data/lib/gcloud/pubsub/service.rb +323 -0
  80. data/lib/gcloud/pubsub/subscription.rb +172 -242
  81. data/lib/gcloud/pubsub/subscription/list.rb +11 -9
  82. data/lib/gcloud/pubsub/topic.rb +152 -271
  83. data/lib/gcloud/pubsub/topic/batch.rb +66 -0
  84. data/lib/gcloud/pubsub/topic/list.rb +9 -7
  85. data/lib/gcloud/resource_manager.rb +158 -138
  86. data/lib/gcloud/resource_manager/connection.rb +6 -5
  87. data/lib/gcloud/resource_manager/credentials.rb +3 -3
  88. data/lib/gcloud/resource_manager/errors.rb +9 -5
  89. data/lib/gcloud/resource_manager/manager.rb +54 -86
  90. data/lib/gcloud/resource_manager/project.rb +69 -88
  91. data/lib/gcloud/resource_manager/project/list.rb +4 -5
  92. data/lib/gcloud/resource_manager/project/updater.rb +12 -14
  93. data/lib/gcloud/search.rb +158 -135
  94. data/lib/gcloud/search/api_client.rb +7 -7
  95. data/lib/gcloud/search/connection.rb +8 -8
  96. data/lib/gcloud/search/credentials.rb +3 -3
  97. data/lib/gcloud/search/document.rb +64 -87
  98. data/lib/gcloud/search/document/list.rb +5 -5
  99. data/lib/gcloud/search/errors.rb +9 -5
  100. data/lib/gcloud/search/field_value.rb +32 -38
  101. data/lib/gcloud/search/field_values.rb +50 -80
  102. data/lib/gcloud/search/fields.rb +44 -65
  103. data/lib/gcloud/search/index.rb +163 -204
  104. data/lib/gcloud/search/index/list.rb +5 -5
  105. data/lib/gcloud/search/project.rb +31 -47
  106. data/lib/gcloud/search/result.rb +27 -31
  107. data/lib/gcloud/search/result/list.rb +6 -6
  108. data/lib/gcloud/storage.rb +224 -190
  109. data/lib/gcloud/storage/bucket.rb +202 -227
  110. data/lib/gcloud/storage/bucket/acl.rb +83 -170
  111. data/lib/gcloud/storage/bucket/cors.rb +31 -34
  112. data/lib/gcloud/storage/bucket/list.rb +3 -3
  113. data/lib/gcloud/storage/connection.rb +11 -7
  114. data/lib/gcloud/storage/credentials.rb +3 -3
  115. data/lib/gcloud/storage/errors.rb +11 -8
  116. data/lib/gcloud/storage/file.rb +129 -171
  117. data/lib/gcloud/storage/file/acl.rb +51 -99
  118. data/lib/gcloud/storage/file/list.rb +3 -3
  119. data/lib/gcloud/storage/file/verifier.rb +3 -2
  120. data/lib/gcloud/storage/project.rb +111 -132
  121. data/lib/gcloud/upload.rb +4 -7
  122. data/lib/gcloud/version.rb +2 -4
  123. data/lib/google/api/annotations.rb +14 -0
  124. data/lib/google/api/http.rb +30 -0
  125. data/lib/google/api/label.rb +24 -0
  126. data/lib/google/api/monitored_resource.rb +25 -0
  127. data/lib/google/datastore/v1beta3/datastore.rb +115 -0
  128. data/lib/google/datastore/v1beta3/datastore_services.rb +33 -0
  129. data/lib/google/datastore/v1beta3/entity.rb +63 -0
  130. data/lib/google/datastore/v1beta3/query.rb +128 -0
  131. data/lib/google/devtools/cloudtrace/v1/trace.rb +78 -0
  132. data/lib/google/devtools/cloudtrace/v1/trace_services.rb +32 -0
  133. data/lib/google/example/library/v1/library.rb +91 -0
  134. data/lib/google/example/library/v1/library_services.rb +40 -0
  135. data/lib/google/iam/v1/iam_policy.rb +33 -0
  136. data/lib/google/iam/v1/iam_policy_services.rb +30 -0
  137. data/lib/google/iam/v1/policy.rb +25 -0
  138. data/lib/google/logging/type/http_request.rb +28 -0
  139. data/lib/google/logging/type/log_severity.rb +27 -0
  140. data/lib/google/logging/v2/log_entry.rb +44 -0
  141. data/lib/google/logging/v2/logging.rb +56 -0
  142. data/lib/google/logging/v2/logging_config.rb +59 -0
  143. data/lib/google/logging/v2/logging_config_services.rb +32 -0
  144. data/lib/google/logging/v2/logging_metrics.rb +51 -0
  145. data/lib/google/logging/v2/logging_metrics_services.rb +32 -0
  146. data/lib/google/logging/v2/logging_services.rb +31 -0
  147. data/lib/google/longrunning/operations.rb +50 -0
  148. data/lib/google/longrunning/operations_services.rb +29 -0
  149. data/lib/google/protobuf/any.rb +17 -0
  150. data/lib/google/protobuf/api.rb +31 -0
  151. data/lib/google/protobuf/descriptor.rb +0 -0
  152. data/lib/google/protobuf/duration.rb +17 -0
  153. data/lib/google/protobuf/empty.rb +15 -0
  154. data/lib/google/protobuf/field_mask.rb +16 -0
  155. data/lib/google/protobuf/source_context.rb +16 -0
  156. data/lib/google/protobuf/struct.rb +35 -0
  157. data/lib/google/protobuf/timestamp.rb +17 -0
  158. data/lib/google/protobuf/type.rb +79 -0
  159. data/lib/google/protobuf/wrappers.rb +48 -0
  160. data/lib/google/pubsub/v1/pubsub.rb +129 -0
  161. data/lib/google/pubsub/v1/pubsub_services.rb +56 -0
  162. data/lib/google/pubsub/v1beta2/pubsub.rb +126 -0
  163. data/lib/google/pubsub/v1beta2/pubsub_services.rb +56 -0
  164. data/lib/google/rpc/code.rb +32 -0
  165. data/lib/google/rpc/error_details.rb +61 -0
  166. data/lib/google/rpc/status.rb +19 -0
  167. data/lib/google/type/color.rb +20 -0
  168. data/lib/google/type/date.rb +18 -0
  169. data/lib/google/type/dayofweek.rb +23 -0
  170. data/lib/google/type/latlng.rb +17 -0
  171. data/lib/google/type/money.rb +18 -0
  172. data/lib/google/type/timeofday.rb +19 -0
  173. metadata +101 -4
  174. data/lib/gcloud/pubsub/connection.rb +0 -295
  175. data/lib/gcloud/pubsub/errors.rb +0 -93
@@ -1,4 +1,3 @@
1
- #--
2
1
  # Copyright 2014 Google Inc. All rights reserved.
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,6 +12,7 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
15
+
16
16
  require "delegate"
17
17
 
18
18
  module Gcloud
@@ -24,14 +24,16 @@ module Gcloud
24
24
  # contains the entities as well as the Keys that were deferred from
25
25
  # the results and the Entities that were missing in the dataset.
26
26
  #
27
+ # Please be cautious when treating the QueryResults as an Array.
28
+ # Many common Array methods will return a new Array instance.
29
+ #
30
+ # @example
27
31
  # entities = dataset.find_all key1, key2, key3
28
32
  # entities.size #=> 3
29
33
  # entities.deferred #=> []
30
34
  # entities.missing #=> []
31
35
  #
32
- # Please be cautious when treating the LookupResults as an Array. Many
33
- # common Array methods will return a new Array instance.
34
- #
36
+ # @example Caution, many Array methods will return a new Array instance:
35
37
  # entities = dataset.find_all key1, key2, key3
36
38
  # entities.size #=> 3
37
39
  # entities.deferred #=> []
@@ -1,4 +1,3 @@
1
- #--
2
1
  # Copyright 2014 Google Inc. All rights reserved.
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,6 +12,7 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
15
+
16
16
  require "delegate"
17
17
 
18
18
  module Gcloud
@@ -24,13 +24,15 @@ module Gcloud
24
24
  # the Entities from the query as well as the query's cursor and
25
25
  # more_results value.
26
26
  #
27
+ # Please be cautious when treating the QueryResults as an Array.
28
+ # Many common Array methods will return a new Array instance.
29
+ #
30
+ # @example
27
31
  # entities = dataset.run query
28
32
  # entities.size #=> 3
29
33
  # entities.cursor #=> "c3VwZXJhd2Vzb21lIQ"
30
34
  #
31
- # Please be cautious when treating the QueryResults as an Array.
32
- # Many common Array methods will return a new Array instance.
33
- #
35
+ # @example Caution, many Array methods will return a new Array instance:
34
36
  # entities = dataset.run query
35
37
  # entities.size #=> 3
36
38
  # entities.end_cursor #=> "c3VwZXJhd2Vzb21lIQ"
@@ -1,4 +1,3 @@
1
- #--
2
1
  # Copyright 2014 Google Inc. All rights reserved.
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,6 +12,7 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
15
+
16
16
  require "gcloud/datastore/key"
17
17
  require "gcloud/datastore/properties"
18
18
  require "gcloud/datastore/proto"
@@ -20,11 +20,12 @@ require "gcloud/datastore/proto"
20
20
  module Gcloud
21
21
  module Datastore
22
22
  ##
23
- # = Entity
23
+ # # Entity
24
24
  #
25
25
  # Entity represents a Datastore record.
26
- # Every Entity has a Key, and a list of properties.
26
+ # Every Entity has a {Key}, and a list of properties.
27
27
  #
28
+ # @example
28
29
  # entity = Gcloud::Datastore::Entity.new
29
30
  # entity.key = Gcloud::Datastore::Key.new "User", "heidi@example.com"
30
31
  # entity["name"] = "Heidi Henderson"
@@ -45,19 +46,11 @@ module Gcloud
45
46
  ##
46
47
  # Retrieve a property value by providing the name.
47
48
  #
48
- # === Parameters
49
- #
50
- # +prop_name+::
51
- # The name of the property. (+String+ or +Symbol+)
52
- #
53
- # === Returns
54
- #
55
- # Object if the property exists, +nil+ if the property doesn't exist
49
+ # @param [String, Symbol] prop_name The name of the property.
56
50
  #
57
- # === Example
58
- #
59
- # Properties can be retrieved with a string name:
51
+ # @return [Object, nil] Returns `nil` if the property doesn't exist
60
52
  #
53
+ # @example Properties can be retrieved with a string name:
61
54
  # require "gcloud"
62
55
  #
63
56
  # gcloud = Gcloud.new
@@ -65,8 +58,7 @@ module Gcloud
65
58
  # user = dataset.find "User", "heidi@example.com"
66
59
  # user["name"] #=> "Heidi Henderson"
67
60
  #
68
- # Or with a symbol name:
69
- #
61
+ # @example Or with a symbol name:
70
62
  # require "gcloud"
71
63
  #
72
64
  # gcloud = Gcloud.new
@@ -81,17 +73,10 @@ module Gcloud
81
73
  ##
82
74
  # Set a property value by name.
83
75
  #
84
- # === Parameters
85
- #
86
- # +prop_name+::
87
- # The name of the property. (+String+ or +Symbol+)
88
- # +prop_value+::
89
- # The value of the property. (+Object+)
90
- #
91
- # === Example
92
- #
93
- # Properties can be set with a string name:
76
+ # @param [String, Symbol] prop_name The name of the property.
77
+ # @param [Object] prop_value The value of the property.
94
78
  #
79
+ # @example Properties can be set with a string name:
95
80
  # require "gcloud"
96
81
  #
97
82
  # gcloud = Gcloud.new
@@ -99,8 +84,7 @@ module Gcloud
99
84
  # user = dataset.find "User", "heidi@example.com"
100
85
  # user["name"] = "Heidi H. Henderson"
101
86
  #
102
- # Or with a symbol name:
103
- #
87
+ # @example Or with a symbol name:
104
88
  # require "gcloud"
105
89
  #
106
90
  # gcloud = Gcloud.new
@@ -116,12 +100,9 @@ module Gcloud
116
100
  # Retrieve properties in a hash-like structure.
117
101
  # Properties can be accessed or set by string or symbol.
118
102
  #
119
- # === Returns
120
- #
121
- # Gcloud::Datastore::Properties
122
- #
123
- # === Example
103
+ # @return [Gcloud::Datastore::Properties]
124
104
  #
105
+ # @example
125
106
  # entity.properties[:name] = "Heidi H. Henderson"
126
107
  # entity.properties["name"] #=> "Heidi H. Henderson"
127
108
  #
@@ -129,19 +110,16 @@ module Gcloud
129
110
  # puts "property #{name} has a value of #{value}"
130
111
  # end
131
112
  #
132
- # A property's existance can be determined by calling exist?
133
- #
113
+ # @example A property's existence can be determined by calling `exist?`:
134
114
  # entity.properties.exist? :name #=> true
135
115
  # entity.properties.exist? "name" #=> true
136
116
  # entity.properties.exist? :expiration #=> false
137
117
  #
138
- # A property can be removed from the entity.
139
- #
118
+ # @example A property can be removed from the entity:
140
119
  # entity.properties.delete :name
141
120
  # entity.save
142
121
  #
143
- # The properties can be converted to a hash:
144
- #
122
+ # @example The properties can be converted to a hash:
145
123
  # prop_hash = entity.properties.to_h
146
124
  #
147
125
  attr_reader :properties
@@ -149,10 +127,10 @@ module Gcloud
149
127
  ##
150
128
  # Sets the Key that identifies the entity.
151
129
  #
152
- # === Example
153
- #
154
- # The Key can be set before the entity is saved.
130
+ # Once the entity is saved, the key is frozen and immutable. Trying to set
131
+ # a key when immutable will raise a `RuntimeError`.
155
132
  #
133
+ # @example The Key can be set before the entity is saved:
156
134
  # require "gcloud"
157
135
  #
158
136
  # gcloud = Gcloud.new
@@ -161,9 +139,7 @@ module Gcloud
161
139
  # entity.key = Gcloud::Datastore::Key.new "User"
162
140
  # dataset.save entity
163
141
  #
164
- # Once the entity is saved, the key is frozen and immutable.
165
- # Trying to set a key when immutable will raise a +RuntimeError+.
166
- #
142
+ # @example Once the entity is saved, the key is frozen and immutable:
167
143
  # require "gcloud"
168
144
  #
169
145
  # gcloud = Gcloud.new
@@ -182,8 +158,7 @@ module Gcloud
182
158
  ##
183
159
  # Indicates if the record is persisted. Default is false.
184
160
  #
185
- # === Example
186
- #
161
+ # @example
187
162
  # require "gcloud"
188
163
  #
189
164
  # gcloud = Gcloud.new
@@ -201,17 +176,30 @@ module Gcloud
201
176
 
202
177
  ##
203
178
  # Indicates if a property is flagged to be excluded from the
204
- # Datastore indexes. The default value is false.
179
+ # Datastore indexes. The default value is `false`. This is another way of
180
+ # saying that values are indexed by default.
205
181
  #
206
- # Single property values will return a single flag setting.
182
+ # If the property is multi-valued, each value in the list can be managed
183
+ # separately for exclusion from indexing. Calling this method for a
184
+ # multi-valued property will return an array that contains the `excluded`
185
+ # boolean value for each corresponding value in the property. For example,
186
+ # if a multi-valued property contains `["a", "b"]`, and only the value
187
+ # `"b"` is indexed (meaning that `"a"`' is excluded), the return value for
188
+ # this method will be `[true, false]`.
207
189
  #
190
+ # @see https://cloud.google.com/datastore/docs/concepts/indexes#Datastore_Unindexed_properties
191
+ # Unindexed properties
192
+ #
193
+ # @example Single property values will return a single flag setting:
208
194
  # entity["age"] = 21
209
195
  # entity.exclude_from_indexes? "age" #=> false
210
196
  #
211
- # Array property values will return an array of flag settings.
212
- #
197
+ # @example A multi-valued property will return an array of flag settings:
213
198
  # entity["tags"] = ["ruby", "code"]
214
- # entity.exclude_from_indexes? "tags" #=> [false, false]
199
+ # entity.exclude_from_indexes! "tags", [true, false]
200
+ #
201
+ # entity.exclude_from_indexes? "tags" #=> [true, false]
202
+ #
215
203
  def exclude_from_indexes? name
216
204
  value = self[name]
217
205
  flag = @_exclude_indexes[name.to_s]
@@ -219,31 +207,50 @@ module Gcloud
219
207
  end
220
208
 
221
209
  ##
222
- # Flag a property to be excluded from the Datastore indexes.
223
- # Setting true will exclude the property from the indexes.
224
- # Setting false will include the property on any applicable indexes.
225
- # The default value for the flag is false.
226
- #
210
+ # Sets whether a property should be excluded from the Datastore indexes.
211
+ # Setting `true` will exclude the property from the indexes.
212
+ # Setting `false` will include the property on any applicable indexes.
213
+ # The default value is `false`. This is another way of saying that values
214
+ # are indexed by default.
215
+ #
216
+ # If the property is multi-valued, each value in the list can be managed
217
+ # separately for exclusion from indexing. When you call this method for a
218
+ # multi-valued property, you can pass either a single boolean argument to
219
+ # be applied to all of the values, or an array that contains the boolean
220
+ # argument for each corresponding value in the property. For example,
221
+ # if a multi-valued property contains `["a", "b"]`, and only the value
222
+ # `"b"` should be indexed (meaning that `"a"`' should be excluded), you
223
+ # should pass the array: `[true, false]`.
224
+ #
225
+ # @param [String] name the property name
226
+ # @param [Boolean, Array<Boolean>, nil] flag whether the value or values
227
+ # should be excluded from indexing
228
+ # @yield [value] a block yielding each value of the property
229
+ # @yieldparam [Object] value a value of the property
230
+ # @yieldreturn [Boolean] `true` if the value should be excluded from
231
+ # indexing
232
+ #
233
+ # @see https://cloud.google.com/datastore/docs/concepts/indexes#Datastore_Unindexed_properties
234
+ # Unindexed properties
235
+ #
236
+ # @example
227
237
  # entity["age"] = 21
228
238
  # entity.exclude_from_indexes! "age", true
229
239
  #
230
- # Properties that are arrays can be given multiple exclude flags.
231
- #
240
+ # @example Multi-valued properties can be given multiple exclude flags:
232
241
  # entity["tags"] = ["ruby", "code"]
233
242
  # entity.exclude_from_indexes! "tags", [true, false]
234
243
  #
235
- # Or, array properties can be given a single flag that will be applied
236
- # to each item in the array.
237
- #
244
+ # @example Or, a single flag can be applied to all values in a property:
238
245
  # entity["tags"] = ["ruby", "code"]
239
246
  # entity.exclude_from_indexes! "tags", true
240
247
  #
241
- # Flags can also be set with a block for either single and array values.
242
- #
248
+ # @example Flags can also be set with a block:
243
249
  # entity["age"] = 21
244
250
  # entity.exclude_from_indexes! "age" do |age|
245
251
  # age > 18
246
252
  # end
253
+ #
247
254
  def exclude_from_indexes! name, flag = nil, &block
248
255
  name = name.to_s
249
256
  flag = block if block_given?
@@ -255,9 +262,8 @@ module Gcloud
255
262
  end
256
263
 
257
264
  ##
258
- # Convert the Entity to a protocol buffer object.
259
- # This is not part of the public API.
260
- def to_proto #:nodoc:
265
+ # @private Convert the Entity to a protocol buffer object.
266
+ def to_proto
261
267
  entity = Proto::Entity.new.tap do |e|
262
268
  e.key = @key.to_proto
263
269
  e.property = Proto.to_proto_properties @properties.to_h
@@ -267,9 +273,8 @@ module Gcloud
267
273
  end
268
274
 
269
275
  ##
270
- # Create a new Entity from a protocol buffer object.
271
- # This is not part of the public API.
272
- def self.from_proto proto #:nodoc:
276
+ # @private Create a new Entity from a protocol buffer object.
277
+ def self.from_proto proto
273
278
  entity = Entity.new
274
279
  entity.key = Key.from_proto proto.key
275
280
  Array(proto.property).each do |p|
@@ -285,11 +290,11 @@ module Gcloud
285
290
  # Disabled rubocop because this is intentionally complex.
286
291
 
287
292
  ##
288
- # Map the exclude flag object to value.
293
+ # @private Map the exclude flag object to value.
289
294
  # The flag object can be a boolean, Proc, or Array.
290
295
  # Procs will be called and passed in the value.
291
296
  # This will return an array of flags for an array value.
292
- def map_exclude_flag_to_value flag, value #:nodoc:
297
+ def map_exclude_flag_to_value flag, value
293
298
  if value.is_a? Array
294
299
  if flag.is_a? Proc
295
300
  value.map { |v| !!flag.call(v) }
@@ -310,8 +315,8 @@ module Gcloud
310
315
  end
311
316
 
312
317
  ##
313
- # Update the exclude data after a new object is created.
314
- def update_exclude_indexes! entity #:nodoc:
318
+ # @private Update the exclude data after a new object is created.
319
+ def update_exclude_indexes! entity
315
320
  @_exclude_indexes = {}
316
321
  Array(entity.property).each do |property|
317
322
  @_exclude_indexes[property.name] = !property.value.indexed
@@ -323,8 +328,8 @@ module Gcloud
323
328
  end
324
329
 
325
330
  ##
326
- # Update the indexed values before the object is saved.
327
- def update_properties_indexed! entity #:nodoc:
331
+ # @private Update the indexed values before the object is saved.
332
+ def update_properties_indexed! entity
328
333
  Array(entity.property).each do |property|
329
334
  excluded = exclude_from_indexes? property.name
330
335
  if excluded.is_a? Array
@@ -1,4 +1,3 @@
1
- #--
2
1
  # Copyright 2014 Google Inc. All rights reserved.
3
2
  #
4
3
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,26 +12,27 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
15
+
16
16
  require "gcloud/errors"
17
17
 
18
18
  module Gcloud
19
19
  module Datastore
20
20
  ##
21
- # = Datastore Error
21
+ # # Datastore Error
22
22
  #
23
23
  # Base Datastore exception class.
24
24
  class Error < Gcloud::Error
25
25
  end
26
26
 
27
27
  ##
28
- # = KeyfileError
28
+ # # KeyfileError
29
29
  #
30
30
  # Raised when a keyfile is not correct.
31
31
  class KeyfileError < Gcloud::Datastore::Error
32
32
  end
33
33
 
34
34
  ##
35
- # = ApiError
35
+ # # ApiError
36
36
  #
37
37
  # Raised when an API call is not successful.
38
38
  class ApiError < Gcloud::Datastore::Error
@@ -44,7 +44,8 @@ module Gcloud
44
44
  # The response object of the failed HTTP request.
45
45
  attr_reader :response
46
46
 
47
- def initialize method, response = nil #:nodoc:
47
+ # @private
48
+ def initialize method, response = nil
48
49
  super("API call to #{method} was not successful")
49
50
  @method = method
50
51
  @response = response
@@ -52,14 +53,14 @@ module Gcloud
52
53
  end
53
54
 
54
55
  ##
55
- # = PropertyError
56
+ # # PropertyError
56
57
  #
57
58
  # Raised when a property is not correct.
58
59
  class PropertyError < Gcloud::Datastore::Error
59
60
  end
60
61
 
61
62
  ##
62
- # = TransactionError
63
+ # # TransactionError
63
64
  #
64
65
  # General error for Transaction problems.
65
66
  class TransactionError < Gcloud::Datastore::Error
@@ -67,7 +68,8 @@ module Gcloud
67
68
  # An error that occurred within the transaction. (optional)
68
69
  attr_reader :inner
69
70
 
70
- def initialize message, inner = nil #:nodoc:
71
+ # @private
72
+ def initialize message, inner = nil
71
73
  super(message)
72
74
  @inner = inner
73
75
  end