looker-sdk 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +0 -1
  3. data/LICENSE.md +33 -0
  4. data/Rakefile +25 -1
  5. data/examples/add_delete_users.rb +24 -0
  6. data/examples/change_credentials_email_address_for_users.rb +24 -0
  7. data/examples/convert_look_to_lookless_tile.rb +71 -0
  8. data/examples/create_credentials_email_for_users.rb +24 -0
  9. data/examples/delete_all_user_sessions.rb +24 -0
  10. data/examples/delete_credentials_google_for_users.rb +24 -0
  11. data/examples/generate_password_reset_tokens_for_users.rb +24 -0
  12. data/examples/ldap_roles_test.rb +24 -0
  13. data/examples/me.rb +24 -0
  14. data/examples/refresh_user_notification_addresses.rb +24 -0
  15. data/examples/roles_and_users_with_permission.rb +24 -0
  16. data/examples/sdk_setup.rb +24 -0
  17. data/examples/streaming_downloads.rb +24 -0
  18. data/examples/users_with_credentials_email.rb +24 -0
  19. data/examples/users_with_credentials_embed.rb +24 -0
  20. data/examples/users_with_credentials_google.rb +23 -1
  21. data/examples/users_with_credentials_google_without_credentials_email.rb +24 -0
  22. data/lib/looker-sdk.rb +51 -0
  23. data/lib/looker-sdk/authentication.rb +27 -2
  24. data/lib/looker-sdk/client.rb +24 -0
  25. data/lib/looker-sdk/client/dynamic.rb +45 -2
  26. data/lib/looker-sdk/configurable.rb +24 -0
  27. data/lib/looker-sdk/default.rb +24 -0
  28. data/lib/looker-sdk/error.rb +28 -0
  29. data/lib/looker-sdk/rate_limit.rb +24 -0
  30. data/lib/looker-sdk/response/raise_error.rb +24 -0
  31. data/lib/looker-sdk/sawyer_patch.rb +25 -1
  32. data/lib/looker-sdk/version.rb +25 -1
  33. data/looker-sdk.gemspec +1 -1
  34. data/shell/shell.rb +24 -0
  35. data/test/helper.rb +24 -0
  36. data/test/looker/test_client.rb +24 -0
  37. data/test/looker/test_dynamic_client.rb +56 -0
  38. data/test/looker/test_dynamic_client_agent.rb +24 -0
  39. metadata +6 -5
  40. data/LICENSE +0 -21
@@ -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
  module LookerSDK
2
26
 
3
27
  # Class for API Rate Limit info
@@ -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 'faraday'
2
26
  require 'looker-sdk/error'
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
  # Make Sawyer decode the body lazily.
2
26
  # This is a temp monkey-patch until sawyer has: https://github.com/lostisland/sawyer/pull/31
3
27
  # At that point we can remove this and update our dependency to the new Sawyer release version.
@@ -30,4 +54,4 @@ module Sawyer
30
54
  end
31
55
 
32
56
  end
33
- end
57
+ end
@@ -1,7 +1,31 @@
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
  module LookerSDK
2
26
 
3
27
  # Current version
4
28
  # @return [String]
5
- VERSION = "0.0.6"
29
+ VERSION = "0.0.7"
6
30
 
7
31
  end
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  'the Looker data analytics engine to fetch data or render visualizations defined in your Looker data models. '+
16
16
  'For more information, see https://looker.com.'
17
17
  s.license = 'MIT'
18
- s.required_ruby_version = '>= 1.9.3'
18
+ s.required_ruby_version = '>= 2.0'
19
19
  s.requirements = 'Looker version 4.0 or later' # informational
20
20
 
21
21
  s.files = `git ls-files`.split("\n")
@@ -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 'rubygems'
2
26
  require 'bundler/setup'
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 'simplecov'
2
26
  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
3
27
  SimpleCov::Formatter::HTMLFormatter
@@ -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_relative '../helper'
2
26
 
3
27
  describe LookerSDK::Client do
@@ -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_relative '../helper'
2
26
 
3
27
  class LookerDynamicClientTest < MiniTest::Spec
@@ -68,6 +92,38 @@ class LookerDynamicClientTest < MiniTest::Spec
68
92
 
69
93
  describe "swagger" do
70
94
 
95
+ it "warns when swagger.json can't be loaded" do
96
+ sdk = sdk_client(nil, nil)
97
+
98
+ obj = OpenStruct.new({status: 200, data: {key: "my data"}})
99
+ sdk.stubs(:last_response).returns(obj)
100
+ sdk.stubs(:looker_warn).once
101
+
102
+ sdk.load_swagger
103
+ end
104
+
105
+ it "no warning when swagger.json can be loaded with authentication" do
106
+ sdk = sdk_client(nil, nil)
107
+
108
+ # first call to try_load_swagger fails, returning nil
109
+ # second call succeeds
110
+ sdk.stubs(:try_load_swagger).returns(nil, {key: "my data"})
111
+ sdk.stubs(:looker_warn).never
112
+
113
+ sdk.load_swagger
114
+ end
115
+
116
+ it "no warning when swagger.json can be loaded without authentication" do
117
+ sdk = sdk_client(nil, nil)
118
+
119
+ # first call to try_load_swagger fails, returning nil
120
+ # second call succeeds
121
+ sdk.stubs(:try_load_swagger).returns({key: "my data"}, nil)
122
+ sdk.stubs(:looker_warn).never
123
+
124
+ sdk.load_swagger
125
+ end
126
+
71
127
  it "invalid method name" do
72
128
  mock = MiniTest::Mock.new.expect(:call, response){|env| confirm_env(env, method, path, body, query, content_type)}
73
129
  sdk = sdk_client(default_swagger, mock)
@@ -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_relative '../helper'
2
26
 
3
27
  describe LookerSDK::Client::Dynamic do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: looker-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Looker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-31 00:00:00.000000000 Z
11
+ date: 2019-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -59,12 +59,13 @@ files:
59
59
  - ".travis.yml"
60
60
  - CODE_OF_CONDUCT.md
61
61
  - Gemfile
62
- - LICENSE
62
+ - LICENSE.md
63
63
  - Rakefile
64
64
  - authentication.md
65
65
  - examples/.netrc
66
66
  - examples/add_delete_users.rb
67
67
  - examples/change_credentials_email_address_for_users.rb
68
+ - examples/convert_look_to_lookless_tile.rb
68
69
  - examples/create_credentials_email_for_users.rb
69
70
  - examples/delete_all_user_sessions.rb
70
71
  - examples/delete_credentials_google_for_users.rb
@@ -117,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
118
  requirements:
118
119
  - - ">="
119
120
  - !ruby/object:Gem::Version
120
- version: 1.9.3
121
+ version: '2.0'
121
122
  required_rubygems_version: !ruby/object:Gem::Requirement
122
123
  requirements:
123
124
  - - ">="
@@ -126,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
127
  requirements:
127
128
  - Looker version 4.0 or later
128
129
  rubyforge_project:
129
- rubygems_version: 2.6.13
130
+ rubygems_version: 2.6.14.1
130
131
  signing_key:
131
132
  specification_version: 4
132
133
  summary: Looker Ruby SDK
data/LICENSE DELETED
@@ -1,21 +0,0 @@
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.