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 "delegate"
17
17
 
18
18
  module Gcloud
@@ -39,8 +39,8 @@ module Gcloud
39
39
  end
40
40
 
41
41
  ##
42
- # New Table::List from a response object.
43
- def self.from_response resp, conn #:nodoc:
42
+ # @private New Table::List from a response object.
43
+ def self.from_response resp, conn
44
44
  tables = List.new(Array(resp.data["tables"]).map do |gapi_object|
45
45
  Table.from_gapi gapi_object, conn
46
46
  end)
@@ -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,18 +12,21 @@
13
12
  # See the License for the specific language governing permissions and
14
13
  # limitations under the License.
15
14
 
15
+
16
16
  module Gcloud
17
17
  module Bigquery
18
18
  class Table
19
19
  ##
20
- # = Table Schema
20
+ # # Table Schema
21
21
  #
22
22
  # A builder for BigQuery table schemas, passed to block arguments to
23
- # Dataset#create_table and Table#schema. Supports nested and
24
- # repeated fields via a nested block. For more information about BigQuery
25
- # schema definitions, see {Preparing Data for BigQuery
26
- # }[https://cloud.google.com/bigquery/preparing-data-for-bigquery].
23
+ # {Dataset#create_table} and {Table#schema}. Supports nested and
24
+ # repeated fields via a nested block.
25
+ #
26
+ # @see https://cloud.google.com/bigquery/preparing-data-for-bigquery
27
+ # Preparing Data for BigQuery
27
28
  #
29
+ # @example
28
30
  # require "gcloud"
29
31
  #
30
32
  # gcloud = Gcloud.new
@@ -41,30 +43,36 @@ module Gcloud
41
43
  # end
42
44
  #
43
45
  class Schema
44
- MODES = %w( NULLABLE REQUIRED REPEATED ) #:nodoc:
45
- TYPES = %w( STRING INTEGER FLOAT BOOLEAN TIMESTAMP RECORD ) #:nodoc:
46
+ # @private
47
+ MODES = %w( NULLABLE REQUIRED REPEATED )
48
+
49
+ # @private
50
+ TYPES = %w( STRING INTEGER FLOAT BOOLEAN TIMESTAMP RECORD )
46
51
 
47
- attr_reader :fields #:nodoc:
52
+ # @private
53
+ attr_reader :fields
48
54
 
49
55
  ##
50
- # Initializes a new schema object with an existing schema.
51
- def initialize schema = nil, nested = false #:nodoc:
56
+ # @private Initializes a new schema object with an existing schema.
57
+ def initialize schema = nil, nested = false
52
58
  fields = (schema && schema["fields"]) || []
53
59
  @original_fields = fields.dup
54
60
  @fields = fields.dup
55
61
  @nested = nested
56
62
  end
57
63
 
58
- def changed? #:nodoc:
64
+ # @private
65
+ def changed?
59
66
  @original_fields != @fields
60
67
  end
61
68
 
62
69
  ##
70
+ # @private
63
71
  # Returns the schema as hash containing the keys and values specified by
64
- # the Google Cloud BigQuery {Rest API
65
- # }[https://cloud.google.com/bigquery/docs/reference/v2/tables#resource]
72
+ # the Google Cloud BigQuery [Rest API
73
+ # ](https://cloud.google.com/bigquery/docs/reference/v2/tables#resource)
66
74
  # .
67
- def schema #:nodoc:
75
+ def schema
68
76
  {
69
77
  "fields" => @fields
70
78
  }
@@ -73,17 +81,14 @@ module Gcloud
73
81
  ##
74
82
  # Adds a string field to the schema.
75
83
  #
76
- # === Parameters
77
- #
78
- # +name+::
79
- # The field name. The name must contain only letters (a-z, A-Z),
80
- # numbers (0-9), or underscores (_), and must start with a letter or
81
- # underscore. The maximum length is 128 characters. (+String+)
82
- # +description+::
83
- # A description of the field. (+String+)
84
- # +mode+::
85
- # The field's mode. The possible values are +:nullable+, +:required+,
86
- # and +:repeated+. The default value is +:nullable+. (+Symbol+)
84
+ # @param [String] name The field name. The name must contain only
85
+ # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
86
+ # start with a letter or underscore. The maximum length is 128
87
+ # characters.
88
+ # @param [String] description A description of the field.
89
+ # @param [Symbol] mode The field's mode. The possible values are
90
+ # `:nullable`, `:required`, and `:repeated`. The default value is
91
+ # `:nullable`.
87
92
  def string name, description: nil, mode: nil
