looker-sdk 0.1.6 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/lib/looker-sdk/client.rb +8 -6
  4. data/lib/looker-sdk/error.rb +1 -1
  5. data/lib/looker-sdk/version.rb +1 -1
  6. data/test/helper.rb +11 -5
  7. data/test/looker/swagger.json +42011 -1117
  8. data/test/looker/test_client.rb +19 -15
  9. data/test/looker/test_dynamic_client.rb +36 -34
  10. data/test/looker/test_dynamic_client_agent.rb +45 -12
  11. metadata +9 -40
  12. data/.github/scripts/wait_for_looker.sh +0 -35
  13. data/.github/workflows/release-metrics.yml +0 -44
  14. data/.github/workflows/release.yml +0 -47
  15. data/.github/workflows/ruby-ci.yml +0 -137
  16. data/.gitignore +0 -60
  17. data/.ruby-gemset +0 -1
  18. data/Gemfile +0 -22
  19. data/Gemfile.lock +0 -73
  20. data/Makefile +0 -81
  21. data/Rakefile +0 -38
  22. data/examples/.netrc +0 -1
  23. data/examples/add_delete_users.rb +0 -118
  24. data/examples/change_credentials_email_address_for_users.rb +0 -47
  25. data/examples/convert_look_to_lookless_tile.rb +0 -71
  26. data/examples/create_credentials_email_for_users.rb +0 -43
  27. data/examples/delete_all_user_sessions.rb +0 -39
  28. data/examples/delete_credentials_google_for_users.rb +0 -43
  29. data/examples/errors.rb +0 -47
  30. data/examples/generate_password_reset_tokens_for_users.rb +0 -43
  31. data/examples/ldap_roles_test.rb +0 -74
  32. data/examples/me.rb +0 -27
  33. data/examples/refresh_user_notification_addresses.rb +0 -34
  34. data/examples/roles_and_users_with_permission.rb +0 -46
  35. data/examples/sdk_setup.rb +0 -45
  36. data/examples/streaming_downloads.rb +0 -44
  37. data/examples/users_with_credentials_email.rb +0 -30
  38. data/examples/users_with_credentials_embed.rb +0 -33
  39. data/examples/users_with_credentials_google.rb +0 -30
  40. data/examples/users_with_credentials_google_without_credentials_email.rb +0 -30
  41. data/looker-sdk.gemspec +0 -32
  42. data/shell/.gitignore +0 -41
  43. data/shell/.netrc +0 -3
  44. data/shell/Gemfile +0 -6
  45. data/shell/readme.md +0 -18
  46. data/shell/shell.rb +0 -62
  47. data/shell.nix +0 -38
  48. data/test/fixtures/.netrc.template +0 -1
