looker-sdk 0.1.7 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/lib/looker-sdk/client/dynamic.rb +5 -3
- data/lib/looker-sdk/client.rb +16 -7
- data/lib/looker-sdk/default.rb +1 -1
- data/lib/looker-sdk/error.rb +8 -2
- data/lib/looker-sdk/version.rb +1 -1
- data/lib/looker-sdk.rb +2 -1
- data/test/helper.rb +10 -4
- data/test/looker/swagger.json +42011 -1117
- data/test/looker/test_client.rb +19 -15
- data/test/looker/test_dynamic_client.rb +36 -34
- data/test/looker/test_dynamic_client_agent.rb +45 -12
- data/test/looker/test_inline_query.rb +97 -0
- metadata +14 -45
- data/.github/CODEOWNERS +0 -1
- data/.github/scripts/wait_for_looker.sh +0 -35
- data/.github/workflows/release-metrics.yml +0 -44
- data/.github/workflows/release.yml +0 -47
- data/.github/workflows/ruby-ci.yml +0 -140
- data/.gitignore +0 -60
- data/.ruby-gemset +0 -1
- data/Gemfile +0 -22
- data/Gemfile.lock +0 -73
- data/Makefile +0 -81
- data/Rakefile +0 -38
- data/examples/.netrc +0 -1
- data/examples/add_delete_users.rb +0 -118
- data/examples/change_credentials_email_address_for_users.rb +0 -47
- data/examples/convert_look_to_lookless_tile.rb +0 -71
- data/examples/create_credentials_email_for_users.rb +0 -43
- data/examples/delete_all_user_sessions.rb +0 -39
- data/examples/delete_credentials_google_for_users.rb +0 -43
- data/examples/errors.rb +0 -47
- data/examples/generate_password_reset_tokens_for_users.rb +0 -43
- data/examples/ldap_roles_test.rb +0 -74
- data/examples/me.rb +0 -27
- data/examples/refresh_user_notification_addresses.rb +0 -34
- data/examples/roles_and_users_with_permission.rb +0 -46
- data/examples/sdk_setup.rb +0 -45
- data/examples/streaming_downloads.rb +0 -44
- data/examples/users_with_credentials_email.rb +0 -30
- data/examples/users_with_credentials_embed.rb +0 -33
- data/examples/users_with_credentials_google.rb +0 -30
- data/examples/users_with_credentials_google_without_credentials_email.rb +0 -30
- data/looker-sdk.gemspec +0 -32
- data/shell/.gitignore +0 -41
- data/shell/.netrc +0 -3
- data/shell/Gemfile +0 -6
- data/shell/Gemfile.lock +0 -60
- data/shell/readme.md +0 -18
- data/shell/shell.rb +0 -62
- data/shell.nix +0 -38
- data/test/fixtures/.netrc.template +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd7f1ae1fc17049a2495fbe59b5daa30922eeee81324c198a14bd6e39714e4d6
|
4
|
+
data.tar.gz: 000eec5248e5cdee93e02a780822460a7c7adf10ebee87c645379a97eb8e2cf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d11ee93d5ea36eae97c8a2fff92c5505a3b1df8c750609cef85d431ca744ca188adfe8a1d17850ada2d9ac8bdf31129daef06713f5080303327f7360d366089
|
7
|
+
data.tar.gz: af88d3c1185927d26624900e6ed9794b3091415038aeba1f92a65c8d51daff308b3cc17f297709bd644cbb28e36d34011eccac83fa3f9aa0b3197e6af713dec6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.1.11](https://github.com/looker-open-source/looker-sdk-ruby/compare/v0.1.10...v0.1.11) (2025-01-13)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* add error handling for streaming client ([69b8064](https://github.com/looker-open-source/looker-sdk-ruby/commit/69b8064818161d273872eb658be16bb17ed6df56))
|
9
|
+
* handle all variety of http response codes. ([6d75ee2](https://github.com/looker-open-source/looker-sdk-ruby/commit/6d75ee2c30521d48b4e68b910c75ff5fe9ff22e7))
|
10
|
+
* raise TypeError on marshal_dump ([#100](https://github.com/looker-open-source/looker-sdk-ruby/issues/100)) ([9e486ff](https://github.com/looker-open-source/looker-sdk-ruby/commit/9e486ff413f1951e557a9816729007067bf8588f))
|
11
|
+
* update rexml to 3.3.9 to eliminate ReDos vulnerability ([#102](https://github.com/looker-open-source/looker-sdk-ruby/issues/102)) ([42c5cd3](https://github.com/looker-open-source/looker-sdk-ruby/commit/42c5cd349231457fd7e75e541a0a208bae625c39))
|
12
|
+
|
13
|
+
## [0.1.10](https://github.com/looker-open-source/looker-sdk-ruby/compare/v0.1.7...v0.1.10) (2024-10-07)
|
14
|
+
|
15
|
+
|
16
|
+
### Bug Fixes
|
17
|
+
|
18
|
+
* reduce output of inspect ([#81](https://github.com/looker-open-source/looker-sdk-ruby/issues/81)) ([ffb7d63](https://github.com/looker-open-source/looker-sdk-ruby/commit/ffb7d630842a907e860bc27bfefe8c51f401986a))
|
19
|
+
|
20
|
+
|
21
|
+
### Miscellaneous Chores
|
22
|
+
|
23
|
+
* release 0.1.10 ([1cf37b4](https://github.com/looker-open-source/looker-sdk-ruby/commit/1cf37b49586d97b4bbd85f1bf4f16c8836948744))
|
24
|
+
|
3
25
|
## [0.1.7](https://github.com/looker-open-source/looker-sdk-ruby/compare/v0.1.6...v0.1.7) (2024-01-19)
|
4
26
|
|
5
27
|
|
@@ -22,6 +22,8 @@
|
|
22
22
|
# THE SOFTWARE.
|
23
23
|
############################################################################################
|
24
24
|
|
25
|
+
require 'ruby2_keywords'
|
26
|
+
|
25
27
|
module LookerSDK
|
26
28
|
class Client
|
27
29
|
|
@@ -97,12 +99,12 @@ module LookerSDK
|
|
97
99
|
# Callers can explicitly 'invoke' remote methods or let 'method_missing' do the trick.
|
98
100
|
# If nothing else, this gives clients a way to deal with potential conflicts between remote method
|
99
101
|
# names and names of methods on client itself.
|
100
|
-
def invoke(method_name, *args, &block)
|
102
|
+
ruby2_keywords def invoke(method_name, *args, &block)
|
101
103
|
entry = find_entry(method_name) || raise(NameError, "undefined remote method '#{method_name}'")
|
102
104
|
invoke_remote(entry, method_name, *args, &block)
|
103
105
|
end
|
104
106
|
|
105
|
-
def method_missing(method_name, *args, &block)
|
107
|
+
ruby2_keywords def method_missing(method_name, *args, &block)
|
106
108
|
entry = find_entry(method_name) || (return super)
|
107
109
|
invoke_remote(entry, method_name, *args, &block)
|
108
110
|
end
|
@@ -117,7 +119,7 @@ module LookerSDK
|
|
117
119
|
operations && operations[method_name.to_sym] if dynamic
|
118
120
|
end
|
119
121
|
|
120
|
-
def invoke_remote(entry, method_name, *args, &block)
|
122
|
+
ruby2_keywords def invoke_remote(entry, method_name, *args, &block)
|
121
123
|
args = (args || []).dup
|
122
124
|
route = entry[:route].to_s.dup
|
123
125
|
params = (entry[:info][:parameters] || []).select {|param| param[:in] == 'path'}
|
data/lib/looker-sdk/client.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
############################################################################################
|
2
2
|
# The MIT License (MIT)
|
3
3
|
#
|
4
|
-
# Copyright (c)
|
4
|
+
# Copyright (c) 2024 Google, LLC
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -29,6 +29,8 @@ require 'looker-sdk/configurable'
|
|
29
29
|
require 'looker-sdk/authentication'
|
30
30
|
require 'looker-sdk/rate_limit'
|
31
31
|
require 'looker-sdk/client/dynamic'
|
32
|
+
require 'looker-sdk/error'
|
33
|
+
require 'ruby2_keywords'
|
32
34
|
|
33
35
|
module LookerSDK
|
34
36
|
|
@@ -76,8 +78,8 @@ module LookerSDK
|
|
76
78
|
#
|
77
79
|
# @return [String]
|
78
80
|
def inspect
|
79
|
-
|
80
|
-
|
81
|
+
vars = instance_variables.reject {|v| [:@swagger, :@operations].include? v}
|
82
|
+
inspected = "#{self.class.name}: attributes=\n#{vars.map {|v| "\t#{v}=#{instance_variable_get(v)}"}.join("\n")}>"
|
81
83
|
# Only show last 4 of token, secret
|
82
84
|
[@access_token, @client_secret].compact.each do |str|
|
83
85
|
len = [str.size - 4, 0].max
|
@@ -164,7 +166,7 @@ module LookerSDK
|
|
164
166
|
#
|
165
167
|
# @param url [String] The path, relative to {#api_endpoint}
|
166
168
|
# @param options [Hash] Query and header params for request
|
167
|
-
# @param block [Block] Block to perform the data
|
169
|
+
# @param block [Block] Block to perform the data concatenation of the
|
168
170
|
# multiple requests. The block is called with two parameters, the first
|
169
171
|
# contains the contents of the requests so far and the second parameter
|
170
172
|
# contains the latest response.
|
@@ -292,7 +294,7 @@ module LookerSDK
|
|
292
294
|
# LOOKER_SILENT is set to true.
|
293
295
|
#
|
294
296
|
# @return [nil]
|
295
|
-
def looker_warn(*message)
|
297
|
+
ruby2_keywords def looker_warn(*message)
|
296
298
|
unless ENV['LOOKER_SILENT']
|
297
299
|
warn message
|
298
300
|
end
|
@@ -396,8 +398,15 @@ module LookerSDK
|
|
396
398
|
http.read_timeout = connection.options.timeout rescue 60
|
397
399
|
|
398
400
|
http.request(http_request) do |response|
|
399
|
-
|
400
|
-
|
401
|
+
case response.code.to_i
|
402
|
+
when 400..599 then
|
403
|
+
error = LookerSDK::Error.from_response(response)
|
404
|
+
raise error
|
405
|
+
when 300..399 then
|
406
|
+
error = LookerSDK::Error.new("3xx response from streaming request")
|
407
|
+
raise error
|
408
|
+
when 200..299 then
|
409
|
+
progress = Progress.new(response)
|
401
410
|
response.read_body do |chunk|
|
402
411
|
next unless chunk.length > 0
|
403
412
|
progress.add_chunk(chunk)
|
data/lib/looker-sdk/default.rb
CHANGED
@@ -31,7 +31,7 @@ module LookerSDK
|
|
31
31
|
module Default
|
32
32
|
|
33
33
|
# Default API endpoint look TODO update this as needed
|
34
|
-
API_ENDPOINT = "https://localhost:19999/api/
|
34
|
+
API_ENDPOINT = "https://localhost:19999/api/4.0/".freeze
|
35
35
|
|
36
36
|
# Default User Agent header string
|
37
37
|
USER_AGENT = "Looker Ruby Gem #{LookerSDK::VERSION}".freeze
|
data/lib/looker-sdk/error.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
############################################################################################
|
2
2
|
# The MIT License (MIT)
|
3
3
|
#
|
4
|
-
# Copyright (c)
|
4
|
+
# Copyright (c) 2024 Google, LLC
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -25,7 +25,7 @@
|
|
25
25
|
module LookerSDK
|
26
26
|
class Error < StandardError
|
27
27
|
|
28
|
-
# Returns the appropriate LookerSDK::Error
|
28
|
+
# Returns the appropriate LookerSDK::Error subclass based
|
29
29
|
# on status and response message
|
30
30
|
#
|
31
31
|
# @param [Hash] response HTTP response
|
@@ -76,6 +76,12 @@ module LookerSDK
|
|
76
76
|
response_message
|
77
77
|
end
|
78
78
|
|
79
|
+
# Looker SDK error objects (e.g. LookerSDK::BadRequest) raise a
|
80
|
+
# WebMock::NetConnectNotAllowedError if they are marshal dumped.
|
81
|
+
def marshal_dump
|
82
|
+
raise TypeError.new("Refusing to marshal")
|
83
|
+
end
|
84
|
+
|
79
85
|
# Error Doc URL
|
80
86
|
#
|
81
87
|
# @return [String]
|
data/lib/looker-sdk/version.rb
CHANGED
data/lib/looker-sdk.rb
CHANGED
@@ -50,6 +50,7 @@ end
|
|
50
50
|
|
51
51
|
#require 'rack'
|
52
52
|
#require 'rack/mock_response'
|
53
|
+
require 'ruby2_keywords'
|
53
54
|
|
54
55
|
require 'looker-sdk/client'
|
55
56
|
require 'looker-sdk/default'
|
@@ -74,7 +75,7 @@ module LookerSDK
|
|
74
75
|
|
75
76
|
private
|
76
77
|
|
77
|
-
def method_missing(method_name, *args, &block)
|
78
|
+
ruby2_keywords def method_missing(method_name, *args, &block)
|
78
79
|
return super unless client.respond_to?(method_name)
|
79
80
|
client.send(method_name, *args, &block)
|
80
81
|
end
|
data/test/helper.rb
CHANGED
@@ -23,9 +23,7 @@
|
|
23
23
|
############################################################################################
|
24
24
|
|
25
25
|
require 'simplecov'
|
26
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter
|
27
|
-
SimpleCov::Formatter::HTMLFormatter
|
28
|
-
]
|
26
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new SimpleCov::Formatter::HTMLFormatter
|
29
27
|
SimpleCov.start
|
30
28
|
|
31
29
|
require 'rubygems'
|
@@ -38,12 +36,20 @@ require 'looker-sdk'
|
|
38
36
|
require 'minitest/autorun'
|
39
37
|
require 'minitest/spec'
|
40
38
|
require 'minitest/mock'
|
41
|
-
require 'mocha/
|
39
|
+
require 'mocha/minitest'
|
42
40
|
require "rack/test"
|
43
41
|
require "rack/request"
|
44
42
|
require "faraday/rack"
|
45
43
|
require "faraday/multipart" if ENV['USE_FARADAY_MULTIPART'] == 'true'
|
46
44
|
|
45
|
+
module Minitest
|
46
|
+
class Mock
|
47
|
+
def is_a?( _a )
|
48
|
+
false
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
47
53
|
def fixture_path
|
48
54
|
File.expand_path("../fixtures", __FILE__)
|
49
55
|
end
|