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 2015 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/search/document"
17
17
  require "gcloud/search/index/list"
18
18
  require "gcloud/search/result"
@@ -20,17 +20,20 @@ require "gcloud/search/result"
20
20
  module Gcloud
21
21
  module Search
22
22
  ##
23
- # = Index
23
+ # # Index
24
24
  #
25
- # An index manages Document instances for retrieval. Indexes cannot be
25
+ # An index manages {Document} instances for retrieval. Indexes cannot be
26
26
  # created, updated, or deleted directly on the server: They are derived from
27
27
  # the documents that reference them. You can manage groups of documents by
28
28
  # putting them into separate indexes.
29
29
  #
30
- # With an index, you can retrieve documents with #find and #documents;
31
- # manage them with #document, #save, and #remove; and perform searches over
32
- # their fields with #search.
30
+ # With an index, you can retrieve documents with
31
+ # {Gcloud::Search::Index#find} and {Gcloud::Search::Index#documents}; manage
32
+ # them with {Gcloud::Search::Index#document}, {Gcloud::Search::Index#save},
33
+ # and {Gcloud::Search::Index#remove}; and perform searches over their fields
34
+ # with {Gcloud::Search::Index#search}.
33
35
  #
36
+ # @example
34
37
  # require "gcloud"
35
38
  #
36
39
  # gcloud = Gcloud.new
@@ -42,22 +45,22 @@ module Gcloud
42
45
  # puts result.doc_id
43
46
  # end
44
47
  #
45
- # For more information, see {Documents and
46
- # Indexes}[https://cloud.google.com/search/documents_indexes].
48
+ # @see https://cloud.google.com/search/documents_indexes Documents and
49
+ # Indexes
47
50
  #
48
51
  class Index
49
52
  ##
50
- # The Connection object.
51
- attr_accessor :connection #:nodoc:
53
+ # @private The Connection object.
54
+ attr_accessor :connection
52
55
 
53
56
  ##
54
- # The raw data object.
55
- attr_accessor :raw #:nodoc:
57
+ # @private The raw data object.
58
+ attr_accessor :raw
56
59
 
57
60
  ##
58
- # Creates a new Index instance.
61
+ # @private Creates a new Index instance.
59
62
  #
60
- def initialize #:nodoc:
63
+ def initialize
61
64
  @connection = nil
62
65
  @raw = nil
63
66
  end
@@ -74,48 +77,54 @@ module Gcloud
74
77
  end
75
78
 
76
79
  ##
77
- # The names of fields in which TEXT values are stored. See {Index schemas
78
- # }[https://cloud.google.com/search/documents_indexes#index_schemas].
80
+ # The names of fields in which TEXT values are stored.
81
+ # @see https://cloud.google.com/search/documents_indexes#index_schemas
82
+ # Index schemas
79
83
  def text_fields
80
84
  return @raw["indexedField"]["textFields"] if @raw["indexedField"]
81
85
  []
82
86
  end
83
87
 
84
88
  ##
85
- # The names of fields in which HTML values are stored. See {Index schemas
86
- # }[https://cloud.google.com/search/documents_indexes#index_schemas].
89
+ # The names of fields in which HTML values are stored.
90
+ # @see https://cloud.google.com/search/documents_indexes#index_schemas
91
+ # Index schemas
87
92
  def html_fields
88
93
  return @raw["indexedField"]["htmlFields"] if @raw["indexedField"]
89
94
  []
90
95
  end
91
96
 
92
97
  ##
93
- # The names of fields in which ATOM values are stored. See {Index schemas
94
- # }[https://cloud.google.com/search/documents_indexes#index_schemas].
98
+ # The names of fields in which ATOM values are stored.
99
+ # @see https://cloud.google.com/search/documents_indexes#index_schemas
100
+ # Index schemas
95
101
  def atom_fields
96
102
  return @raw["indexedField"]["atomFields"] if @raw["indexedField"]
97
103
  []
98
104
  end
99
105
 
100
106
  ##
