looker-sdk 0.0.5 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +3 -0
  3. data/.travis.yml +1 -2
  4. data/CODE_OF_CONDUCT.md +46 -0
  5. data/Gemfile +1 -1
  6. data/LICENSE.md +33 -0
  7. data/Makefile +81 -0
  8. data/Rakefile +24 -27
  9. data/authentication.md +3 -3
  10. data/examples/add_delete_users.rb +24 -0
  11. data/examples/change_credentials_email_address_for_users.rb +24 -0
  12. data/examples/convert_look_to_lookless_tile.rb +71 -0
  13. data/examples/create_credentials_email_for_users.rb +24 -0
  14. data/examples/delete_all_user_sessions.rb +24 -0
  15. data/examples/delete_credentials_google_for_users.rb +24 -0
  16. data/examples/generate_password_reset_tokens_for_users.rb +24 -0
  17. data/examples/ldap_roles_test.rb +24 -0
  18. data/examples/me.rb +24 -0
  19. data/examples/refresh_user_notification_addresses.rb +24 -0
  20. data/examples/roles_and_users_with_permission.rb +24 -0
  21. data/examples/sdk_setup.rb +24 -0
  22. data/examples/streaming_downloads.rb +24 -0
  23. data/examples/users_with_credentials_email.rb +24 -0
  24. data/examples/users_with_credentials_embed.rb +33 -0
  25. data/examples/users_with_credentials_google.rb +23 -1
  26. data/examples/users_with_credentials_google_without_credentials_email.rb +24 -0
  27. data/lib/looker-sdk/authentication.rb +27 -2
  28. data/lib/looker-sdk/client/dynamic.rb +61 -11
  29. data/lib/looker-sdk/client.rb +86 -21
  30. data/lib/looker-sdk/configurable.rb +28 -2
  31. data/lib/looker-sdk/default.rb +30 -0
  32. data/lib/looker-sdk/error.rb +28 -0
  33. data/lib/looker-sdk/rate_limit.rb +24 -0
  34. data/lib/looker-sdk/response/raise_error.rb +25 -3
  35. data/lib/looker-sdk/sawyer_patch.rb +25 -1
  36. data/lib/looker-sdk/version.rb +25 -1
  37. data/lib/looker-sdk.rb +50 -0
  38. data/looker-sdk.gemspec +4 -3
  39. data/readme.md +12 -9
  40. data/shell/.netrc +3 -1
  41. data/shell/shell.rb +27 -2
  42. data/test/fixtures/{.netrc → .netrc.template} +0 -0
  43. data/test/helper.rb +26 -2
  44. data/test/looker/swagger.json +74 -3
  45. data/test/looker/test_client.rb +102 -6
  46. data/test/looker/test_dynamic_client.rb +101 -4
  47. data/test/looker/test_dynamic_client_agent.rb +24 -0
  48. metadata +50 -22
  49. data/LICENSE +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a9c372139d8df28af2b71bce4382f3badfa6d1c8
4
- data.tar.gz: 66910d788e066ef3767f76966e1973ca7312e3c4
2
+ SHA256:
3
+ metadata.gz: 7480e445027628e633f47b881756e0360920f3b3ddb141848abd347096d83a8a
4
+ data.tar.gz: 2f9053023f611ac12ffe6ded9b74ff404374e9a6e6c8509f3e5a2a882015d1d4
5
5
  SHA512:
6
- metadata.gz: 043052d8df89d53724b1fe23e181ae5eafb598ff4aca2dd44d8d030510ffe98dffeb8c51a9a180c594b64597500d42b13db84f08d1969fcdb3d571c98e9eb49e
7
- data.tar.gz: 8627156eb5061245b16330094381786800e1c32c1fbb8340297e962429a97ad14cc75e2fc2fe8073297e4c7b61751298c629da8ee65721c38c0b5975b643f644
6
+ metadata.gz: 63830cee4b417adcc93d9e4d782f50454c042aa182d5f0cba3a240c7458802e7059723865add292d45578fe10b269fcc73f78f504535cd9f352a4d45ed439299
7
+ data.tar.gz: b65b1344ab6c24edfbe9d5fefc3a76bdcc170b3b0159fa83688291cf67c6b42a59ca5af7e3e0d8cb9978fe260c82641026fa9da03fa1d7fb381a95c82bd1ec80
data/.gitignore CHANGED
@@ -50,3 +50,6 @@ test/tmp
50
50
  test/version_tmp
