looker-sdk 0.1.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/scripts/wait_for_looker.sh +35 -0
  3. data/.github/workflows/release-metrics.yml +44 -0
  4. data/.github/workflows/release.yml +47 -0
  5. data/.github/workflows/ruby-ci.yml +137 -0
  6. data/.gitignore +3 -1
  7. data/CHANGELOG.md +36 -0
  8. data/CODE_OF_CONDUCT.md +73 -26
  9. data/CONTRIBUTING.md +29 -0
  10. data/Gemfile.lock +85 -0
  11. data/LICENSE.md +14 -26
  12. data/Octokit_LICENSE.md +22 -0
  13. data/{readme.md → README.md} +3 -2
  14. data/Rakefile +5 -1
  15. data/examples/add_delete_users.rb +1 -1
  16. data/examples/change_credentials_email_address_for_users.rb +1 -1
  17. data/examples/convert_look_to_lookless_tile.rb +2 -2
  18. data/examples/create_credentials_email_for_users.rb +1 -1
  19. data/examples/delete_all_user_sessions.rb +1 -1
  20. data/examples/delete_credentials_google_for_users.rb +1 -1
  21. data/examples/errors.rb +47 -0
  22. data/examples/generate_password_reset_tokens_for_users.rb +1 -1
  23. data/examples/ldap_roles_test.rb +1 -1
  24. data/examples/me.rb +1 -1
  25. data/examples/refresh_user_notification_addresses.rb +1 -1
  26. data/examples/roles_and_users_with_permission.rb +1 -1
  27. data/examples/sdk_setup.rb +3 -3
  28. data/examples/streaming_downloads.rb +1 -1
  29. data/examples/users_with_credentials_email.rb +1 -1
  30. data/examples/users_with_credentials_embed.rb +1 -1
  31. data/examples/users_with_credentials_google.rb +1 -1
  32. data/examples/users_with_credentials_google_without_credentials_email.rb +1 -1
  33. data/lib/looker-sdk/authentication.rb +1 -1
  34. data/lib/looker-sdk/client/dynamic.rb +1 -1
  35. data/lib/looker-sdk/client.rb +1 -1
  36. data/lib/looker-sdk/configurable.rb +1 -1
  37. data/lib/looker-sdk/default.rb +1 -1
  38. data/lib/looker-sdk/error.rb +41 -2
  39. data/lib/looker-sdk/rate_limit.rb +1 -1
  40. data/lib/looker-sdk/response/raise_error.rb +1 -1
  41. data/lib/looker-sdk/sawyer_patch.rb +1 -1
  42. data/lib/looker-sdk/version.rb +2 -2
  43. data/lib/looker-sdk.rb +18 -15
  44. data/looker-sdk.gemspec +6 -4
  45. data/shell/Gemfile +1 -1
  46. data/shell/shell.rb +3 -3
  47. data/shell.nix +38 -0
  48. data/test/helper.rb +31 -5
  49. data/test/looker/test_client.rb +36 -14
  50. data/test/looker/test_dynamic_client.rb +1 -1
  51. data/test/looker/test_dynamic_client_agent.rb +1 -1
  52. metadata +47 -11
  53. data/.travis.yml +0 -15
