google-api-client 0.9 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile +5 -0
  4. data/README.md +1 -1
  5. data/api_names.yaml +1 -1
  6. data/api_names_out.yaml +14 -8
  7. data/generated/google/apis/adexchangebuyer_v1_3.rb +1 -1
  8. data/generated/google/apis/androidpublisher_v2/classes.rb +1 -1
  9. data/generated/google/apis/androidpublisher_v2/representations.rb +2 -2
  10. data/generated/google/apis/androidpublisher_v2/service.rb +4 -4
  11. data/generated/google/apis/appstate_v1.rb +1 -1
  12. data/generated/google/apis/bigquery_v2.rb +1 -1
  13. data/generated/google/apis/books_v1.rb +1 -1
  14. data/generated/google/apis/books_v1/classes.rb +50 -0
  15. data/generated/google/apis/books_v1/representations.rb +8 -0
  16. data/generated/google/apis/books_v1/service.rb +16 -4
  17. data/generated/google/apis/calendar_v3.rb +1 -1
  18. data/generated/google/apis/compute_beta.rb +1 -1
  19. data/generated/google/apis/compute_beta/classes.rb +141 -93
  20. data/generated/google/apis/compute_beta/representations.rb +1 -0
  21. data/generated/google/apis/compute_beta/service.rb +65 -58
  22. data/generated/google/apis/compute_v1.rb +1 -1
  23. data/generated/google/apis/compute_v1/classes.rb +83 -55
  24. data/generated/google/apis/compute_v1/service.rb +59 -52
  25. data/generated/google/apis/content_v2.rb +1 -1
  26. data/generated/google/apis/content_v2/classes.rb +1 -1
  27. data/generated/google/apis/drive_v2.rb +1 -1
  28. data/generated/google/apis/drive_v3.rb +1 -1
  29. data/generated/google/apis/games_configuration_v1configuration.rb +1 -1
  30. data/generated/google/apis/games_management_v1management.rb +1 -1
  31. data/generated/google/apis/games_v1.rb +1 -1
  32. data/generated/google/apis/genomics_v1.rb +1 -1
  33. data/generated/google/apis/plus_domains_v1.rb +1 -1
  34. data/generated/google/apis/plus_v1.rb +1 -1
  35. data/generated/google/apis/youtube_v3.rb +1 -1
  36. data/generated/google/apis/youtube_v3/classes.rb +9 -61
  37. data/generated/google/apis/youtube_v3/representations.rb +1 -26
  38. data/lib/google/apis/core/upload.rb +1 -0
  39. data/lib/google/apis/version.rb +1 -1
  40. data/samples/{Gemfile → cli/Gemfile} +1 -1
  41. data/samples/{README.md → cli/README.md} +0 -0
  42. data/samples/{google-api-samples → cli/google-api-samples} +0 -0
  43. data/samples/{lib → cli/lib}/base_cli.rb +0 -0
  44. data/samples/{lib → cli/lib}/samples/analytics.rb +0 -0
  45. data/samples/{lib → cli/lib}/samples/calendar.rb +0 -0
  46. data/samples/{lib → cli/lib}/samples/drive.rb +0 -0
  47. data/samples/{lib → cli/lib}/samples/gmail.rb +0 -0
  48. data/samples/{lib → cli/lib}/samples/pubsub.rb +0 -0
  49. data/samples/{lib → cli/lib}/samples/translate.rb +0 -0
  50. data/samples/{lib → cli/lib}/samples/you_tube.rb +0 -0
  51. data/samples/web/Gemfile +7 -0
  52. data/samples/web/README.md +44 -0
  53. data/samples/web/app.rb +120 -0
  54. data/samples/web/views/calendar.erb +34 -0
  55. data/samples/web/views/drive.erb +33 -0
  56. data/samples/web/views/home.erb +35 -0
  57. data/samples/web/views/layout.erb +40 -0
  58. data/spec/google/api_client/client_secrets_spec.rb +300 -1
  59. metadata +20 -13