101
- # The names of fields in which DATE values are stored. See {Index schemas
102
- # }[https://cloud.google.com/search/documents_indexes#index_schemas].
107
+ # The names of fields in which DATE values are stored.
108
+ # @see https://cloud.google.com/search/documents_indexes#index_schemas
109
+ # Index schemas
103
110
  def datetime_fields
104
111
  return @raw["indexedField"]["dateFields"] if @raw["indexedField"]
105
112
  []
106
113
  end
107
114
 
108
115
  ##
109
- # The names of fields in which NUMBER values are stored. See {Indexschemas
110
- # }[https://cloud.google.com/search/documents_indexes#index_schemas].
116
+ # The names of fields in which NUMBER values are stored.
117
+ # @see https://cloud.google.com/search/documents_indexes#index_schemas
118
+ # Index schemas
111
119
  def number_fields
112
120
  return @raw["indexedField"]["numberFields"] if @raw["indexedField"]
113
121
  []
114
122
  end
115
123
 
116
124
  ##
117
- # The names of fields in which GEO values are stored. See {Index
118
- # }[https://cloud.google.com/search/documents_indexes#index_schemas].
125
+ # The names of fields in which GEO values are stored.
126
+ # @see https://cloud.google.com/search/documents_indexes#index_schemas
127
+ # Index schemas
119
128
  def geo_fields
120
129
  return @raw["indexedField"]["geoFields"] if @raw["indexedField"]
121
130
  []
@@ -144,17 +153,12 @@ module Gcloud
144
153
  ##
145
154
  # Retrieves an existing document by id.
146
155
  #
147
- # === Parameters
148
- #
149
- # +doc_id+::
150
- # The id of a document or a Document instance. (+String+ or Document)
151
- #
152
- # === Returns
153
- #
154
- # Gcloud::Search::Document or +nil+ if the document does not exist
155
- #
156
- # === Example
156
+ # @param [String, Gcloud::Search::Document] doc_id The id of a document or
157
+ # a Document instance.
158
+ # @return [Gcloud::Search::Document, nil] Returns `nil` if the document
159
+ # does not exist
157
160
  #
161
+ # @example
158
162
  # require "gcloud"
159
163
  #
160
164
  # gcloud = Gcloud.new
@@ -179,36 +183,30 @@ module Gcloud
179
183
 
180
184
  ##
181
185
  # Helper for creating a new Document instance. The returned instance is
182
- # local: It is either not yet saved to the service (see #save), or if it
183
- # has been given the id of an existing document, it is not yet populated
184
- # with the document's data (see #find).
185
- #
186
- # === Parameters
187
- #
188
- # +doc_id+::
189
- # The unique identifier of the new document. This is optional. When the
190
- # document is saved, this value must contain only visible, printable
191
- # ASCII characters (ASCII codes 33 through 126 inclusive) and be no
192
- # longer than 500 characters. It cannot begin with an exclamation point
193
- # (<code>!</code>), and it cannot begin and end with double underscores
194
- # (<code>__</code>). (+String+)
195
- # +rank+::
196
- # The rank of the new document. This is optional. A positive integer
197
- # which determines the default ordering of documents returned from a
198
- # search. It is a bad idea to assign the same rank to many documents,
199
- # and the same rank should never be assigned to more than 10,000
200
- # documents. By default (when it is not specified or set to 0), it is
201
- # set at the time the document is saved to the number of seconds since
202
- # January 1, 2011. The rank can be used in the +expressions+, +order+,
203
- # and +fields+ options in #search, where it should referenced as
204
- # +rank+. (+Integer+)
205
- #
206
- # === Returns
207
- #
208
- # Gcloud::Search::Document
209
- #
210
- # === Example
211
- #
186
+ # local: It is either not yet saved to the service (see
187
+ # {Gcloud::Search::Index#save}), or if it has been given the id of an
188
+ # existing document, it is not yet populated with the document's data (see
189
+ # {Gcloud::Search::Index#find}).
190
+ #
191
+ # @param [String, nil] doc_id An optional unique ID for the new document.
192
+ # When the document is saved, this value must contain only visible,
193
+ # printable ASCII characters (ASCII codes 33 through 126 inclusive) and
194
+ # be no longer than 500 characters. It cannot begin with an exclamation
195
+ # point (<code>!</code>), and it cannot begin and end with double
196
+ # underscores (<code>__</code>).
197
+ # @param [Integer, nil] rank An optional rank for the new document. An
198
+ # integer which determines the default ordering of documents returned
199
+ # from a search. It is a bad idea to assign the same rank to many
200
+ # documents, and the same rank should never be assigned to more than
201
+ # 10,000 documents. By default (when it is not specified or set to 0),
202
+ # it is set at the time the document is saved to the number of seconds
203
+ # since January 1, 2011. The rank can be used in the `expressions`,
204
+ # `order`, and `fields` options in {Gcloud::Search::Index#search}, where
205
+ # it should referenced as `rank`.
206
+ #
207
+ # @return [Gcloud::Search::Document]
208
+ #
209
+ # @example
212
210
  # require "gcloud"