51
51
  tmp
52
52
  *.netrc
53
+
54
+ # credentials for testing
55
+ .netrc
data/.travis.yml CHANGED
@@ -1,10 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
3
  - 2.0
5
4
  - 2.1
6
5
  - 2.3.1
7
- - jruby-1.7.19
6
+ - jruby-1.7.27
8
7
  - jruby-9.1.5.0
9
8
  cache:
10
9
  bundler: true
@@ -0,0 +1,46 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior by participants include:
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
+
29
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at opensource@looker.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
+
45
+ [homepage]: http://contributor-covenant.org
46
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -11,7 +11,7 @@ end
11
11
 
12
12
  group :test do
13
13
  # gem 'json', '~> 1.7', :platforms => [:jruby] look TODO needed?
14
- gem 'minitest', '5.3.5'
14
+ gem 'minitest', '5.9.1'
15
15
  gem 'mocha', '1.1.0'
16
16
  gem 'rack', '1.6.4'
17
17
  gem 'rack-test', '0.6.2'
data/LICENSE.md ADDED
@@ -0,0 +1,33 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Looker Data Sciences, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+
23
+ The Looker SDK for Ruby is based in part on [Octokit](https://github.com/octokit/octokit.rb).
24
+
25
+ Octokit's license:
26
+
27
+ Copyright (c) 2009-2014 Wynn Netherland, Adam Stacoviak, Erik Michaels-Ober
28
+
29
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
30
+
31
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
32
+
33
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Makefile ADDED
@@ -0,0 +1,81 @@
1
+ #############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2014 Zee Spencer
5
+ # Copyright (c) 2020 Google LLC
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ #############################################################################################
25
+
26
+ # Allows running (and re-running) of tests against several ruby versions,
27
+ # assuming you use rbenv instead of rvm.
28
+
29
+ # Uses pattern rules (task-$:) and automatic variables ($*).
30
+ # Pattern rules: http://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_10.html#SEC98
31
+ # Automatic variables: http://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_10.html#SEC101
32
+
33
+ # Rbenv-friendly version identifiers for supported Rubys
34
+ 25_version = 2.5.7
35
+ jruby_92160_version = jruby-9.2.16.0
36
+
37
+ # The ruby version for use in a given rule.
38
+ # Requires a matched pattern rule and a supported ruby version.
39
+ #
40
+ # Given a pattern rule defined as "install-ruby-%"
41
+ # When the rule is ran as "install-ruby-193"
42
+ # Then the inner addsuffix call evaluates to "193_version"
43
+ # And given_ruby_version becomes "1.9.3-p551"
44
+ given_ruby_version = $($(addsuffix _version, $*))
45
+
46
+ # Instruct rbenv on which Ruby version to use when running a command.
47
+ # Requires a pattern rule and a supported ruby version.
48
+ #
49
+ # Given a pattern rule defined as "test-%"
50
+ # When the rule is ran as "test-187"
51
+ # Then with_given_ruby becomes "RBENV_VERSION=1.8.7-p375"
52
+ with_given_ruby = RBENV_VERSION=$(given_ruby_version)
53
+
54
+ # Runs tests for all supported ruby versions.
55
+ test: test-25 test-jruby_92160
56
+
57
+ # Runs tests against a specific ruby version
58
+ test-%:
59
+ rm -f Gemfile.lock
60
+ $(with_given_ruby) bundle install --quiet
61
+ $(with_given_ruby) bundle exec rake
62
+
63
+ # Installs all ruby versions and their gems
64
+ install: install-25 install-jruby_92160
65
+
66
+ # Install a particular ruby version
67
+ install-ruby-%:
68
+ rm -f Gemfile.lock
69
+ rbenv install -s $(given_ruby_version)
70
+
71
+ # Install gems into a specific ruby version
72
+ install-gems-%:
73
+ rm -f Gemfile.lock
74
+ $(with_given_ruby) gem update --system
75
+ $(with_given_ruby) gem install bundler
76
+ $(with_given_ruby) bundle install
77
+
78
+ # Installs a specific ruby version and it's gems
79
+ # At the bottom so it doesn't match install-gems and install-ruby tasks.
80
+ install-%:
81
+ make install-ruby-$* install-gems-$*
data/Rakefile CHANGED
@@ -1,4 +1,27 @@
1
- require 'bundler'
1
+ ############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2018 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
+
2
25
  require "bundler/gem_tasks"
3
26
 
4
27
  require "rake/testtask"
@@ -8,30 +31,4 @@ Rake::TestTask.new do |t|
8
31
  t.verbose = true
9
32
  end
10
33
 
11
- namespace :test do
12
- desc "Run tests against all supported Rubies"
13
- task :all do
14
- supported_rubies = ['ruby-1.9.3', 'ruby-2.0', 'ruby-2.1', 'ruby-2.3.1', 'jruby-1.7.19', 'jruby-9.1.5.0']
15
- failing_rubies = []
16
-
17
- supported_rubies.each do |ruby|
18
- cmd = "rvm install #{ruby} && rvm #{ruby} exec gem install bundler && rvm #{ruby} exec bundle install && rvm #{ruby} exec bundle exec rake"
19
- system cmd
20
- if $? != 0
21
- failing_rubies << ruby
22
- end
23
- end
24
-
25
- failing_rubies.each do |ruby|
26
- puts "FAIL: #{ruby}. Problem with the tests on #{ruby}."
27
- end
28
-
29
- if failing_rubies
30
- exit 1
31
- else
32
- exit 0
33
- end
34
- end
35
- end
36
-
37
34
  task :default => :test
data/authentication.md CHANGED
@@ -22,7 +22,7 @@ Note that API 3 tokens should be created for 'regular' Looker users and *not* vi
22
22
 
23
23
 
24
24
  ### Ensure that the API is accessible
25
- Looker versions 3.4 (and beyond) expose the 3.0 API via a port different from the port used by the web app.
25
+ Looker versions 3.4 (and beyond) expose the API via a port different from the port used by the web app.
26
26
  The default port is 19999. It may be necessary to have the Ops team managing the looker instance ensure that this
27
27
  port is made accessible network-wise to client software running on non-local hosts.
28
28
 
@@ -78,14 +78,14 @@ Content-Length: 99
78
78
  {"access_token":"4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4","token_type":"Bearer","expires_in":3600}
79
79
 
80
80
  # Use an access_token (the token can be used over and over for API calls until it expires)
81
- > curl -i -H "Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4" https://localhost:19999/api/3.0/user
81
+ > curl -i -H "Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4" https://localhost:19999/api/4.0/user
82
82
  HTTP/1.1 200 OK
83
83
  Content-Type: application/json;charset=utf-8
84
84
  Vary: Accept-Encoding
85
85
  X-Content-Type-Options: nosniff
86
86
  Content-Length: 502
87
87
 
88
- {"id":14,"first_name":"Plain","last_name":"User","email":"dude+1@looker.com","models_dir":null,"is_disabled":false,"look_access":[14],"avatar_url":"https://www.gravatar.com/avatar/b7f792a6180a36a4058f36875584bc45?s=156&d=mm","credentials_email":{"email":"dude+1@looker.com","url":"https://localhost:19999/api/3.0/users/14/credentials_email","user_url":"https://localhost:19999/api/3.0/users/14","password_reset_url":"https://localhost:19999/api/3.0"},"url":"https://localhost:19999/api/3.0/users/14"}
88
+ {"id":14,"first_name":"Plain","last_name":"User","email":"dude+1@looker.com","models_dir":null,"is_disabled":false,"look_access":[14],"avatar_url":"https://www.gravatar.com/avatar/b7f792a6180a36a4058f36875584bc45?s=156&d=mm","credentials_email":{"email":"dude+1@looker.com","url":"https://localhost:19999/api/4.0/users/14/credentials_email","user_url":"https://localhost:19999/api/4.0/users/14","password_reset_url":"https://localhost:19999/api/4.0"},"url":"https://localhost:19999/api/4.0/users/14"}
89
89
 
90
90
  # Logout to revoke an access_token
91
91
  > curl -i -X DELETE -H "Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4" https://localhost:19999/logout
@@ -1,3 +1,27 @@
1
+ ############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2018 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
+
1
25
  require './sdk_setup'
2
26
 
3
27
  ############################################################################################
@@ -1,3 +1,27 @@
1
+ ############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2018 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
+
1
25
  require './sdk_setup'
2
26
 
3
27
  users = Hash[
@@ -0,0 +1,71 @@
1
+ ############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2018 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 'looker-sdk'
26
+ require 'json'
27
+
28
+ # Note that this example requires API 3.1 for new dashboard element manipulation functions
29
+
30
+ sdk = LookerSDK::Client.new(
31
+ :client_id => ENV['KEY'],
32
+ :client_secret => ENV['SECRET'],
33
+
34
+ # API 3.1 URL would look like: https://myhost.com:19999/api/3.1
35
+ :api_endpoint => ENV['URL']
36
+ )
37
+ #Set the dashboard here.
38
+ dashboard_id = ENV['DASHBOARD_ID']
39
+ # Get the dashboard we want to convert and get elements
40
+
41
+ dashboard = sdk.dashboard(dashboard_id).to_h
42
+
43
+ elements = dashboard[:dashboard_elements]
44
+ if dashboard then puts "Dashboard has been received" end
45
+
46
+ for element in elements
47
+
48
+ # Extract important IDs
49
+
50
+ element_id = element[:id]
51
+ look_id = element[:look_id]
52
+ query_id = element[:query_id]
53
+
54
+ # If look_id is non-null and query_id is null, tile is a Look-based tile
55
+ if look_id && query_id.nil?
56
+
57
+ # Get the Look so we can get its query_id
58
+ look = sdk.look(look_id).to_h
59
+ query_id = look[:query_id]
60
+
61
+ # Update the tile to have a null look_id and update query_id
62
+ sdk.update_dashboard_element(element_id,
63
+ {
64
+ "look_id": nil,
65
+ "query_id": query_id,
66
+ }
67
+ )
68
+ puts "Tile #{element_id.to_s} has been updated in Dashboard #{dashboard_id.to_s}"
69
+
70
+ end
71
+ end
@@ -1,3 +1,27 @@
1
+ ############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2018 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
+
1
25
  require './sdk_setup'
2
26
 
3
27
  $stdin.each_line do |line|
@@ -1,3 +1,27 @@
1
+ ############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2018 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
+
1
25
  require './sdk_setup'
2
26
 
3
27
  total_count = 0
@@ -1,3 +1,27 @@
1
+ ############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2018 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
+
1
25
  require './sdk_setup'
2
26
 
3
27
  $stdin.each_line do |line|
@@ -1,3 +1,27 @@
1
+ ############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2018 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
+
1
25
  require './sdk_setup'
2
26
 
3
27
  $stdin.each_line do |line|
@@ -1,3 +1,27 @@
1
+ ############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2018 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
+
1
25
  require './sdk_setup'
2
26
 
3
27
  ############################################################################################
data/examples/me.rb CHANGED
@@ -1,3 +1,27 @@
1
+ ############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2018 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
+
1
25
  require './sdk_setup'
2
26
 
3
27
  puts sdk.me.inspect
@@ -1,3 +1,27 @@
1
+ ############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2018 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
+
1
25
  require './sdk_setup'
2
26
 
3
27
  sdk.all_users(:fields => 'id,email').each do |user|
@@ -1,3 +1,27 @@
1
+ ############################################################################################
2
+ # The MIT License (MIT)
3
+ #
4
+ # Copyright (c) 2018 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
+
1
25
  require './sdk_setup'
2
26
 
3
27