88
93
  add_field name, :string, nil, description: description, mode: mode
89
94
  end
@@ -91,17 +96,14 @@ module Gcloud
91
96
  ##
92
97
  # Adds an integer field to the schema.
93
98
  #
94
- # === Parameters
95
- #
96
- # +name+::
97
- # The field name. The name must contain only letters (a-z, A-Z),
98
- # numbers (0-9), or underscores (_), and must start with a letter or
99
- # underscore. The maximum length is 128 characters. (+String+)
100
- # +description+::
101
- # A description of the field. (+String+)
102
- # +mode+::
103
- # The field's mode. The possible values are +:nullable+, +:required+,
104
- # and +:repeated+. The default value is +:nullable+. (+Symbol+)
99
+ # @param [String] name The field name. The name must contain only
100
+ # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
101
+ # start with a letter or underscore. The maximum length is 128
102
+ # characters.
103
+ # @param [String] description A description of the field.
104
+ # @param [Symbol] mode The field's mode. The possible values are
105
+ # `:nullable`, `:required`, and `:repeated`. The default value is
106
+ # `:nullable`.
105
107
  def integer name, description: nil, mode: nil
106
108
  add_field name, :integer, nil, description: description, mode: mode
107
109
  end
@@ -109,17 +111,14 @@ module Gcloud
109
111
  ##
110
112
  # Adds a floating-point number field to the schema.
111
113
  #
112
- # === Parameters
113
- #
114
- # +name+::
115
- # The field name. The name must contain only letters (a-z, A-Z),
116
- # numbers (0-9), or underscores (_), and must start with a letter or
117
- # underscore. The maximum length is 128 characters. (+String+)
118
- # +description+::
119
- # A description of the field. (+String+)
120
- # +mode+::
121
- # The field's mode. The possible values are +:nullable+, +:required+,
122
- # and +:repeated+. The default value is +:nullable+. (+Symbol+)
114
+ # @param [String] name The field name. The name must contain only
115
+ # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
116
+ # start with a letter or underscore. The maximum length is 128
117
+ # characters.
118
+ # @param [String] description A description of the field.
119
+ # @param [Symbol] mode The field's mode. The possible values are
120
+ # `:nullable`, `:required`, and `:repeated`. The default value is
121
+ # `:nullable`.
123
122
  def float name, description: nil, mode: nil
124
123
  add_field name, :float, nil, description: description, mode: mode
125
124
  end
@@ -127,17 +126,14 @@ module Gcloud
127
126
  ##
128
127
  # Adds a boolean field to the schema.
129
128
  #
130
- # === Parameters
131
- #
132
- # +name+::
133
- # The field name. The name must contain only letters (a-z, A-Z),
134
- # numbers (0-9), or underscores (_), and must start with a letter or
135
- # underscore. The maximum length is 128 characters. (+String+)
136
- # +description+::
137
- # A description of the field. (+String+)
138
- # +mode+::
139
- # The field's mode. The possible values are +:nullable+, +:required+,
140
- # and +:repeated+. The default value is +:nullable+. (+Symbol+)
129
+ # @param [String] name The field name. The name must contain only
130
+ # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
131
+ # start with a letter or underscore. The maximum length is 128
132
+ # characters.
133
+ # @param [String] description A description of the field.
134
+ # @param [Symbol] mode The field's mode. The possible values are
135
+ # `:nullable`, `:required`, and `:repeated`. The default value is
136
+ # `:nullable`.
141
137
  def boolean name, description: nil, mode: nil
142
138
  add_field name, :boolean, nil, description: description, mode: mode
143
139
  end
@@ -145,17 +141,14 @@ module Gcloud
145
141
  ##
146
142
  # Adds a timestamp field to the schema.
147
143
  #