213
211
  #
214
212
  # gcloud = Gcloud.new
@@ -219,9 +217,7 @@ module Gcloud
219
217
  # document.doc_id #=> nil
220
218
  # document.rank #=> nil
221
219
  #
222
- # To check if an index already contains a document with the same id, pass
223
- # the instance to #find:
224
- #
220
+ # @example To check if an index already contains a document:
225
221
  # require "gcloud"
226
222
  #
227
223
  # gcloud = Gcloud.new
@@ -241,21 +237,14 @@ module Gcloud
241
237
  ##
242
238
  # Retrieves the list of documents belonging to the index.
243
239
  #
244
- # === Parameters
245
- #
246
- # +token+::
247
- # A previously-returned page token representing part of the larger set
248
- # of results to view. (+String+)
249
- # +max+::
250
- # Maximum number of documents to return. The default is +100+.
251
- # (+Integer+)
252
- #
253
- # === Returns
254
- #
255
- # Array of Gcloud::Search::Document (See Gcloud::Search::Document::List)
256
- #
257
- # === Examples
240
+ # @param [String] token A previously-returned page token representing part
241
+ # of the larger set of results to view.
242
+ # @param [Integer] max Maximum number of documents to return. The default
243
+ # is `100`.
244
+ # @return [Array<Gcloud::Search::Document>] See
245
+ # {Gcloud::Search::Document::List})
258
246
  #
247
+ # @example
259
248
  # require "gcloud"
260
249
  #
261
250
  # gcloud = Gcloud.new
@@ -267,9 +256,7 @@ module Gcloud
267
256
  # puts index.index_id
268
257
  # end
269
258
  #
270
- # If you have a significant number of documents, you may need to paginate
271
- # through them: (See Gcloud::Search::Document::List)
272
- #
259
+ # @example With pagination: (See {Gcloud::Search::Document::List})
273
260
  # require "gcloud"
274
261
  #
275
262
  # gcloud = Gcloud.new
@@ -295,21 +282,17 @@ module Gcloud
295
282
 
296
283
  ##
297
284
  # Saves a new or existing document to the index. If the document instance
298
- # is new and has been given an id (see #document), it will replace an
299
- # existing document in the index that has the same unique id.
285
+ # is new and has been given an id (see {Gcloud::Search::Index#document}),
286
+ # it will replace an existing document in the index that has the same
287
+ # unique id.
300
288
  #
301
- # === Parameters
289
+ # @param [Gcloud::Search::Document] document A Document instance, either
290
+ # new (see {Gcloud::Search::Index#document}) or existing (see
291
+ # {Gcloud::Search::Index#find}).
302
292
  #
303
- # +document+::
304
- # A Document instance, either new (see #document) or existing (see
305
- # #find).
306
- #
307
- # === Returns
308
- #
309
- # Gcloud::Search::Document
310
- #
311
- # === Example
293
+ # @return [Gcloud::Search::Document]
312
294
  #
295
+ # @example
313
296
  # require "gcloud"
314
297
  #
315
298
  # gcloud = Gcloud.new
@@ -340,17 +323,10 @@ module Gcloud
340
323
  ##