@@ -0,0 +1,33 @@
1
+ <%#
2
+ # Copyright 2016 Google Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ %>
16
+
17
+ <h5>10 most recently modified files</h5>
18
+ <table class="">
19
+ <thead>
20
+ <tr>
21
+ <th class="">Name</th>
22
+ <th class="">Last Modified</th>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ <% @result.files.each do |file| %>
27
+ <tr>
28
+ <td class=""><a href="<%= file.web_view_link %>"><%= file.name %></a></td>
29
+ <td class=""><%= file.modified_time %></td>
30
+ </tr>
31
+ <% end %>
32
+ </tbody>
33
+ </table>
@@ -0,0 +1,35 @@
1
+ <%#
2
+ # Copyright 2016 Google Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ %>
16
+ <div class="g-signin2" data-onsuccess="onSignIn"></div>
17
+ <script>
18
+ function onSignIn(googleUser) {
19
+ var id_token = googleUser.getAuthResponse().id_token;
20
+ var formData = new FormData();
21
+ formData.append('id_token', id_token);
22
+ var req = new XMLHttpRequest();
23
+ req.addEventListener("load", function() {
24
+ console.log("Log in successful");
25
+ // Successful login...
26
+ });
27
+ req.addEventListener("error", function() {
28
+ console.log("Log in failed");
29
+ // Handle error...
30
+ });
31
+ req.addEventListener()
32
+ req.open("POST", "/signin");
33
+ req.send(formData);
34
+ }
35
+ </script>
@@ -0,0 +1,40 @@
1
+ <%#
2
+ # Copyright 2016 Google Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ %>
16
+ <html>
17
+ <head>
18
+ <script src="https://apis.google.com/js/platform.js" async defer></script>
19
+ <meta name="google-signin-client_id" content="<%= @client_id %>">
20
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
21
+ <style type="text/css">
22
+ .navigation a {
23
+ padding: 10px;
24
+ }
25
+ .main {
26
+ padding: 10px;
27
+ }
28
+ </style>
29
+ </head>
30
+ <body>
31
+ <div class="navigation">
32
+ <a href="/">Home</a>
33
+ <a href="/drive">Google Drive Sample</a>
34
+ <a href="/calendar">Google Calendar Sample</a>
35
+ </div>
36
+ <div class="main">
37
+ <%= yield %>
38
+ </div>
39
+ </body>
40
+ </html>
@@ -21,7 +21,306 @@ require 'google/api_client/client_secrets'
21
21
  FIXTURES_PATH = File.expand_path('../../../fixtures', __FILE__)
22
22
 
23
23
  RSpec.describe Google::APIClient::ClientSecrets do