148
- # === Parameters
149
- #
150
- # +name+::
151
- # The field name. The name must contain only letters (a-z, A-Z),
152
- # numbers (0-9), or underscores (_), and must start with a letter or
153
- # underscore. The maximum length is 128 characters. (+String+)
154
- # +description+::
155
- # A description of the field. (+String+)
156
- # +mode+::
157
- # The field's mode. The possible values are +:nullable+, +:required+,
158
- # and +:repeated+. The default value is +:nullable+. (+Symbol+)
144
+ # @param [String] name The field name. The name must contain only
145
+ # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
146
+ # start with a letter or underscore. The maximum length is 128
147
+ # characters.
148
+ # @param [String] description A description of the field.
149
+ # @param [Symbol] mode The field's mode. The possible values are
150
+ # `:nullable`, `:required`, and `:repeated`. The default value is
151
+ # `:nullable`.
159
152
  def timestamp name, description: nil, mode: nil
160
153
  add_field name, :timestamp, nil, description: description, mode: mode
161
154
  end
@@ -163,23 +156,22 @@ module Gcloud
163
156
  ##
164
157
  # Adds a record field to the schema. A block must be passed describing
165
158
  # the nested fields of the record. For more information about nested
166
- # and repeated records, see {Preparing Data for BigQuery
167
- # }[https://cloud.google.com/bigquery/preparing-data-for-bigquery].
168
- #
169
- # === Parameters
170
- #
171
- # +name+::
172
- # The field name. The name must contain only letters (a-z, A-Z),
173
- # numbers (0-9), or underscores (_), and must start with a letter or
174
- # underscore. The maximum length is 128 characters. (+String+)
175
- # +description+::
176
- # A description of the field. (+String+)
177
- # +mode+::
178
- # The field's mode. The possible values are +:nullable+, +:required+,
179
- # and +:repeated+. The default value is +:nullable+. (+Symbol+)
180
- #
181
- # === Example
182
- #
159
+ # and repeated records, see [Preparing Data for BigQuery
160
+ # ](https://cloud.google.com/bigquery/preparing-data-for-bigquery).
161
+ #
162
+ # @param [String] name The field name. The name must contain only
163
+ # letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
164
+ # start with a letter or underscore. The maximum length is 128
165
+ # characters.
166
+ # @param [String] description A description of the field.
167
+ # @param [Symbol] mode The field's mode. The possible values are
168
+ # `:nullable`, `:required`, and `:repeated`. The default value is
169
+ # `:nullable`.
170
+ # @yield [nested_schema] a block for setting the nested schema
171
+ # @yieldparam [Table::Schema] nested_schema the object accepting the
172
+ # nested schema
173
+ #
174
+ # @example
183
175
  # require "gcloud"
184
176
  #
185
177
  # gcloud = Gcloud.new
@@ -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/bigquery/data"
17
17
  require "gcloud/bigquery/table/list"
18
18
  require "gcloud/bigquery/errors"
@@ -20,7 +20,7 @@ require "gcloud/bigquery/errors"
20
20
  module Gcloud
21
21
  module Bigquery
22
22
  ##
23
- # = View
23
+ # # View
24
24
  #
25
25
  # A view is a virtual table defined by a SQL query. You can query views in
26
26
  # the browser tool, or by using a query job.
@@ -30,6 +30,7 @@ module Gcloud
30
30
  # queried. Queries are billed according to the total amount of data in all
31
31
  # table fields referenced directly or indirectly by the top-level query.
32
32
  #
33
+ # @example
33
34
  # require "gcloud"
34
35
  #
35
36
  # gcloud = Gcloud.new
@@ -40,16 +41,16 @@ module Gcloud
40
41
  #
41
42
  class View
42
43
  ##
43
- # The Connection object.
44
- attr_accessor :connection #:nodoc:
44
+ # @private The Connection object.
45
+ attr_accessor :connection
45
46
 
46
47
  ##
47
- # The Google API Client object.
48
- attr_accessor :gapi #:nodoc:
48
+ # @private The Google API Client object.
49
+ attr_accessor :gapi
49
50
 
50
51
  ##
51
- # Create an empty Table object.
52
- def initialize #:nodoc:
52
+ # @private Create an empty Table object.
53
+ def initialize
53
54
  @connection = nil