341
324
  # Permanently deletes the document from the index.
342
325
  #
343
- # === Parameters
344
- #
345
- # +doc_id+::
346
- # The id of the document. (+String+)
347
- #
348
- # === Returns
349
- #
350
- # +true+ if successful
351
- #
352
- # === Example
326
+ # @param [String] doc_id The id of the document.
327
+ # @return [Boolean] `true` if successful
353
328
  #
329
+ # @example
354
330
  # require "gcloud"
355
331
  #
356
332
  # gcloud = Gcloud.new
@@ -373,24 +349,19 @@ module Gcloud
373
349
  # be created, updated, or deleted directly on the server: They are derived
374
350
  # from the documents that reference them.)
375
351
  #
376
- # === Parameters
377
- #
378
- # +force+::
379
- # If +true+, ensures the deletion of the index by first deleting all
380
- # documents. If +false+ and the index contains documents, the request
381
- # will fail. Default is +false+. (+Boolean+)
382
- #
383
- # === Examples
352
+ # @param [Boolean] force If `true`, ensures the deletion of the index by
353
+ # first deleting all documents. If `false` and the index contains
354
+ # documents, the request will fail. Default is `false`.
384
355
  #
356
+ # @example
385
357
  # require "gcloud"
386
358
  #
387
359
  # gcloud = Gcloud.new
388
360
  # search = gcloud.search
389
361
  # index = search.index "books"
362
+ # index.delete
390
363
  #
391
- # An index containing documents can be forcefully deleted with the +force+
392
- # option:
393
- #
364
+ # @example Deleting an index containing documents with the `force` option:
394
365
  # require "gcloud"
395
366
  #
396
367
  # gcloud = Gcloud.new
@@ -417,8 +388,8 @@ module Gcloud
417
388
  end
418
389
 
419
390
  ##
420
- # New Index from a raw data object.
421
- def self.from_raw raw, conn #:nodoc:
391
+ # @private New Index from a raw data object.
392
+ def self.from_raw raw, conn
422
393
  new.tap do |f|
423
394
  f.raw = raw
424
395
  f.connection = conn
@@ -430,76 +401,76 @@ module Gcloud
430
401
 
431
402
  ##
432
403
  # Runs a search against the documents in the index using the provided