24
-
24
+ describe '::new' do
25
+ let(:filename) { File.join(FIXTURES_PATH, 'files', 'client_secrets.json') }
26
+ let(:data) { File.open(filename, 'r') { |file| MultiJson.load(file.read) } }
27
+
28
+ context 'without options' do
29
+ subject { Google::APIClient::ClientSecrets.new(data) }
30
+
31
+ describe 'existence of instance variables' do
32
+ it '@access_token' do
33
+ expect(subject).to respond_to(:access_token)
34
+ end
35
+ it '@authorization_uri' do
36
+ expect(subject).to respond_to(:authorization_uri)
37
+ end
38
+ it '@client_id' do
39
+ expect(subject).to respond_to(:client_id)
40
+ end
41
+ it '@client_secret' do
42
+ expect(subject).to respond_to(:client_secret)
43
+ end
44
+ it '@expires_at' do
45
+ expect(subject).to respond_to(:expires_at)
46
+ end
47
+ it '@expires_in' do
48
+ expect(subject).to respond_to(:expires_in)
49
+ end
50
+ it '@id_token' do
51
+ expect(subject).to respond_to(:id_token)
52
+ end
53
+ it '@issued_at' do
54
+ expect(subject).to respond_to(:issued_at)
55
+ end
56
+ it '@javascript_origins' do
57
+ expect(subject).to respond_to(:javascript_origins)
58
+ end
59
+ it '@redirect_uris' do
60
+ expect(subject).to respond_to(:redirect_uris)
61
+ end
62
+ it '@refresh_token' do
63
+ expect(subject).to respond_to(:refresh_token)
64
+ end
65
+ it '@token_credential_uri' do
66
+ expect(subject).to respond_to(:token_credential_uri)
67
+ end
68
+ end
69
+
70
+ describe 'value of instance variables' do
71
+ it 'should set @access_token' do
72
+ expect(subject.access_token).to be_nil
73
+ end
74
+ it 'should set @authorization_uri' do
75
+ expect(subject.authorization_uri).to eq 'https://accounts.google.com/o/oauth2/auth'
76
+ end
77
+ it 'should set @client_id' do
78
+ expect(subject.client_id).to eq '898243283568.apps.googleusercontent.com'
79
+ end
80
+ it 'should set @client_secret' do
81
+ expect(subject.client_secret).to eq 'i8YaXdGgiQ4_KrTVNGsB7QP1'
82
+ end
83
+ it 'should set @expires_at' do
84
+ expect(subject.expires_at).to be_nil
85
+ end
86
+ it 'should set @expires_in' do
87
+ expect(subject.expires_in).to be_nil
88
+ end
89
+ it 'should set @flow' do
90
+ expect(subject.flow).to eq 'installed'
91
+ end
92
+ it 'should set @id_token' do
93
+ expect(subject.id_token).to be_nil
94
+ end
95
+ it 'should set @issued_at' do
96
+ expect(subject.issued_at).to be_nil
97
+ end
98
+ it 'should set @javascript_origins' do
99
+ expect(subject.javascript_origins).to eq []
100
+ end
101
+ it 'should set @redirect_uris' do
102
+ expect(subject.redirect_uris).to eq []
103
+ end
104
+ it 'should set @refresh_token' do
105
+ expect(subject.refresh_token).to be_nil
106
+ end
107
+ it 'should set @token_credential_uri' do
108
+ expect(subject.token_credential_uri).to eq 'https://accounts.google.com/o/oauth2/token'
109
+ end
110
+ end
111
+ end
112
+
113
+ context 'with options' do
114
+ context 'option keys are string' do
115
+ let(:string_options) do
116
+ { 'samples' =>
117
+ {
118
+ 'access_token' => 'sample_access_token',
119
+ 'auth_uri' => 'sample_auth_uri',
120
+ 'authorization_uri' => 'sample_authorization_uri',
121
+ 'client_id' => 'sample_client_id',
122
+ 'client_secret' => 'sample_client_secret',
123
+ 'expires_at' => 'sample_expires_at',
124
+ 'expires_in' => 'sample_expires_in',
125
+ 'id_token' => 'sample_id_token',
126
+ 'issued_at' => 'sample_issued_at',
127
+ 'javascript_origin' => 'sample_javascript_origin',
128
+ 'javascript_origins' => 'sample_javascript_origins',
129
+ 'redirect_uris' => 'sample_redirect_uris',
130
+ 'refresh_token' => 'sample_refresh_token',
131
+ 'token_credential_uri' => 'sample_token_credential_uri',
132
+ 'token_uri' => 'sample_token_uri' } }
133
+ end
134
+ subject { Google::APIClient::ClientSecrets.new(string_options) }
135
+
136
+ describe 'existence of instance variables' do
137
+ it '@access_token' do
138
+ expect(subject).to respond_to(:access_token)
139
+ end
140
+ it '@authorization_uri' do
141
+ expect(subject).to respond_to(:authorization_uri)
142
+ end
143
+ it '@client_id' do
144
+ expect(subject).to respond_to(:client_id)
145
+ end
146
+ it '@client_secret' do
147
+ expect(subject).to respond_to(:client_secret)
148
+ end
149
+ it '@expires_at' do
150
+ expect(subject).to respond_to(:expires_at)
151
+ end
152
+ it '@expires_in' do
153
+ expect(subject).to respond_to(:expires_in)
154
+ end
155
+ it '@id_token' do
156
+ expect(subject).to respond_to(:id_token)
157
+ end
158
+ it '@issued_at' do
159
+ expect(subject).to respond_to(:issued_at)
160
+ end
161
+ it '@javascript_origins' do
162
+ expect(subject).to respond_to(:javascript_origins)
163
+ end
164
+ it '@redirect_uris' do
165
+ expect(subject).to respond_to(:redirect_uris)
166
+ end
167
+ it '@refresh_token' do
168
+ expect(subject).to respond_to(:refresh_token)
169
+ end
170
+ it '@token_credential_uri' do
171
+ expect(subject).to respond_to(:token_credential_uri)
172
+ end
173
+ end
174
+
175
+ describe 'value of instance variables' do
176
+ it 'should set @access_token' do
177
+ expect(subject.access_token).to eq 'sample_access_token'
178
+ end
179
+ it 'should set @authorization_uri' do
180
+ expect(subject.authorization_uri).to eq 'sample_auth_uri'
181
+ end
182
+ it 'should set @client_id' do
183
+ expect(subject.client_id).to eq 'sample_client_id'
184
+ end
185
+ it 'should set @client_secret' do
186
+ expect(subject.client_secret).to eq 'sample_client_secret'
187
+ end
188
+ it 'should set @expires_at' do
189
+ expect(subject.expires_at).to eq 'sample_expires_at'
190
+ end
191
+ it 'should set @expires_in' do
192
+ expect(subject.expires_in).to eq 'sample_expires_in'
193
+ end
194
+ it 'should set @flow' do
195
+ expect(subject.flow).to eq 'samples'
196
+ end
197
+ it 'should set @id_token' do
198
+ expect(subject.id_token).to eq 'sample_id_token'
199
+ end
200
+ it 'should set @issued_at' do
201
+ expect(subject.issued_at).to eq 'sample_issued_at'
202
+ end
203
+ it 'should set @javascript_origins' do
204
+ expect(subject.javascript_origins).to eq 'sample_javascript_origins'
205
+ end
206
+ it 'should set @redirect_uris' do
207
+ expect(subject.redirect_uris).to eq 'sample_redirect_uris'
208
+ end
209
+ it 'should set @refresh_token' do
210
+ expect(subject.refresh_token).to eq 'sample_refresh_token'
211
+ end
212
+ it 'should set @token_credential_uri' do
213
+ expect(subject.token_credential_uri).to eq 'sample_token_uri'
214
+ end
215
+ end
216
+ end
217
+
218
+ context 'option keys are symbol' do
219
+ let(:symbol_options) do
220
+ { 'samples' =>
221
+ {
222
+ access_token: 'sample_access_token',
223
+ auth_uri: 'sample_auth_uri',
224
+ authorization_uri: 'sample_authorization_uri',
225
+ client_id: 'sample_client_id',
226
+ client_secret: 'sample_client_secret',
227
+ expires_at: 'sample_expires_at',
228
+ expires_in: 'sample_expires_in',
229
+ id_token: 'sample_id_token',
230
+ issued_at: 'sample_issued_at',
231
+ javascript_origin: 'sample_javascript_origin',
232
+ javascript_origins: 'sample_javascript_origins',
233
+ redirect_uris: 'sample_redirect_uris',
234
+ refresh_token: 'sample_refresh_token',
235
+ token_credential_uri: 'sample_token_credential_uri',
236
+ token_uri: 'sample_token_uri' } }
237
+ end
238
+ subject { Google::APIClient::ClientSecrets.new(symbol_options) }
239
+
240
+ describe 'existence of instance variables' do
241
+ it '@access_token' do
242
+ expect(subject).to respond_to(:access_token)
243
+ end
244
+ it '@authorization_uri' do
245
+ expect(subject).to respond_to(:authorization_uri)
246
+ end
247
+ it '@client_id' do
248
+ expect(subject).to respond_to(:client_id)
249
+ end
250
+ it '@client_secret' do
251
+ expect(subject).to respond_to(:client_secret)
252
+ end
253
+ it '@expires_at' do
254
+ expect(subject).to respond_to(:expires_at)
255
+ end
256
+ it '@expires_in' do
257
+ expect(subject).to respond_to(:expires_in)
258
+ end
259
+ it '@id_token' do
260
+ expect(subject).to respond_to(:id_token)
261
+ end
262
+ it '@issued_at' do
263
+ expect(subject).to respond_to(:issued_at)
264
+ end
265
+ it '@javascript_origins' do
266
+ expect(subject).to respond_to(:javascript_origins)
267
+ end
268
+ it '@redirect_uris' do
269
+ expect(subject).to respond_to(:redirect_uris)
270
+ end
271
+ it '@refresh_token' do
272
+ expect(subject).to respond_to(:refresh_token)
273
+ end
274
+ it '@token_credential_uri' do
275
+ expect(subject).to respond_to(:token_credential_uri)
276
+ end
277
+ end
278
+
279
+ describe 'value of instance variables' do
280
+ it 'should set @access_token' do
281
+ expect(subject.access_token).to eq 'sample_access_token'
282
+ end
283
+ it 'should set @authorization_uri' do
284
+ expect(subject.authorization_uri).to eq 'sample_auth_uri'
285
+ end
286
+ it 'should set @client_id' do
287
+ expect(subject.client_id).to eq 'sample_client_id'
288
+ end
289
+ it 'should set @client_secret' do
290
+ expect(subject.client_secret).to eq 'sample_client_secret'
291
+ end
292
+ it 'should set @expires_at' do
293
+ expect(subject.expires_at).to eq 'sample_expires_at'
294
+ end
295
+ it 'should set @expires_in' do
296
+ expect(subject.expires_in).to eq 'sample_expires_in'
297
+ end
298
+ it 'should set @flow' do
299
+ expect(subject.flow).to eq 'samples'
300
+ end
301
+ it 'should set @id_token' do
302
+ expect(subject.id_token).to eq 'sample_id_token'
303
+ end
304
+ it 'should set @issued_at' do
305
+ expect(subject.issued_at).to eq 'sample_issued_at'
306
+ end
307
+ it 'should set @javascript_origins' do
308
+ expect(subject.javascript_origins).to eq 'sample_javascript_origins'
309
+ end
310
+ it 'should set @redirect_uris' do
311
+ expect(subject.redirect_uris).to eq 'sample_redirect_uris'
312
+ end
313
+ it 'should set @refresh_token' do
314
+ expect(subject.refresh_token).to eq 'sample_refresh_token'
315
+ end
316
+ it 'should set @token_credential_uri' do
317
+ expect(subject.token_credential_uri).to eq 'sample_token_uri'
318
+ end
319
+ end
320
+ end
321
+ end
322
+ end
323
+
25
324
  context 'with JSON file' do