@@ -1,4 +1,5 @@
1
- # [Looker](http://looker.com/) SDK for Ruby [![Build Status](https://travis-ci.org/looker/looker-sdk-ruby.svg)](https://travis-ci.org/looker/looker-sdk-ruby)
1
+ [![Gem Version](https://badge.fury.io/rb/looker-sdk.svg)](https://badge.fury.io/rb/looker-sdk)[![Ruby-CI](https://github.com/looker-open-source/looker-sdk-ruby/actions/workflows/ruby-ci.yml/badge.svg?branch=main)](https://github.com/looker-open-source/looker-sdk-ruby/actions/workflows/ruby-ci.yml)
2
+ # [Looker](http://looker.com/) SDK for Ruby
2
3
  ### Overview
3
4
  This SDK supports secure/authenticated access to the Looker RESTful API. The SDK binds dynamically to the Looker API and builds mappings for the sets of API methods that the Looker instance exposes. This allows for writing straightforward Ruby scripts to interact with the Looker API. And, it allows the SDK to provide access to new Looker API features in each Looker release without requiring an update to the SDK each time.
4
5
 
@@ -14,7 +15,7 @@ When trying to access a resource with the API that the current user is not allow
14
15
 
15
16
  ### Installation
16
17
  ```bash
17
- $ git clone git@github.com:looker/looker-sdk-ruby.git looker-sdk
18
+ $ git clone git@github.com:looker-open-source/looker-sdk-ruby.git looker-sdk
18
19
  $ cd looker-sdk
19
20
  $ gem install bundle
20
21
  $ bundle install
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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,6 +25,10 @@
25
25
  require "bundler/gem_tasks"
26
26
 
27
27
  require "rake/testtask"
28
+ require 'ci/reporter/rake/minitest'
29
+
30
+ task :minitest => 'ci:setup:minitest'
31
+ task test: 'minitest'
28
32
  Rake::TestTask.new do |t|
29
33
  t.libs << "test"
30
34
  t.test_files = FileList["test/**/test_*.rb"]
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -31,7 +31,7 @@ sdk = LookerSDK::Client.new(
31
31
  :client_id => ENV['KEY'],
32
32
  :client_secret => ENV['SECRET'],
33
33
 
34
- # API 3.1 URL would look like: https://myhost.com:19999/api/3.1
34
+ # API 4.0 URL would look like: https://myhost.com:19999/api/4.0
35
35
  :api_endpoint => ENV['URL']
36
36
  )
37
37
  #Set the dashboard here.
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -0,0 +1,47 @@
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,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
data/examples/me.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -36,10 +36,10 @@ def sdk
36
36
 
37
37
  # use my local looker with self-signed cert
38
38
  :connection_options => {:ssl => {:verify => false}},
39
- :api_endpoint => "https://localhost:19999/api/3.0",
39
+ :api_endpoint => "https://localhost:19999/api/4.0",
40
40
 
41
41
  # use a real looker the way you are supposed to!
42
42
  # :connection_options => {:ssl => {:verify => true}},
43
- # :api_endpoint => "https://mycoolcompany.looker.com:19999/api/3.0",
43
+ # :api_endpoint => "https://mycoolcompany.looker.com:19999/api/4.0",
44
44
  )
45
45
  end
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -76,6 +76,40 @@ module LookerSDK
76
76
  response_message
77
77
  end
78
78
 
79
+ # Error Doc URL
80
+ #
81
+ # @return [String]
82
+ def error_doc_url(documentation_url)
83
+ return nil unless documentation_url
84
+ regexp = Regexp.new("https://(?<redirector>docs\.looker\.com\|cloud\.google\.com/looker/docs)/r/err/(?<api_version>.*)/(?<status_code>\\d{3})(?<api_path>.*)", Regexp::IGNORECASE)
85
+ match_data = regexp.match documentation_url
86
+ return nil unless match_data
87
+
88
+ key = "#{match_data[:status_code]}#{match_data[:api_path].gsub(/\/:([^\/]+)/,"/{\\1}")}"
89
+ error_doc = error_docs[key] || error_docs[match_data[:status_code]]
90
+ return nil unless error_doc
91
+
92
+ return "https://marketplace-api.looker.com/errorcodes/#{error_doc[:url]}"
93
+ end
94
+
95
+ def error_docs
96
+ @error_docs ||=
97
+ begin
98
+ sawyer_options = {
99
+ :links_parser => Sawyer::LinkParsers::Simple.new,
100
+ :serializer => LookerSDK::Client::Serializer.new(JSON),
101
+ :faraday => Faraday.new
102
+ }
103
+
104
+ agent = Sawyer::Agent.new("https://marketplace-api.looker.com", sawyer_options) do |http|
105
+ http.headers[:accept] = 'application/json'
106
+ #http.headers[:user_agent] = conn_hash[:user_agent]
107
+ end
108
+ response = agent.call(:get,"/errorcodes/index.json")
109
+ response.data || []
110
+ end
111
+ end
112
+
79
113
  # Returns most appropriate error for 401 HTTP status code
80
114
  # @private
81
115
  def self.error_for_401(headers)
@@ -142,6 +176,10 @@ module LookerSDK
142
176
  def response_error_summary
143
177
  return nil unless data.is_a?(Hash) && !Array(data[:errors]).empty?
144
178
 
179
+ data[:errors].each do |e|
180
+ edu = error_doc_url(e[:documentation_url])
181
+ e[:error_doc_url] = edu if edu
182
+ end
145
183
  summary = "\nError summary:\n"
146
184
  summary << data[:errors].map do |hash|
147
185
  hash.map { |k,v| " #{k}: #{v}" }
@@ -159,7 +197,8 @@ module LookerSDK
159
197
  message << "#{response_message}" unless response_message.nil?
160
198
  message << "#{response_error}" unless response_error.nil?
161
199
  message << "#{response_error_summary}" unless response_error_summary.nil?
162
- message << " // See: #{documentation_url}" unless documentation_url.nil?
200
+ message << "\n // See: #{documentation_url}" unless documentation_url.nil?
201
+ message << "\n // And: #{error_doc_url(documentation_url)}" unless error_doc_url(documentation_url).nil?
163
202
  message
164
203
  end
165
204
 
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -26,6 +26,6 @@ module LookerSDK
26
26
 
27
27
  # Current version
28
28
  # @return [String]
29
- VERSION = "0.1.1"
29
+ VERSION = "0.1.4"
30
30
 
31
31
  end
data/lib/looker-sdk.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -30,20 +30,23 @@ require 'faraday'
30
30
  # by the looker-sdk to prevent a race condition later.
31
31
  # See https://github.com/lostisland/faraday/issues/181
32
32
  # and https://bugs.ruby-lang.org/issues/921
33
- require 'faraday/autoload'
34
- require 'faraday/adapter'
35
- require 'faraday/adapter/rack'
36
- require 'faraday/adapter/net_http'
37
- require 'faraday/connection'
38
- require 'faraday/error'
39
- require 'faraday/middleware'
40
- require 'faraday/options'
41
- require 'faraday/parameters'
42
- require 'faraday/rack_builder'
43
- require 'faraday/request'
44
- require 'faraday/request/authorization'
45
- require 'faraday/response'
46
- require 'faraday/utils'
33
+ # NOTE: This is not required for Faraday 2+
34
+ if Gem.loaded_specs['faraday'].version < Gem::Version.new('2.0')
35
+ require 'faraday/autoload'
36
+ require 'faraday/adapter'
37
+ require 'faraday/adapter/rack'
38
+ require 'faraday/adapter/net_http'
39
+ require 'faraday/connection'
40
+ require 'faraday/error'
41
+ require 'faraday/middleware'
42
+ require 'faraday/options'
43
+ require 'faraday/parameters'
44
+ require 'faraday/rack_builder'
45
+ require 'faraday/request'
46
+ require 'faraday/request/authorization'
47
+ require 'faraday/response'
48
+ require 'faraday/utils'
49
+ end
47
50
 
48
51
  #require 'rack'
49
52
  #require 'rack/mock_response'
data/looker-sdk.gemspec CHANGED
@@ -7,15 +7,15 @@ Gem::Specification.new do |s|
7
7
  s.version = LookerSDK::VERSION
8
8
  s.date = "#{Time.now.strftime('%F')}"
9
9
  s.authors = ['Looker']
10
- s.email = 'opensource+sdkruby@looker.com'
11
- s.homepage = 'https://github.com/looker/looker-sdk-ruby'
10
+ s.email = 'drstrangelove@google.com'
11
+ s.homepage = 'https://github.com/looker-open-source/looker-sdk-ruby'
12
12
  s.summary = %q{Looker Ruby SDK}
13
13
  s.description = 'Use this SDK to access the Looker API. The Looker API provides functions to perform administrative '+
14
14
  'tasks such as provisioning users, configuring database connections, and so on. It also enables you to leverage '+
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 = '>= 2.5'
18
+ s.required_ruby_version = '>= 2.7'
19
19
  s.requirements = 'Looker version 4.0 or later' # informational
20
20
 
21
21
  s.files = `git ls-files`.split("\n")
@@ -24,5 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.require_paths = %w(lib)
25
25
  s.add_dependency 'jruby-openssl' if s.platform == :jruby
26
26
  s.add_dependency 'sawyer', '~> 0.8'
27
- s.add_dependency 'faraday', ['>= 1.2', '< 2.0']
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', '~> 1.10'
28
30
  end
data/shell/Gemfile CHANGED
@@ -2,5 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'pry', '~> 0.10.1'
4
4
  gem 'netrc', '~> 0.7.7'
5
- # gem 'looker-sdk', :git => 'git@github.com:looker/looker-sdk-ruby.git'
5
+ # gem 'looker-sdk', :git => 'git@github.com:looker-open-source/looker-sdk-ruby.git'
6
6
  gem 'looker-sdk', :path => '../'
data/shell/shell.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  ############################################################################################
2
2
  # The MIT License (MIT)
3
3
  #
4
- # Copyright (c) 2018 Looker Data Sciences, Inc.
4
+ # Copyright (c) 2022 Looker Data Sciences, Inc.
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
@@ -40,11 +40,11 @@ def sdk
40
40
  # Support self-signed cert *and* set longer timeout to allow for long running queries.
41
41
  :connection_options => {:ssl => {:verify => false}, :request => {:timeout => 60 * 60, :open_timeout => 30}},
42
42
 
43
- :api_endpoint => "https://localhost:19999/api/3.0",
43
+ :api_endpoint => "https://localhost:19999/api/4.0",
44
44
 
45
45
  # Customize to use your specific looker instance
46
46
  # :connection_options => {:ssl => {:verify => true}},
47
- # :api_endpoint => "https://looker.mycoolcompany.com:19999/api/3.0",
47
+ # :api_endpoint => "https://looker.mycoolcompany.com:19999/api/4.0",
48
48
  )
49
49
  end
50
50
 
data/shell.nix ADDED
@@ -0,0 +1,38 @@
1
+ let
2
+ nixpkgs = import (builtins.fetchTarball {
3
+ name = "nixpkgs-21.05";
4
+ url =
5
+ "https://github.com/nixos/nixpkgs/archive/f7574a5c8fefd86b50def1827eadb9b8cb266ffd.tar.gz";
6
+ sha256 = "0pksag38bjdqwvmcxgyc5a31hfz1z201za21v3hb7mqd9b99lnr3";
7
+ }) { };
8
+ in
9
+ with nixpkgs;
10
+ with stdenv;
11
+ with lib;
12
+ let ruby' = ruby_2_6.withPackages(ps: with ps; [bundler rake]);
13
+ in
14
+ mkShell {
15
+ name = "cucu-shell";
16
+ buildInputs = [ ruby' lzma zlib libxml2 ];
17
+
18
+ # Looker expects this as the default encoding otherwise does not start
19
+ LANG = "en_US.UTF-8";
20
+
21
+ # https://nixos.org/nixpkgs/manual/#locales
22
+ LOCALE_ARCHIVE =
23
+ optionalString isLinux "${glibcLocales}/lib/locale/locale-archive";
24
+
25
+ shellHook = ''
26
+ # FIXME: SSH or tooling that requires libnss-cache (https://github.com/google/libnss-cache)
27
+ # seems to fail since the library is not present. When I have a better understanding of Nix
28
+ # let's fix this.
29
+ # https://github.com/NixOS/nixpkgs/issues/64665#issuecomment-511411309
30
+ [[ ! -f /lib/x86_64-linux-gnu/libnss_cache.so.2 ]] || export LD_PRELOAD=/lib/x86_64-linux-gnu/libnss_cache.so.2:$LD_PRELOAD
31
+
32
+ export GEM_USER_DIR=$(pwd)/.gem
33
+ export GEM_DEFAULT_DIR=$(${ruby'}/bin/ruby -e 'puts Gem.default_dir')
34
+ export GEM_PATH=$GEM_DEFAULT_DIR:$GEM_PATH
35
+ export GEM_HOME=$GEM_USER_DIR
36
+ export PATH=$GEM_HOME/bin:$PATH
37
+ '';
38
+ }