433
- # query. For more information see the REST API documentation for
434
- # {indexes.search}[https://cloud.google.com/search/reference/rest/v1/projects/indexes/search].
435
- #
436
- # === Parameters
437
- #
438
- # +query+::
439
- # The query string in search query syntax. If the query is +nil+ or
440
- # empty, all documents are returned. For more information see {Query
441
- # Strings}[https://cloud.google.com/search/query]. (+String+)
442
- # +expressions+::
443
- # Customized expressions used in +order+ or +fields+. The expression can
444
- # contain fields in Document, the built-in fields ( +rank+, the document
445
- # +rank+, and +score+ if scoring is enabled) and fields defined in
446
- # +expressions+. All field expressions expressed as a +Hash+ with the
447
- # keys as the +name+ and the values as the +expression+. The expression
448
- # value can be a combination of supported functions encoded in the
449
- # string. Expressions involving number fields can use the arithmetical
450
- # operators (+, -, *, /) and the built-in numeric functions (+max+,
451
- # +min+, +pow+, +count+, +log+, +abs+). Expressions involving geopoint
452
- # fields can use the +geopoint+ and +distance+ functions. Expressions
453
- # for text and html fields can use the +snippet+ function. (+Hash+)
454
- # +matched_count_accuracy+::
455
- # Minimum accuracy requirement for Result::List#matched_count. If
456
- # specified, +matched_count+ will be accurate to at least that number.
457
- # For example, when set to 100, any <code>matched_count <= 100</code> is
458
- # accurate. This option may add considerable latency/expense. By default
459
- # (when it is not specified or set to 0), the accuracy is the same as
460
- # +max+. (+Integer+)
461
- # +offset+::
462
- # Used to advance pagination to an arbitrary result, independent of the
463
- # previous results. Offsets are an inefficient alternative to using
464
- # +token+. (Both cannot be both set.) The default is 0.
465
- # (+Integer+)
466
- # +order+::
467
- # A comma-separated list of fields for sorting on the search result,
468
- # including fields from Document, the built-in fields (+rank+ and
469
- # +score+), and fields defined in expressions. The default sorting
470
- # order is ascending. To specify descending order for a field, a suffix
471
- # <code>" desc"</code> should be appended to the field name. For
404
+ # query.
405
+ #
406
+ # By default, Result objects are sorted by document rank. For more information
407
+ # see the [REST API documentation for Document.rank](https://cloud.google.com/search/reference/rest/v1/projects/indexes/documents#resource_representation.google.cloudsearch.v1.Document.rank).
408
+ #
409
+ # You can specify how to sort results with the `order` option. In the
410
+ # example below, the <code>-</code> character before `avg_review` means
411
+ # that results will be sorted in ascending order by `published` and then
412
+ # in descending order by `avg_review`. You can add computed fields with
413
+ # the `expressions` option, and limit the fields that are returned with
414
+ # the `fields` option.
415
+ #
416
+ # @see https://cloud.google.com/search/reference/rest/v1/projects/indexes/search
417
+ # The REST API documentation for indexes.search
418
+ #
419
+ # @param [String] query The query string in search query syntax. If the
420
+ # query is `nil` or empty, all documents are returned. For more
421
+ # information see [Query
422
+ # Strings](https://cloud.google.com/search/query).
423
+ # @param [Hash] expressions Customized expressions used in `order` or
424
+ # `fields`. The expression can contain fields in Document, the built-in
425
+ # fields ( `rank`, the document `rank`, and `score` if scoring is
426
+ # enabled) and fields defined in `expressions`. All field expressions
427
+ # expressed as a `Hash` with the keys as the `name` and the values as
428
+ # the `expression`. The expression value can be a combination of
429
+ # supported functions encoded in the string. Expressions involving
430
+ # number fields can use the arithmetical operators (+, -, *, /) and the
431
+ # built-in numeric functions (`max`, `min`, `pow`, `count`, `log`,
432
+ # `abs`). Expressions involving geopoint fields can use the `geopoint`
433
+ # and `distance` functions. Expressions for text and html fields can use
434
+ # the `snippet` function.
435
+ # @param [Integer] matched_count_accuracy Minimum accuracy requirement for
436
+ # {Result::List#matched_count}. If specified, `matched_count` will be
437
+ # accurate to at least that number. For example, when set to 100, any
438
+ # <code>matched_count <= 100</code> is accurate. This option may add
439
+ # considerable latency/expense. By default (when it is not specified or
440
+ # set to 0), the accuracy is the same as `max`.
441
+ # @param [Integer] offset Used to advance pagination to an arbitrary
442
+ # result, independent of the previous results. Offsets are an
443
+ # inefficient alternative to using `token`. (Both cannot be both set.)
444
+ # The default is 0.
445
+ # @param [String] order A comma-separated list of fields for sorting on
446
+ # the search result, including fields from Document, the built-in fields
447
+ # (`rank` and `score`), and fields defined in expressions. The default
448
+ # sorting order is ascending. To specify descending order for a field, a
449
+ # suffix <code>" desc"</code> should be appended to the field name. For
472
450
  # example: <code>orderBy="foo desc,bar"</code>. The default value for
473
451
  # text sort is the empty string, and the default value for numeric sort
474
452
  # is 0. If not specified, the search results are automatically sorted by