54
55
  @gapi = {}
55
56
  end
@@ -59,34 +60,35 @@ module Gcloud
59
60
  # The ID must contain only letters (a-z, A-Z), numbers (0-9),
60
61
  # or underscores (_). The maximum length is 1,024 characters.
61
62
  #
62
- # :category: Attributes
63
+ # @!group Attributes
63
64
  #
64
65
  def table_id
65
66
  @gapi["tableReference"]["tableId"]
66
67
  end
67
68
 
68
69
  ##
69
- # The ID of the +Dataset+ containing this table.
70
+ # The ID of the `Dataset` containing this table.
70
71
  #
71
- # :category: Attributes
72
+ # @!group Attributes
72
73
  #
73
74
  def dataset_id
74
75
  @gapi["tableReference"]["datasetId"]
75
76
  end
76
77
 
77
78
  ##
78
- # The ID of the +Project+ containing this table.
79
+ # The ID of the `Project` containing this table.
79
80
  #
80
- # :category: Attributes
81
+ # @!group Attributes
81
82
  #
82
83
  def project_id
83
84
  @gapi["tableReference"]["projectId"]
84
85
  end
85
86
 
86
87
  ##
88
+ # @private
87
89
  # The gapi fragment containing the Project ID, Dataset ID, and Table ID as
88
90
  # a camel-cased hash.
89
- def table_ref #:nodoc:
91
+ def table_ref
90
92
  table_ref = @gapi["tableReference"]
91
93
  table_ref = table_ref.to_hash if table_ref.respond_to? :to_hash
92
94
  table_ref
@@ -95,7 +97,7 @@ module Gcloud
95
97
  ##
96
98
  # The name of the table.
97
99
  #
98
- # :category: Attributes
100
+ # @!group Attributes
99
101
  #
100
102
  def name
101
103
  @gapi["friendlyName"]
@@ -104,7 +106,7 @@ module Gcloud
104
106
  ##
105
107
  # Updates the name of the table.
106
108
  #
107
- # :category: Lifecycle
109
+ # @!group Lifecycle
108
110
  #
109
111
  def name= new_name
110
112
  patch_gapi! name: new_name
@@ -113,7 +115,7 @@ module Gcloud
113
115
  ##
114
116
  # A string hash of the dataset.
115
117
  #
116
- # :category: Attributes
118
+ # @!group Attributes
117
119
  #
118
120
  def etag
119
121
  ensure_full_data!
@@ -123,7 +125,7 @@ module Gcloud
123
125
  ##
124
126
  # A URL that can be used to access the dataset using the REST API.
125
127
  #
126
- # :category: Attributes
128
+ # @!group Attributes
127
129
  #
128
130
  def api_url
129
131
  ensure_full_data!
@@ -133,7 +135,7 @@ module Gcloud
133
135
  ##
134
136
  # The description of the table.
135
137
  #
136
- # :category: Attributes
138
+ # @!group Attributes
137
139
  #
138
140
  def description
139
141
  ensure_full_data!
@@ -143,7 +145,7 @@ module Gcloud
143
145
  ##
144
146
  # Updates the description of the table.
145
147
  #
146
- # :category: Lifecycle
148
+ # @!group Lifecycle
147
149
  #
148
150
  def description= new_description
149
151
  patch_gapi! description: new_description
@@ -152,7 +154,7 @@ module Gcloud
152
154
  ##
153
155
  # The time when this table was created.
154
156
  #
155
- # :category: Attributes
157
+ # @!group Attributes
156
158
  #
157
159
  def created_at
158
160
  ensure_full_data!
@@ -164,7 +166,7 @@ module Gcloud
164
166
  # If not present, the table will persist indefinitely.
165
167
  # Expired tables will be deleted and their storage reclaimed.
166
168
  #
167
- # :category: Attributes
169
+ # @!group Attributes
168
170
  #
169
171
  def expires_at
170
172
  ensure_full_data!
@@ -175,7 +177,7 @@ module Gcloud
175
177
  ##
176
178
  # The date when this table was last modified.
177
179
  #
178
- # :category: Attributes
180
+ # @!group Attributes
179
181
  #
