google-cloud-vision 0.32.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +4 -2
  3. data/AUTHENTICATION.md +151 -0
  4. data/LICENSE.md +201 -0
  5. data/MIGRATING.md +343 -0
  6. data/README.md +97 -52
  7. data/lib/google/cloud/vision/{v1/doc/google/protobuf/empty.rb → version.rb} +10 -13
  8. data/lib/google/cloud/vision.rb +132 -207
  9. data/lib/{google/cloud/vision/v1p3beta1/doc/google/protobuf/empty.rb → google-cloud-vision.rb} +5 -15
  10. metadata +108 -83
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/vision/v1/credentials.rb +0 -42
  13. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/geometry.rb +0 -66
  14. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +0 -763
  15. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search.rb +0 -88
  16. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search_service.rb +0 -539
  17. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +0 -254
  18. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +0 -102
  19. data/lib/google/cloud/vision/v1/doc/google/longrunning/operations.rb +0 -93
  20. data/lib/google/cloud/vision/v1/doc/google/protobuf/any.rb +0 -130
  21. data/lib/google/cloud/vision/v1/doc/google/protobuf/field_mask.rb +0 -230
  22. data/lib/google/cloud/vision/v1/doc/google/protobuf/timestamp.rb +0 -109
  23. data/lib/google/cloud/vision/v1/doc/google/protobuf/wrappers.rb +0 -90
  24. data/lib/google/cloud/vision/v1/doc/google/rpc/status.rb +0 -84
  25. data/lib/google/cloud/vision/v1/doc/google/type/color.rb +0 -156
  26. data/lib/google/cloud/vision/v1/doc/google/type/latlng.rb +0 -65
  27. data/lib/google/cloud/vision/v1/geometry_pb.rb +0 -39
  28. data/lib/google/cloud/vision/v1/helpers.rb +0 -1154
  29. data/lib/google/cloud/vision/v1/image_annotator_client.rb +0 -302
  30. data/lib/google/cloud/vision/v1/image_annotator_client_config.json +0 -36
  31. data/lib/google/cloud/vision/v1/image_annotator_pb.rb +0 -305
  32. data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +0 -56
  33. data/lib/google/cloud/vision/v1/product_search_client.rb +0 -1337
  34. data/lib/google/cloud/vision/v1/product_search_client_config.json +0 -116
  35. data/lib/google/cloud/vision/v1/product_search_pb.rb +0 -45
  36. data/lib/google/cloud/vision/v1/product_search_service_pb.rb +0 -191
  37. data/lib/google/cloud/vision/v1/product_search_service_services_pb.rb +0 -224
  38. data/lib/google/cloud/vision/v1/text_annotation_pb.rb +0 -94
  39. data/lib/google/cloud/vision/v1/web_detection_pb.rb +0 -51
  40. data/lib/google/cloud/vision/v1.rb +0 -233
  41. data/lib/google/cloud/vision/v1p3beta1/credentials.rb +0 -42
  42. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/geometry.rb +0 -72
  43. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/image_annotator.rb +0 -763
  44. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search.rb +0 -154
  45. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search_service.rb +0 -533
  46. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/text_annotation.rb +0 -254
  47. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/web_detection.rb +0 -101
  48. data/lib/google/cloud/vision/v1p3beta1/doc/google/longrunning/operations.rb +0 -93
  49. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/any.rb +0 -130
  50. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/field_mask.rb +0 -230
  51. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/timestamp.rb +0 -109
  52. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/wrappers.rb +0 -90
  53. data/lib/google/cloud/vision/v1p3beta1/doc/google/rpc/status.rb +0 -84
  54. data/lib/google/cloud/vision/v1p3beta1/doc/google/type/color.rb +0 -156
  55. data/lib/google/cloud/vision/v1p3beta1/doc/google/type/latlng.rb +0 -65
  56. data/lib/google/cloud/vision/v1p3beta1/geometry_pb.rb +0 -43
  57. data/lib/google/cloud/vision/v1p3beta1/helpers.rb +0 -1154
  58. data/lib/google/cloud/vision/v1p3beta1/image_annotator_client.rb +0 -302
  59. data/lib/google/cloud/vision/v1p3beta1/image_annotator_client_config.json +0 -36
  60. data/lib/google/cloud/vision/v1p3beta1/image_annotator_pb.rb +0 -304
  61. data/lib/google/cloud/vision/v1p3beta1/image_annotator_services_pb.rb +0 -55
  62. data/lib/google/cloud/vision/v1p3beta1/product_search_client.rb +0 -1351
  63. data/lib/google/cloud/vision/v1p3beta1/product_search_client_config.json +0 -116
  64. data/lib/google/cloud/vision/v1p3beta1/product_search_pb.rb +0 -64
  65. data/lib/google/cloud/vision/v1p3beta1/product_search_service_pb.rb +0 -191
  66. data/lib/google/cloud/vision/v1p3beta1/product_search_service_services_pb.rb +0 -222
  67. data/lib/google/cloud/vision/v1p3beta1/text_annotation_pb.rb +0 -94
  68. data/lib/google/cloud/vision/v1p3beta1/web_detection_pb.rb +0 -51
  69. data/lib/google/cloud/vision/v1p3beta1.rb +0 -233