@@ -1,43 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- $stdin.each_line do |line|
28
- line.chomp!
29
-
30
- id, email = line.split(',', 2).map(&:strip)
31
-
32
- begin
33
- user = sdk.user(id)
34
- if user.credentials_email
35
- puts "Error: User with id '#{id}' Already has credentials_email"
36
- else
37
- sdk.create_user_credentials_email(id, {:email => email})
38
- puts "Success: Created credentials_email for User with id '#{id}' and email '#{email}'"
39
- end
40
- rescue LookerSDK::NotFound
41
- puts "Error: User with id '#{id}' Not found"
42
- end
43
- end
@@ -1,39 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- total_count = 0
28
- sdk.all_users(:fields => 'id, display_name').each do |user|
29
- count = 0
30
- sdk.all_user_sessions(user.id, :fields => 'id').each do |session|
31
- sdk.delete_user_session(user.id, session.id)
32
- count += 1
33
- end
34
- puts "Deleted #{count} sessions for #{user.id} #{user.display_name}"
35
- total_count += count
36
- end
37
- puts "Deleted #{total_count} sessions"
38
-
39
-
@@ -1,43 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- $stdin.each_line do |line|
28
- line.chomp!
29
-
30
- id, _ = line.split(',', 2).map(&:strip)
31
-
32
- begin
33
- user = sdk.user(id)
34
- if user.credentials_google
35
- sdk.delete_user_credentials_google(id)
36
- puts "Success: Deleted credentials_google for User with id '#{id}'"
37
- else
38
- puts "Error: User with id '#{id}' Does not have credentials_google"
39
- end
40
- rescue LookerSDK::NotFound
41
- puts "Error: User with id '#{id}' Not found"
42
- end
43
- end
data/examples/errors.rb DELETED
@@ -1,47 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- begin
28
- puts sdk.validate_theme({}).inspect
29
- rescue LookerSDK::Error => e
30
- puts e
31
- end
32
-
33
- puts "\n\n"
34
-
35
- begin
36
- puts sdk.connection("foo").inspect
37
- rescue LookerSDK::Error => e
38
- puts e
39
- end
40
-
41
- puts "\n\n"
42
-
43
- begin
44
- puts sdk.run_look(1,"foo").inspect
45
- rescue LookerSDK::Error => e
46
- puts e
47
- end
@@ -1,43 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- $stdin.each_line do |line|
28
- line.chomp!
29
-
30
- id = line.split(',', 2).map(&:strip).first
31
-
32
- begin
33
- user = sdk.user(id)
34
- if user.credentials_email
35
- token = sdk.create_user_credentials_email_password_reset(id)
36
- puts "#{token.email},#{token.password_reset_url}"
37
- else
38
- puts "Error: User with id '#{id}' Does not have credentials_email"
39
- end
40
- rescue LookerSDK::NotFound
41
- puts "Error: User with id '#{id}' Not found"
42
- end
43
- end
@@ -1,74 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- ############################################################################################
28
- # simulate a list read from file
29
-
30
- user_list = <<-ENDMARK
31
-
32
- mward
33
- mwhite
34
- missing
35
-
36
- ENDMARK
37
-
38
- ############################################################################################
39
- # helpers
40
-
41
- def ldap_config
42
- @ldap_config ||= sdk.ldap_config.to_attrs
43
- end
44
-
45
- def groups_map_for_config
46
- @groups_map_for_config ||= ldap_config[:groups].map do |group|
47
- {:name => group[:name], :role_ids => group[:roles].map{|role| role[:id]}}
48
- end
49
- end
50
-
51
- def test_ldap_user(user)
52
- params = ldap_config.merge({:groups_with_role_ids => groups_map_for_config, :test_ldap_user => user})
53
- sdk.test_ldap_config_user_info(params)
54
- end
55
-
56
- ############################################################################################
57
- # process the list and puts results
58
-
59
- user_list.each_line do |user|
60
- user.strip!
61
- next if user.empty?
62
-
63
- puts "'#{user}' ..."
64
-
65
- result = test_ldap_user(user).to_attrs
66
- if result[:status] == 'success'
67
- puts "Success"
68
- puts result[:user]
69
- else
70
- puts "FAILURE"
71
- puts result
72
- end
73
- puts
74
- end
data/examples/me.rb DELETED
@@ -1,27 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- puts sdk.me.inspect
@@ -1,34 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- sdk.all_users(:fields => 'id,email').each do |user|
28
- new_user = sdk.update_user(user.id, {})
29
- if user.email == new_user.email
30
- puts "No Change for #{user.id}"
31
- else
32
- puts "Refreshed #{user.id}. Old email '#{user.email}'. Refreshed email: '#{new_user.email}'."
33
- end
34
- end
@@ -1,46 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
-
28
- while true do
29
- print "permission [,model]? "
30
- permission_name, model_name = gets.chomp.split(',')
31
-
32
- break if permission_name.empty?
33
-
34
- roles = sdk.all_roles.select do |role|
35
- (role.permission_set.all_access || role.permission_set.permissions.join(',').include?(permission_name)) &&
36
- (model_name.nil? || role.model_set.all_access || role.model_set.models.join(',').include?(model_name))
37
- end
38
-
39
- puts "Roles: #{roles.map(&:name).join(', ')}"
40
-
41
- role_ids = roles.map(&:id)
42
- users = sdk.all_users.select {|user| (user.role_ids & role_ids).any?}
43
- user_names = users.map{|u| "#{u.id}#{" ("+u.display_name+")" if u.display_name}"}.join(', ')
44
-
45
- puts "Users: #{user_names}"
46
- end
@@ -1,45 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require 'rubygems'
26
- require 'bundler/setup'
27
-
28
- require 'looker-sdk'
29
-
30
- # common file used by various examples to setup and init sdk
31
-
32
- def sdk
33
- @sdk ||= LookerSDK::Client.new(
34
- :netrc => true,
35
- :netrc_file => "./.netrc",
36
-
37
- # use my local looker with self-signed cert
38
- :connection_options => {:ssl => {:verify => false}},
39
- :api_endpoint => "https://localhost:19999/api/4.0",
40
-
41
- # use a real looker the way you are supposed to!
42
- # :connection_options => {:ssl => {:verify => true}},
43
- # :api_endpoint => "https://mycoolcompany.looker.com:19999/api/4.0",
44
- )
45
- end
@@ -1,44 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- # This snippet shows how to download sdk responses using http streaming.
28
- # Streaming processes the download in chunks which you can write
29
- # to file or perform other processing on without having to wait for the entire
30
- # response to download first. Streaming can be very memory efficient
31
- # for handling large result sets compared to just downloading the whole thing into
32
- # a Ruby object in memory.
33
-
34
- def run_look_to_file(look_id, filename, format, opts = {})
35
- File.open(filename, 'w') do |file|
36
- sdk.run_look(look_id, format, opts) do |data, progress|
37
- file.write(data)
38
- puts "Wrote #{data.length} bytes of #{progress.length} total"
39
- end
40
- end
41
- end
42
-
43
- # Replace the look id (38) with the id of your actual look
44
- run_look_to_file(38, 'out.csv', 'csv', limit: 10000)
@@ -1,30 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- users = sdk.all_users(:fields => 'id, is_disabled, credentials_email').
28
- select {|u| !u.is_diabled && u.credentials_email && u.credentials_email.email}
29
-
30
- users.each {|u| puts "#{u.id},#{u.credentials_email.email}"}
@@ -1,33 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- users = sdk.all_users(fields:'id, is_disabled, display_name, credentials_embed').map do |u|
28
- next if u.is_diabled || u.credentials_embed.empty?
29
- creds = u.credentials_embed.first
30
- [u.id, u.display_name, creds.external_user_id, creds.external_group_id, creds.logged_in_at]
31
- end.compact
32
-
33
- users.each{|u| p u}
@@ -1,30 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- users = sdk.all_users(:fields => 'id, credentials_google').
28
- select {|u| u.credentials_google}
29
-
30
- users.each {|u| puts "#{u.id},#{u.credentials_google.email}"}
@@ -1,30 +0,0 @@
1
- ############################################################################################
2
- # The MIT License (MIT)
3
- #
4
- # Copyright (c) 2022 Looker Data Sciences, Inc.
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining a copy
7
- # of this software and associated documentation files (the "Software"), to deal
8
- # in the Software without restriction, including without limitation the rights
9
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- # copies of the Software, and to permit persons to whom the Software is
11
- # furnished to do so, subject to the following conditions:
12
- #
13
- # The above copyright notice and this permission notice shall be included in
14
- # all copies or substantial portions of the Software.
15
- #
16
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- # THE SOFTWARE.
23
- ############################################################################################
24
-
25
- require './sdk_setup'
26
-
27
- users = sdk.all_users(:fields => 'id, is_disabled, credentials_email, credentials_google').
28
- select {|u| !u.is_diabled && u.credentials_google && u.credentials_google.email && !u.credentials_email}
29
-
30
- users.each {|u| puts "#{u.id},#{u.credentials_google.email}"}
data/looker-sdk.gemspec DELETED
@@ -1,32 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path('../lib', __FILE__)
3
- require 'looker-sdk/version'
4
-
5
- Gem::Specification.new do |s|
6
- s.name = 'looker-sdk'
7
- s.version = LookerSDK::VERSION
8
- s.date = "#{Time.now.strftime('%F')}"
9
- s.authors = ['Looker']
10
- s.email = 'drstrangelove@google.com'
11
- s.homepage = 'https://github.com/looker-open-source/looker-sdk-ruby'
12
- s.summary = %q{Looker Ruby SDK}
13
- s.description = 'Use this SDK to access the Looker API. The Looker API provides functions to perform administrative '+
14
- 'tasks such as provisioning users, configuring database connections, and so on. It also enables you to leverage '+
15
- 'the Looker data analytics engine to fetch data or render visualizations defined in your Looker data models. '+
16
- 'For more information, see https://looker.com.'
17
- s.license = 'MIT'
18
- s.required_ruby_version = '>= 2.7'
19
- s.requirements = 'Looker version 4.0 or later' # informational
20
-
21
- s.files = `git ls-files`.split("\n")
22
- s.test_files = `git ls-files -- {test}/*`.split("\n")
23
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
- s.require_paths = %w(lib)
25
- s.add_dependency 'jruby-openssl' if s.platform == :jruby
26
- s.add_dependency 'sawyer', '~> 0.8'
27
- s.add_dependency 'faraday', ['>= 1.2', '< 3.0']
28
- s.add_development_dependency 'ci_reporter_minitest', '~> 1.0'
29
- s.add_development_dependency 'faraday', '~> 2.7'
30
- s.add_development_dependency 'faraday-rack', '~> 2'
31
- s.add_development_dependency 'faraday-multipart', '~> 1.0'
32
- end