475
- # descending +rank+. Sorting by ascending +rank+ is not allowed.
476
- # (+String+)
477
- # +fields+::
478
- # The fields to return in the Search::Result objects. These can be
479
- # fields from Document, the built-in fields +rank+ and +score+, and
480
- # fields defined in expressions. The default is to return all fields.
481
- # (+String+ or +Array+ of +String+)
482
- # +scorer+::
483
- # The scoring function to invoke on a search result for this query. If
484
- # scorer is not set, scoring is disabled and +score+ is 0 for all
485
- # documents in the search result. To enable document relevancy score
486
- # based on term frequency, set +scorer+ to +:generic+.
487
- # (+String+ or +Symbol+)
488
- # +scorer_size+::
489
- # Maximum number of top retrieved results to score. It is valid only
490
- # when +scorer+ is set. The default is 100. (+Integer+)
491
- # +token+::
492
- # A previously-returned page token representing part of the larger set
493
- # of results to view. (+String+)
494
- # +max+::
495
- # Maximum number of results to return per page. (+Integer+)
496
- #
497
- # === Returns
498
- #
499
- # Array of Gcloud::Search::Result (See Gcloud::Search::Result::List)
500
- #
501
- # === Examples
502
- #
453
+ # descending `rank`. Sorting by ascending `rank` is not allowed.
454
+ # @param [String, Array<String>] fields The fields to return in the
455
+ # {Search::Result} objects. These can be fields from {Document}, the
456
+ # built-in fields `rank` and `score`, and fields defined in expressions.
457
+ # The default is to return all fields.
458
+ # @param [String, Symbol] scorer The scoring function to invoke on a
459
+ # search result for this query. If scorer is not set, scoring is
460
+ # disabled and `score` is 0 for all documents in the search result. To
461
+ # enable document relevancy score based on term frequency, set `scorer`
462
+ # to `:generic`.
463
+ # @param [Integer] scorer_size Maximum number of top retrieved results to
464
+ # score. It is valid only when `scorer` is set. The default is 100.
465
+ # @param [String] token A previously-returned page token representing part
466
+ # of the larger set
467
+ # of results to view.
468
+ # @param [Integer] max Maximum number of results to return per page.
469
+ #
470
+ # @return [Array<Gcloud::Search::Result>] (See
471
+ # {Gcloud::Search::Result::List})
472
+ #
473
+ # @example
503
474
  # require "gcloud"
504
475
  #
505
476
  # gcloud = Gcloud.new
@@ -511,9 +482,7 @@ module Gcloud
511
482
  # puts result.doc_id
512
483
  # end
513
484
  #
514
- # If you have a significant number of search results, you may need to
515
- # paginate through them: (See Gcloud::Search::Result::List)
516
- #
485
+ # @example With pagination: (See {Gcloud::Search::Result::List})
517
486
  # require "gcloud"
518
487
  #
519
488
  # gcloud = Gcloud.new
@@ -529,14 +498,7 @@ module Gcloud
529
498
  # results = results.next
530
499
  # end
531
500
  #
532
- # By default, Result objects are sorted by document rank. For more information
533
- # see the {REST API documentation for Document.rank}[https://cloud.google.com/search/reference/rest/v1/projects/indexes/documents#resource_representation.google.cloudsearch.v1.Document.rank].
534
- #
535
- # You can specify how to sort results with the +order+ option. In the example
536
- # below, the <code>-</code> character before +avg_review+ means that results
537
- # will be sorted in ascending order by +published+ and then in descending
538
- # order by +avg_review+.
539
- #
501
+ # @example With the `order` option:
540
502
  # require "gcloud"
541
503
  #
542
504
  # gcloud = Gcloud.new
@@ -546,9 +508,7 @@ module Gcloud
546
508
  # results = index.search "dark stormy", order: "published, avg_review desc"
547
509
  # documents = index.search query # API call
548
510
  #
549
- # You can add computed fields with the +expressions+ option, and limit the
550
- # fields that are returned with the +fields+ option:
551
- #
511
+ # @example With the `fields` option:
552
512
  # require "gcloud"
553
513
  #
554
514
  # gcloud = Gcloud.new
@@ -559,8 +519,7 @@ module Gcloud
559
519
  # expressions: { total_price: "(price + tax)" },
560
520
  # fields: ["name", "total_price", "highlight"]
561
521
  #
562
- # Just as in documents, Result data is accessible via Fields methods:
563
- #
522
+ # @example Just as in documents, data is accessible via {Fields} methods:
564
523
  # require "gcloud"
565
524
  #
566
525
  # gcloud = Gcloud.new