180
182
  def modified_at
181
183
  ensure_full_data!
@@ -185,7 +187,7 @@ module Gcloud
185
187
  ##
186
188
  # Checks if the table's type is "TABLE".
187
189
  #
188
- # :category: Attributes
190
+ # @!group Attributes
189
191
  #
190
192
  def table?
191
193
  @gapi["type"] == "TABLE"
@@ -194,7 +196,7 @@ module Gcloud
194
196
  ##
195
197
  # Checks if the table's type is "VIEW".
196
198
  #
197
- # :category: Attributes
199
+ # @!group Attributes
198
200
  #
199
201
  def view?
200
202
  @gapi["type"] == "VIEW"
@@ -204,7 +206,7 @@ module Gcloud
204
206
  # The geographic location where the table should reside. Possible
205
207
  # values include EU and US. The default value is US.
206
208
  #
207
- # :category: Attributes
209
+ # @!group Attributes
208
210
  #
209
211
  def location
210
212
  ensure_full_data!
@@ -214,7 +216,7 @@ module Gcloud
214
216
  ##
215
217
  # The schema of the table.
216
218
  #
217
- # :category: Attributes
219
+ # @!group Attributes
218
220
  #
219
221
  def schema
220
222
  ensure_full_data!
@@ -227,7 +229,7 @@ module Gcloud
227
229
  ##
228
230
  # The fields of the table.
229
231
  #
230
- # :category: Attributes
232
+ # @!group Attributes
231
233
  #
232
234
  def fields
233
235
  f = schema["fields"]
@@ -239,7 +241,7 @@ module Gcloud
239
241
  ##
240
242
  # The names of the columns in the table.
241
243
  #
242
- # :category: Attributes
244
+ # @!group Attributes
243
245
  #
244
246
  def headers
245
247
  fields.map { |f| f["name"] }
@@ -248,7 +250,7 @@ module Gcloud
248
250
  ##
249
251
  # The query that executes each time the view is loaded.
250
252
  #
251
- # :category: Attributes
253
+ # @!group Attributes
252
254
  #
253
255
  def query
254
256
  @gapi["view"]["query"] if @gapi["view"]
@@ -256,16 +258,13 @@ module Gcloud
256
258
 
257
259
  ##
258
260
  # Updates the query that executes each time the view is loaded.
259
- # See the BigQuery {Query Reference
260
- # }[https://cloud.google.com/bigquery/query-reference].
261
- #
262
- # === Parameters
263
261
  #
264
- # +new_query+::
265
- # The query that defines the view. (+String+)
262
+ # @see https://cloud.google.com/bigquery/query-reference BigQuery Query
263
+ # Reference
266
264
  #
267
- # === Example
265
+ # @param [String] new_query The query that defines the view.
268
266
  #
267
+ # @example
269
268
  # require "gcloud"
270
269
  #
271
270
  # gcloud = Gcloud.new
@@ -275,7 +274,7 @@ module Gcloud
275
274
  #
276
275
  # view.query = "SELECT first_name FROM [my_project:my_dataset.my_table]"
277
276
  #
278
- # :category: Lifecycle
277
+ # @!group Lifecycle
279
278
  #
280
279
  def query= new_query
281
280
  patch_gapi! query: new_query
@@ -284,40 +283,31 @@ module Gcloud
284
283
  ##
285
284
  # Runs a query to retrieve all data from the view.
286
285
  #