26
325
  let(:file) { File.join(FIXTURES_PATH, 'files', 'client_secrets.json') }
27
326
  subject(:secrets) { Google::APIClient::ClientSecrets.load(file)}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.9'
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Bazyl
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-01-15 00:00:00.000000000 Z
14
+ date: 2016-01-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: representable
@@ -592,17 +592,24 @@ files:
592
592
  - rakelib/rubocop.rake
593
593
  - rakelib/spec.rake
594
594
  - rakelib/yard.rake
595
- - samples/Gemfile
596
- - samples/README.md
597
- - samples/google-api-samples
598
- - samples/lib/base_cli.rb
599
- - samples/lib/samples/analytics.rb
600
- - samples/lib/samples/calendar.rb
601
- - samples/lib/samples/drive.rb
602
- - samples/lib/samples/gmail.rb
603
- - samples/lib/samples/pubsub.rb
604
- - samples/lib/samples/translate.rb
605
- - samples/lib/samples/you_tube.rb
595
+ - samples/cli/Gemfile
596
+ - samples/cli/README.md
597
+ - samples/cli/google-api-samples
598
+ - samples/cli/lib/base_cli.rb
599
+ - samples/cli/lib/samples/analytics.rb
600
+ - samples/cli/lib/samples/calendar.rb
601
+ - samples/cli/lib/samples/drive.rb
602
+ - samples/cli/lib/samples/gmail.rb
603
+ - samples/cli/lib/samples/pubsub.rb
604
+ - samples/cli/lib/samples/translate.rb
605
+ - samples/cli/lib/samples/you_tube.rb
606
+ - samples/web/Gemfile
607
+ - samples/web/README.md
608
+ - samples/web/app.rb
609
+ - samples/web/views/calendar.erb
610
+ - samples/web/views/drive.erb
611
+ - samples/web/views/home.erb
612
+ - samples/web/views/layout.erb
606
613
  - script/generate
607
614
  - script/package
608
615
  - script/release