@@ -1,230 +0,0 @@
1
- # Copyright 2018 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # `FieldMask` represents a set of symbolic field paths, for example:
19
- #
20
- # paths: "f.a"
21
- # paths: "f.b.d"
22
- #
23
- # Here `f` represents a field in some root message, `a` and `b`
24
- # fields in the message found in `f`, and `d` a field found in the
25
- # message in `f.b`.
26
- #
27
- # Field masks are used to specify a subset of fields that should be
28
- # returned by a get operation or modified by an update operation.
29
- # Field masks also have a custom JSON encoding (see below).
30
- #
31
- # = Field Masks in Projections
32
- #
33
- # When used in the context of a projection, a response message or
34
- # sub-message is filtered by the API to only contain those fields as
35
- # specified in the mask. For example, if the mask in the previous
36
- # example is applied to a response message as follows:
37
- #
38
- # f {
39
- # a : 22
40
- # b {
41
- # d : 1
42
- # x : 2
43
- # }
44
- # y : 13
45
- # }
46
- # z: 8
47
- #
48
- # The result will not contain specific values for fields x,y and z
49
- # (their value will be set to the default, and omitted in proto text
50
- # output):
51
- #
52
- #
53
- # f {
54
- # a : 22
55
- # b {
56
- # d : 1
57
- # }
58
- # }
59
- #
60
- # A repeated field is not allowed except at the last position of a
61
- # paths string.
62
- #
63
- # If a FieldMask object is not present in a get operation, the
64
- # operation applies to all fields (as if a FieldMask of all fields
65
- # had been specified).
66
- #
67
- # Note that a field mask does not necessarily apply to the
68
- # top-level response message. In case of a REST get operation, the
69
- # field mask applies directly to the response, but in case of a REST
70
- # list operation, the mask instead applies to each individual message
71
- # in the returned resource list. In case of a REST custom method,
72
- # other definitions may be used. Where the mask applies will be
73
- # clearly documented together with its declaration in the API. In
74
- # any case, the effect on the returned resource/resources is required
75
- # behavior for APIs.
76
- #
77
- # = Field Masks in Update Operations
78
- #
79
- # A field mask in update operations specifies which fields of the
80
- # targeted resource are going to be updated. The API is required
81
- # to only change the values of the fields as specified in the mask
82
- # and leave the others untouched. If a resource is passed in to
83
- # describe the updated values, the API ignores the values of all
84
- # fields not covered by the mask.
85
- #
86
- # If a repeated field is specified for an update operation, the existing
87
- # repeated values in the target resource will be overwritten by the new values.
88
- # Note that a repeated field is only allowed in the last position of a `paths`
89
- # string.
90
- #
91
- # If a sub-message is specified in the last position of the field mask for an
92
- # update operation, then the existing sub-message in the target resource is
93
- # overwritten. Given the target message:
94
- #
95
- # f {
96
- # b {
97
- # d : 1
98
- # x : 2
99
- # }
100
- # c : 1
101
- # }
102
- #
103
- # And an update message:
104
- #
105
- # f {
106
- # b {
107
- # d : 10
108
- # }
109
- # }
110
- #
111
- # then if the field mask is:
112
- #
113
- # paths: "f.b"
114
- #
115
- # then the result will be:
116
- #
117
- # f {
118
- # b {
119
- # d : 10
120
- # }
121
- # c : 1
122
- # }
123
- #
124
- # However, if the update mask was:
125
- #
126
- # paths: "f.b.d"
127
- #
128
- # then the result would be:
129
- #
130
- # f {
131
- # b {
132
- # d : 10
133
- # x : 2
134
- # }
135
- # c : 1
136
- # }
137
- #
138
- # In order to reset a field's value to the default, the field must
139
- # be in the mask and set to the default value in the provided resource.
140
- # Hence, in order to reset all fields of a resource, provide a default
141
- # instance of the resource and set all fields in the mask, or do
142
- # not provide a mask as described below.
143
- #
144
- # If a field mask is not present on update, the operation applies to
145
- # all fields (as if a field mask of all fields has been specified).
146
- # Note that in the presence of schema evolution, this may mean that
147
- # fields the client does not know and has therefore not filled into
148
- # the request will be reset to their default. If this is unwanted
149
- # behavior, a specific service may require a client to always specify
150
- # a field mask, producing an error if not.
151
- #
152
- # As with get operations, the location of the resource which
153
- # describes the updated values in the request message depends on the
154
- # operation kind. In any case, the effect of the field mask is
155
- # required to be honored by the API.
156
- #
157
- # == Considerations for HTTP REST
158
- #
159
- # The HTTP kind of an update operation which uses a field mask must
160
- # be set to PATCH instead of PUT in order to satisfy HTTP semantics
161
- # (PUT must only be used for full updates).
162
- #
163
- # = JSON Encoding of Field Masks
164
- #
165
- # In JSON, a field mask is encoded as a single string where paths are
166
- # separated by a comma. Fields name in each path are converted
167
- # to/from lower-camel naming conventions.
168
- #
169
- # As an example, consider the following message declarations:
170
- #
171
- # message Profile {
172
- # User user = 1;
173
- # Photo photo = 2;
174
- # }
175
- # message User {
176
- # string display_name = 1;
177
- # string address = 2;
178
- # }
179
- #
180
- # In proto a field mask for `Profile` may look as such:
181
- #
182
- # mask {
183
- # paths: "user.display_name"
184
- # paths: "photo"
185
- # }
186
- #
187
- # In JSON, the same mask is represented as below:
188
- #
189
- # {
190
- # mask: "user.displayName,photo"
191
- # }
192
- #
193
- # = Field Masks and Oneof Fields
194
- #
195
- # Field masks treat fields in oneofs just as regular fields. Consider the
196
- # following message:
197
- #
198
- # message SampleMessage {
199
- # oneof test_oneof {
200
- # string name = 4;
201
- # SubMessage sub_message = 9;
202
- # }
203
- # }
204
- #
205
- # The field mask can be:
206
- #
207
- # mask {
208
- # paths: "name"
209
- # }
210
- #
211
- # Or:
212
- #
213
- # mask {
214
- # paths: "sub_message"
215
- # }
216
- #
217
- # Note that oneof type names ("test_oneof" in this case) cannot be used in
218
- # paths.
219
- #
220
- # == Field Mask Verification
221
- #
222
- # The implementation of any API method which has a FieldMask type field in the
223
- # request should verify the included field paths, and return an
224
- # `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
225
- # @!attribute [rw] paths
226
- # @return [Array<String>]
227
- # The set of field mask paths.
228
- class FieldMask; end
229
- end
230
- end
@@ -1,109 +0,0 @@
1
- # Copyright 2018 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # A Timestamp represents a point in time independent of any time zone
19
- # or calendar, represented as seconds and fractions of seconds at
20
- # nanosecond resolution in UTC Epoch time. It is encoded using the
21
- # Proleptic Gregorian Calendar which extends the Gregorian calendar
22
- # backwards to year one. It is encoded assuming all minutes are 60
23
- # seconds long, i.e. leap seconds are "smeared" so that no leap second
24
- # table is needed for interpretation. Range is from
25
- # 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
26
- # By restricting to that range, we ensure that we can convert to
27
- # and from RFC 3339 date strings.
28
- # See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
29
- #
30
- # = Examples
31
- #
32
- # Example 1: Compute Timestamp from POSIX `time()`.
33
- #
34
- # Timestamp timestamp;
35
- # timestamp.set_seconds(time(NULL));
36
- # timestamp.set_nanos(0);
37
- #
38
- # Example 2: Compute Timestamp from POSIX `gettimeofday()`.
39
- #
40
- # struct timeval tv;
41
- # gettimeofday(&tv, NULL);
42
- #
43
- # Timestamp timestamp;
44
- # timestamp.set_seconds(tv.tv_sec);
45
- # timestamp.set_nanos(tv.tv_usec * 1000);
46
- #
47
- # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
48
- #
49
- # FILETIME ft;
50
- # GetSystemTimeAsFileTime(&ft);
51
- # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
52
- #
53
- # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
54
- # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
55
- # Timestamp timestamp;
56
- # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
57
- # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
58
- #
59
- # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
60
- #
61
- # long millis = System.currentTimeMillis();
62
- #
63
- # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
64
- # .setNanos((int) ((millis % 1000) * 1000000)).build();
65
- #
66
- #
67
- # Example 5: Compute Timestamp from current time in Python.
68
- #
69
- # timestamp = Timestamp()
70
- # timestamp.GetCurrentTime()
71
- #
72
- # = JSON Mapping
73
- #
74
- # In JSON format, the Timestamp type is encoded as a string in the
75
- # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
76
- # format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
77
- # where {year} is always expressed using four digits while {month}, {day},
78
- # {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
79
- # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
80
- # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
81
- # is required. A proto3 JSON serializer should always use UTC (as indicated by
82
- # "Z") when printing the Timestamp type and a proto3 JSON parser should be
83
- # able to accept both UTC and other timezones (as indicated by an offset).
84
- #
85
- # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
86
- # 01:30 UTC on January 15, 2017.
87
- #
88
- # In JavaScript, one can convert a Date object to this format using the
89
- # standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
90
- # method. In Python, a standard `datetime.datetime` object can be converted
91
- # to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
92
- # with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
93
- # can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
94
- # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
95
- # ) to obtain a formatter capable of generating timestamps in this format.
96
- # @!attribute [rw] seconds
97
- # @return [Integer]
98
- # Represents seconds of UTC time since Unix epoch
99
- # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
100
- # 9999-12-31T23:59:59Z inclusive.
101
- # @!attribute [rw] nanos
102
- # @return [Integer]
103
- # Non-negative fractions of a second at nanosecond resolution. Negative
104
- # second values with fractions must still have non-negative nanos values
105
- # that count forward in time. Must be from 0 to 999,999,999
106
- # inclusive.
107
- class Timestamp; end
108
- end
109
- end
@@ -1,90 +0,0 @@
1
- # Copyright 2018 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # Wrapper message for `double`.
19
- #
20
- # The JSON representation for `DoubleValue` is JSON number.
21
- # @!attribute [rw] value
22
- # @return [Float]
23
- # The double value.
24
- class DoubleValue; end
25
-
26
- # Wrapper message for `float`.
27
- #
28
- # The JSON representation for `FloatValue` is JSON number.
29
- # @!attribute [rw] value
30
- # @return [Float]
31
- # The float value.
32
- class FloatValue; end
33
-
34
- # Wrapper message for `int64`.
35
- #
36
- # The JSON representation for `Int64Value` is JSON string.
37
- # @!attribute [rw] value
38
- # @return [Integer]
39
- # The int64 value.
40
- class Int64Value; end
41
-
42
- # Wrapper message for `uint64`.
43
- #
44
- # The JSON representation for `UInt64Value` is JSON string.
45
- # @!attribute [rw] value
46
- # @return [Integer]
47
- # The uint64 value.
48
- class UInt64Value; end
49
-
50
- # Wrapper message for `int32`.
51
- #
52
- # The JSON representation for `Int32Value` is JSON number.
53
- # @!attribute [rw] value
54
- # @return [Integer]
55
- # The int32 value.
56
- class Int32Value; end
57
-
58
- # Wrapper message for `uint32`.
59
- #
60
- # The JSON representation for `UInt32Value` is JSON number.
61
- # @!attribute [rw] value
62
- # @return [Integer]
63
- # The uint32 value.
64
- class UInt32Value; end
65
-
66
- # Wrapper message for `bool`.
67
- #
68
- # The JSON representation for `BoolValue` is JSON `true` and `false`.
69
- # @!attribute [rw] value
70
- # @return [true, false]
71
- # The bool value.
72
- class BoolValue; end
73
-
74
- # Wrapper message for `string`.
75
- #
76
- # The JSON representation for `StringValue` is JSON string.
77
- # @!attribute [rw] value
78
- # @return [String]
79
- # The string value.
80
- class StringValue; end
81
-
82
- # Wrapper message for `bytes`.
83
- #
84
- # The JSON representation for `BytesValue` is JSON string.
85
- # @!attribute [rw] value
86
- # @return [String]
87
- # The bytes value.
88
- class BytesValue; end
89
- end
90
- end
@@ -1,84 +0,0 @@
1
- # Copyright 2018 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Rpc
18
- # The `Status` type defines a logical error model that is suitable for different
19
- # programming environments, including REST APIs and RPC APIs. It is used by
20
- # [gRPC](https://github.com/grpc). The error model is designed to be:
21
- #
22
- # * Simple to use and understand for most users
23
- # * Flexible enough to meet unexpected needs
24
- #
25
- # = Overview
26
- #
27
- # The `Status` message contains three pieces of data: error code, error message,
28
- # and error details. The error code should be an enum value of
29
- # {Google::Rpc::Code}, but it may accept additional error codes if needed. The
30
- # error message should be a developer-facing English message that helps
31
- # developers *understand* and *resolve* the error. If a localized user-facing
32
- # error message is needed, put the localized message in the error details or
33
- # localize it in the client. The optional error details may contain arbitrary
34
- # information about the error. There is a predefined set of error detail types
35
- # in the package `google.rpc` that can be used for common error conditions.
36
- #
37
- # = Language mapping
38
- #
39
- # The `Status` message is the logical representation of the error model, but it
40
- # is not necessarily the actual wire format. When the `Status` message is
41
- # exposed in different client libraries and different wire protocols, it can be
42
- # mapped differently. For example, it will likely be mapped to some exceptions
43
- # in Java, but more likely mapped to some error codes in C.
44
- #
45
- # = Other uses
46
- #
47
- # The error model and the `Status` message can be used in a variety of
48
- # environments, either with or without APIs, to provide a
49
- # consistent developer experience across different environments.
50
- #
51
- # Example uses of this error model include:
52
- #
53
- # * Partial errors. If a service needs to return partial errors to the client,
54
- # it may embed the `Status` in the normal response to indicate the partial
55
- # errors.
56
- #
57
- # * Workflow errors. A typical workflow has multiple steps. Each step may
58
- # have a `Status` message for error reporting.
59
- #
60
- # * Batch operations. If a client uses batch request and batch response, the
61
- # `Status` message should be used directly inside batch response, one for
62
- # each error sub-response.
63
- #
64
- # * Asynchronous operations. If an API call embeds asynchronous operation
65
- # results in its response, the status of those operations should be
66
- # represented directly using the `Status` message.
67
- #
68
- # * Logging. If some API errors are stored in logs, the message `Status` could
69
- # be used directly after any stripping needed for security/privacy reasons.
70
- # @!attribute [rw] code
71
- # @return [Integer]
72
- # The status code, which should be an enum value of {Google::Rpc::Code}.
73
- # @!attribute [rw] message
74
- # @return [String]
75
- # A developer-facing error message, which should be in English. Any
76
- # user-facing error message should be localized and sent in the
77
- # {Google::Rpc::Status#details} field, or localized by the client.
78
- # @!attribute [rw] details
79
- # @return [Array<Google::Protobuf::Any>]
80
- # A list of messages that carry the error details. There is a common set of
81
- # message types for APIs to use.
82
- class Status; end
83
- end
84
- end
@@ -1,156 +0,0 @@
1
- # Copyright 2018 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Type
18
- # Represents a color in the RGBA color space. This representation is designed
19
- # for simplicity of conversion to/from color representations in various
20
- # languages over compactness; for example, the fields of this representation
21
- # can be trivially provided to the constructor of "java.awt.Color" in Java; it
22
- # can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha"
23
- # method in iOS; and, with just a little work, it can be easily formatted into
24
- # a CSS "rgba()" string in JavaScript, as well. Here are some examples:
25
- #
26
- # Example (Java):
27
- #
28
- # import com.google.type.Color;
29
- #
30
- # // ...
31
- # public static java.awt.Color fromProto(Color protocolor) {
32
- # float alpha = protocolor.hasAlpha()
33
- # ? protocolor.getAlpha().getValue()
34
- # : 1.0;
35
- #
36
- # return new java.awt.Color(
37
- # protocolor.getRed(),
38
- # protocolor.getGreen(),
39
- # protocolor.getBlue(),
40
- # alpha);
41
- # }
42
- #
43
- # public static Color toProto(java.awt.Color color) {
44
- # float red = (float) color.getRed();
45
- # float green = (float) color.getGreen();
46
- # float blue = (float) color.getBlue();
47
- # float denominator = 255.0;
48
- # Color.Builder resultBuilder =
49
- # Color
50
- # .newBuilder()
51
- # .setRed(red / denominator)
52
- # .setGreen(green / denominator)
53
- # .setBlue(blue / denominator);
54
- # int alpha = color.getAlpha();
55
- # if (alpha != 255) {
56
- # result.setAlpha(
57
- # FloatValue
58
- # .newBuilder()
59
- # .setValue(((float) alpha) / denominator)
60
- # .build());
61
- # }
62
- # return resultBuilder.build();
63
- # }
64
- # // ...
65
- #
66
- # Example (iOS / Obj-C):
67
- #
68
- # // ...
69
- # static UIColor* fromProto(Color* protocolor) {
70
- # float red = [protocolor red];
71
- # float green = [protocolor green];
72
- # float blue = [protocolor blue];
73
- # FloatValue* alpha_wrapper = [protocolor alpha];
74
- # float alpha = 1.0;
75
- # if (alpha_wrapper != nil) {
76
- # alpha = [alpha_wrapper value];
77
- # }
78
- # return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
79
- # }
80
- #
81
- # static Color* toProto(UIColor* color) {
82
- # CGFloat red, green, blue, alpha;
83
- # if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
84
- # return nil;
85
- # }
86
- # Color* result = [Color alloc] init];
87
- # [result setRed:red];
88
- # [result setGreen:green];
89
- # [result setBlue:blue];
90
- # if (alpha <= 0.9999) {
91
- # [result setAlpha:floatWrapperWithValue(alpha)];
92
- # }
93
- # [result autorelease];
94
- # return result;
95
- # }
96
- # // ...
97
- #
98
- # Example (JavaScript):
99
- #
100
- # // ...
101
- #
102
- # var protoToCssColor = function(rgb_color) {
103
- # var redFrac = rgb_color.red || 0.0;
104
- # var greenFrac = rgb_color.green || 0.0;
105
- # var blueFrac = rgb_color.blue || 0.0;
106
- # var red = Math.floor(redFrac * 255);
107
- # var green = Math.floor(greenFrac * 255);
108
- # var blue = Math.floor(blueFrac * 255);
109
- #
110
- # if (!('alpha' in rgb_color)) {
111
- # return rgbToCssColor_(red, green, blue);
112
- # }
113
- #
114
- # var alphaFrac = rgb_color.alpha.value || 0.0;
115
- # var rgbParams = [red, green, blue].join(',');
116
- # return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
117
- # };
118
- #
119
- # var rgbToCssColor_ = function(red, green, blue) {
120
- # var rgbNumber = new Number((red << 16) | (green << 8) | blue);
121
- # var hexString = rgbNumber.toString(16);
122
- # var missingZeros = 6 - hexString.length;
123
- # var resultBuilder = ['#'];
124
- # for (var i = 0; i < missingZeros; i++) {
125
- # resultBuilder.push('0');
126
- # }
127
- # resultBuilder.push(hexString);
128
- # return resultBuilder.join('');
129
- # };
130
- #
131
- # // ...
132
- # @!attribute [rw] red
133
- # @return [Float]
134
- # The amount of red in the color as a value in the interval [0, 1].
135
- # @!attribute [rw] green
136
- # @return [Float]
137
- # The amount of green in the color as a value in the interval [0, 1].
138
- # @!attribute [rw] blue
139
- # @return [Float]
140
- # The amount of blue in the color as a value in the interval [0, 1].
141
- # @!attribute [rw] alpha
142
- # @return [Google::Protobuf::FloatValue]
143
- # The fraction of this color that should be applied to the pixel. That is,
144
- # the final pixel color is defined by the equation:
145
- #
146
- # pixel color = alpha * (this color) + (1.0 - alpha) * (background color)
147
- #
148
- # This means that a value of 1.0 corresponds to a solid color, whereas
149
- # a value of 0.0 corresponds to a completely transparent color. This
150
- # uses a wrapper message rather than a simple float scalar so that it is
151
- # possible to distinguish between a default value and the value being unset.
152
- # If omitted, this color object is to be rendered as a solid color
153
- # (as if the alpha value had been explicitly given with a value of 1.0).
154
- class Color; end
155
- end
156
- end