287
- # === Parameters
288
- #
289
- # +max+::
290
- # The maximum number of rows of data to return per page of results.
291
- # Setting this flag to a small value such as 1000 and then paging
292
- # through results might improve reliability when the query result set is
293
- # large. In addition to this limit, responses are also limited to 10 MB.
294
- # By default, there is no maximum row count, and only the byte limit
295
- # applies. (+Integer+)
296
- # +timeout+::
297
- # How long to wait for the query to complete, in milliseconds, before
298
- # the request times out and returns. Note that this is only a timeout
299
- # for the request, not the query. If the query takes longer to run than
300
- # the timeout value, the call returns without any results and with
301
- # QueryData#complete? set to false. The default value is 10000
302
- # milliseconds (10 seconds). (+Integer+)
303
- # +cache+::
304
- # Whether to look for the result in the query cache. The query cache is
305
- # a best-effort cache that will be flushed whenever tables in the query
306
- # are modified. The default value is true. For more information, see
307
- # {query caching}[https://developers.google.com/bigquery/querying-data].
308
- # (+Boolean+)
309
- # +dryrun+::
310
- # If set to +true+, BigQuery doesn't run the job. Instead, if the query
311
- # is valid, BigQuery returns statistics about the job such as how many
312
- # bytes would be processed. If the query is invalid, an error returns.
313
- # The default value is +false+. (+Boolean+)
314
- #
315
- # === Returns
316
- #
317
- # Gcloud::Bigquery::QueryData
318
- #
319
- # === Example
320
- #
286
+ # @param [Integer] max The maximum number of rows of data to return per
287
+ # page of results. Setting this flag to a small value such as 1000 and
288
+ # then paging through results might improve reliability when the query
289
+ # result set is large. In addition to this limit, responses are also
290
+ # limited to 10 MB. By default, there is no maximum row count, and only
291
+ # the byte limit applies.
292
+ # @param [Integer] timeout How long to wait for the query to complete, in
293
+ # milliseconds, before the request times out and returns. Note that this
294
+ # is only a timeout for the request, not the query. If the query takes
295
+ # longer to run than the timeout value, the call returns without any
296
+ # results and with QueryData#complete? set to false. The default value
297
+ # is 10000 milliseconds (10 seconds).
298
+ # @param [Boolean] cache Whether to look for the result in the query
299
+ # cache. The query cache is a best-effort cache that will be flushed
300
+ # whenever tables in the query are modified. The default value is true.
301
+ # For more information, see [query
302
+ # caching](https://developers.google.com/bigquery/querying-data).
303
+ # @param [Boolean] dryrun If set to `true`, BigQuery doesn't run the job.
304
+ # Instead, if the query is valid, BigQuery returns statistics about the
305
+ # job such as how many bytes would be processed. If the query is
306
+ # invalid, an error returns. The default value is `false`.
307
+ #
308
+ # @return [Gcloud::Bigquery::QueryData]
309
+ #
310
+ # @example
321
311
  # require "gcloud"
322
312
  #
323
313
  # gcloud = Gcloud.new
@@ -331,7 +321,7 @@ module Gcloud
331
321
  # end
332
322
  # more_data = data.next if data.next?
333
323
  #
334
- # :category: Data
324
+ # @!group Data
335
325
  #
336
326
  def data max: nil, timeout: nil, cache: nil, dryrun: nil
337
327
  sql = "SELECT * FROM #{@gapi['id']}"
@@ -348,12 +338,9 @@ module Gcloud
348
338
  ##
349
339
  # Permanently deletes the table.
350
340
  #
351
- # === Returns
352
- #
353
- # +true+ if the table was deleted.
354
- #
355
- # === Example
341
+ # @return [Boolean] Returns `true` if the table was deleted.
356
342
  #
343
+ # @example
357
344
  # require "gcloud"
358
345
  #
359
346
  # gcloud = Gcloud.new
@@ -363,7 +350,7 @@ module Gcloud
363
350
  #
364
351
  # table.delete
365
352
  #
366
- # :category: Lifecycle
353
+ # @!group Lifecycle
367
354
  #
368
355
  def delete
369
356
  ensure_connection!
@@ -378,7 +365,7 @@ module Gcloud
378
365
  ##
379
366
  # Reloads the table with current data from the BigQuery service.
380
367
  #
381
- # :category: Lifecycle
368
+ # @!group Lifecycle
382
369
  #
383
370
  def reload!
384
371
  ensure_connection!
@@ -392,8 +379,8 @@ module Gcloud
392
379
  alias_method :refresh!, :reload!
393
380
 
394
381
  ##
395
- # New Table from a Google API Client object.
396
- def self.from_gapi gapi, conn #:nodoc:
382
+ # @private New Table from a Google API Client object.
383
+ def self.from_gapi gapi, conn
397
384
  new.tap do |f|
398
385
  f.gapi = gapi
399
386
  f.connection = conn