looker-sdk 0.1.2 → 0.1.4

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 +4 -4
  2. data/.github/scripts/wait_for_looker.sh +1 -1
  3. data/.github/workflows/release-metrics.yml +44 -0
  4. data/.github/workflows/release.yml +1 -1
  5. data/.github/workflows/ruby-ci.yml +91 -14
  6. data/.gitignore +3 -1
  7. data/CHANGELOG.md +23 -0
  8. data/Gemfile.lock +85 -0
  9. data/LICENSE.md +14 -26
  10. data/Octokit_LICENSE.md +22 -0
  11. data/{readme.md → README.md} +1 -1
  12. data/Rakefile +5 -1
  13. data/examples/add_delete_users.rb +1 -1
  14. data/examples/change_credentials_email_address_for_users.rb +1 -1
  15. data/examples/convert_look_to_lookless_tile.rb +2 -2
  16. data/examples/create_credentials_email_for_users.rb +1 -1
  17. data/examples/delete_all_user_sessions.rb +1 -1
  18. data/examples/delete_credentials_google_for_users.rb +1 -1
  19. data/examples/errors.rb +47 -0
  20. data/examples/generate_password_reset_tokens_for_users.rb +1 -1
  21. data/examples/ldap_roles_test.rb +1 -1
  22. data/examples/me.rb +1 -1
  23. data/examples/refresh_user_notification_addresses.rb +1 -1
  24. data/examples/roles_and_users_with_permission.rb +1 -1
  25. data/examples/sdk_setup.rb +3 -3
  26. data/examples/streaming_downloads.rb +1 -1
  27. data/examples/users_with_credentials_email.rb +1 -1
  28. data/examples/users_with_credentials_embed.rb +1 -1
  29. data/examples/users_with_credentials_google.rb +1 -1
  30. data/examples/users_with_credentials_google_without_credentials_email.rb +1 -1
  31. data/lib/looker-sdk/authentication.rb +1 -1
  32. data/lib/looker-sdk/client/dynamic.rb +1 -1
  33. data/lib/looker-sdk/client.rb +1 -1
  34. data/lib/looker-sdk/configurable.rb +1 -1
  35. data/lib/looker-sdk/default.rb +1 -1
  36. data/lib/looker-sdk/error.rb +41 -2
  37. data/lib/looker-sdk/rate_limit.rb +1 -1
  38. data/lib/looker-sdk/response/raise_error.rb +1 -1
  39. data/lib/looker-sdk/sawyer_patch.rb +1 -1
  40. data/lib/looker-sdk/version.rb +2 -2
  41. data/lib/looker-sdk.rb +18 -15
  42. data/looker-sdk.gemspec +4 -2
  43. data/shell/shell.rb +3 -3
  44. data/shell.nix +38 -0
  45. data/test/helper.rb +2 -2
  46. data/test/looker/test_client.rb +2 -2
  47. data/test/looker/test_dynamic_client.rb +1 -1
  48. data/test/looker/test_dynamic_client_agent.rb +1 -1
  49. metadata +40 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cc7e235cdbbb66fc48144899702643ac22bffcb5b9a9308aff125da08094b3b
4
- data.tar.gz: 8517bfd25b5330d27486b579c4d8c113786c72553256582f0b4fd7d7ddd1e2f4
3
+ metadata.gz: eec4f085f75f425e9a066942d67bde11f67fa7f2ebf1fd7a38778a6b02a01104
4
+ data.tar.gz: 41246f423ed0288d8cbbbb5f2dba3fe011ad23cca48dec84e6a6ddfb575ec73f
5
5
  SHA512:
6
- metadata.gz: 1e189a7bbfc601e3ba9cbd11826fd80494e6218caf68f2a12d1ba2d281dd66f8995eadf04397d1d814a22c0e5eafdf5045e9dd4064f92b2b0bb3064d7122d0ef
7
- data.tar.gz: 4e17c8adec821082d10556b2d4122f17c21cbc5db58b3d4f5b4cefdb9022542eab77428256793180d5ab1dda6dccf6dc4604f803a50fa6a8e2c95f9dee698c24
6
+ metadata.gz: d6eb98d64177c6b30dd98c3fc0a6dc2ecf0ab0a83fdb4c694476cc791c63e8c2fc14c18a199dd6c01f59926691c7a340bccdf38ef4a0f1f3e10cbf8ff6a505ac
7
+ data.tar.gz: 7630058cb8ae0d8e3968fddfb81b1e22c52bf446621cfed83d8e9b44d7c9685c306a801d8709197d2a2a84db970a5d73fe2fdc0212d9a713639bb2043abfdd5f
@@ -13,7 +13,7 @@ status=0
13
13
  check_looker
14
14
  while [ $status -ne 200 ];
15
15
  do
16
- RETRY_MSG="after $ATTEMPTS attempts: $MAX_RETRIES retries remaining."
16
+ RETRY_MSG="after $ATTEMPTS attempts: $(expr $MAX_RETRIES - $ATTEMPTS) retries remaining."
17
17
  if [ $ATTEMPTS -ge $MAX_RETRIES ];
18
18
  then
19
19
  echo 'Looker took too long to start'
@@ -0,0 +1,44 @@
1
+ name: Send publish metrics to bigquery
2
+ on:
3
+ release:
4
+ types: published
5
+ jobs:
6
+ publish:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - name: Set up Cloud SDK
10
+ uses: google-github-actions/setup-gcloud@v0.2.0
11
+ with:
12
+ project_id: ${{ secrets.GCP_PROJECT_ID }}
13
+ service_account_key: ${{ secrets.GCP_BQ_METRICS_KEY }}
14
+ export_default_credentials: true
15
+
16
+ - name: Debug event json
17
+ run: cat $GITHUB_EVENT_PATH
18
+
19
+ - name: Check for release key
20
+ run: echo "HAS_RELEASE_KEY=$(jq 'has("release")' $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
21
+
22
+ - name: Write release json
23
+ if: ${{env.HAS_RELEASE_KEY== 'true'}}
24
+ run: 'jq -c ''.release |
25
+ {
26
+ package_name: .name | split(" ")[0],
27
+ name,
28
+ tag_name,
29
+ version: try(.tag_name | split("-v")[1]),
30
+ html_url,
31
+ target_commitish,
32
+ created_at,
33
+ published_at,
34
+ draft,
35
+ prerelease
36
+ }'' $GITHUB_EVENT_PATH > releases.json'
37
+
38
+ - name: Debug release json
39
+ if: ${{env.HAS_RELEASE_KEY== 'true'}}
40
+ run: cat releases.json
41
+
42
+ - name: Send release.json to BQ
43
+ if: ${{env.HAS_RELEASE_KEY== 'true'}}
44
+ run: bq load --source_format=NEWLINE_DELIMITED_JSON metrics.releases releases.json
@@ -26,7 +26,7 @@ jobs:
26
26
  # Setup ruby if a release was created
27
27
  - uses: ruby/setup-ruby@v1
28
28
  with:
29
- ruby-version: 2.5.8
29
+ ruby-version: 2.7.7
30
30
  if: ${{ steps.release.outputs.release_created }}
31
31
  # Bundle install
32
32
  - run: bundle install
@@ -1,35 +1,52 @@
1
- name: Ruby-CI
1
+ name: Ruby-CI test matrix
2
2
 
3
3
  on:
4
4
  push:
5
5
  branches: [ main ]
6
6
  pull_request:
7
7
  branches: [ main ]
8
-
8
+ workflow_dispatch:
9
9
  env:
10
10
  LOOKERSDK_BASE_URL: https://localhost:20000
11
11
  LOOKERSDK_VERIFY_SSL: false
12
12
  LOOKERSDK_API_VERSION: "4.0"
13
- LOOKERSDK_CLIENT_ID: ${{ secrets.LOOKERSDK_CLIENT_ID__21_20 }}
14
- LOOKERSDK_CLIENT_SECRET: ${{ secrets.LOOKERSDK_CLIENT_SECRET__21_20 }}
15
13
 
16
14
  jobs:
15
+ setup:
16
+ uses: looker-open-source/reusable-actions/.github/workflows/supported-versions.yml@main
17
+
17
18
  test:
19
+ name: Ruby-CI ${{ matrix.ruby-version }}/${{ matrix.looker }}
20
+ env:
21
+ LOOKERSDK_CLIENT_ID: ${{ secrets.LOOKERSDK_CLIENT_ID }}
22
+ LOOKERSDK_CLIENT_SECRET: ${{ secrets.LOOKERSDK_CLIENT_SECRET }}
23
+ CI_REPORTS: results/Ruby-CI-ruby_${{ matrix.ruby-version }}_Looker_${{ matrix.looker }}
18
24
 
25
+ needs: setup
19
26
  runs-on: ubuntu-latest
20
27
  strategy:
21
28
  matrix:
22
- ruby-version: [2.5.8]
29
+ ruby-version: [2.7.7]
30
+ looker: ${{ fromJson(needs.setup.outputs.matrix_json) }}
23
31
 
24
32
  steps:
25
- - uses: actions/checkout@v2
33
+ - name: Cancel Previous Runs
34
+ uses: styfle/cancel-workflow-action@0.11.0
35
+ with:
36
+ access_token: ${{ secrets.GITHUB_TOKEN }}
26
37
 
27
- - name: Set up Cloud SDK
28
- uses: google-github-actions/setup-gcloud@v0.2.0
38
+ - uses: actions/checkout@v3
39
+
40
+ - name: Authenticate to Google Cloud
41
+ uses: google-github-actions/auth@v1.0.0
29
42
  with:
43
+ credentials_json: ${{ secrets.GCP_AR_READER_SA_KEY }}
30
44
  project_id: ${{ secrets.GCP_PROJECT_ID }}
31
- service_account_key: ${{ secrets.GCP_AR_READER_SA_KEY }}
32
- export_default_credentials: true
45
+ create_credentials_file: true
46
+ export_environment_variables: true
47
+
48
+ - name: Set up Cloud SDK
49
+ uses: google-github-actions/setup-gcloud@v1.1.0
33
50
 
34
51
  - name: Authenticate Artifact Repository
35
52
  run: gcloud auth configure-docker us-west1-docker.pkg.dev --quiet
@@ -38,23 +55,83 @@ jobs:
38
55
  # TODO: can we cache some layers of the image for faster download?
39
56
  # we probably don't want to cache the final image for IP security...
40
57
  run: |
41
- docker pull --quiet us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker/21_20
58
+ docker pull --quiet us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker/${{ matrix.looker }}
42
59
  # set $LOOKER_OPTS to --no-ssl if we want to turn off ssl
43
- docker run --name looker-sdk-codegen-ci -d -p 10000:9999 -p 20000:19999 us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker/21_20
60
+ docker run --name looker-sdk-codegen-ci -d -p 10000:9999 -p 20000:19999 us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker/${{ matrix.looker }}
44
61
  docker logs -f looker-sdk-codegen-ci --until=30s &
45
62
 
46
63
  - name: Set up Ruby ${{ matrix.ruby-version }}
47
64
  uses: ruby/setup-ruby@v1
48
65
  with:
49
66
  ruby-version: ${{ matrix.ruby-version }}
50
- bundler-cache: true
67
+ bundler-cache: false
51
68
 
52
69
  - name: Install dependencies
53
70
  run: bundle install
54
71
 
72
+ - name: Mock .netrc
73
+ run: |
74
+ mkdir -p test/fixtures
75
+ echo "machine localhost" > test/fixtures/.netrc
76
+ echo " login $LOOKERSDK_CLIENT_ID" >> test/fixtures/.netrc
77
+ echo " password $LOOKERSDK_CLIENT_SECRET" >> test/fixtures/.netrc
78
+ chmod 600 test/fixtures/.netrc
79
+
55
80
  - name: Check that Looker is ready
56
81
  run: |
57
82
  ${{ github.workspace }}/.github/scripts/wait_for_looker.sh
58
83
 
84
+ - name: Report Failure
85
+ run: |
86
+ curl --request POST \
87
+ --url https://api.github.com/repos/looker-open-source/sdk-codegen/check-runs \
88
+ --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
89
+ --header "content-type: application/json" \
90
+ --header "Accept: application/vnd.github.v3+json" \
91
+ --data '{
92
+ "name": "Ruby-CI Tests",
93
+ "head_sha": "${{ github.event.pull_request.head.sha || github.sha }}",
94
+ "conclusion": "failure"
95
+ }' \
96
+ --fail
97
+ if: failure()
98
+
59
99
  - name: Run tests
60
- run: bundle exec rake test
100
+ run: bundle exec rake test --trace
101
+
102
+ - name: remove mock .netrc
103
+ if: ${{ always() }}
104
+ run: |
105
+ rm test/fixtures/.netrc
106
+
107
+ - name: Upload ts unit test results
108
+ if: ${{ always() }}
109
+ uses: actions/upload-artifact@v3.1.2
110
+ with:
111
+ name: ruby-ci-test-results
112
+ path: results/
113
+
114
+ publish-test-results:
115
+ needs: [test]
116
+ if: success() || failure()
117
+ runs-on: ubuntu-latest
118
+
119
+ steps:
120
+ - name: Download Artifacts
121
+ uses: actions/download-artifact@v3
122
+ with:
123
+ name: ruby-ci-test-results
124
+ path: artifacts
125
+
126
+ - name: Publish Test Results
127
+ uses: EnricoMi/publish-unit-test-result-action@v1.12
128
+ with:
129
+ # Cosmetic issue with `check_name` being associated to the wrong
130
+ # workflow: https://github.com/EnricoMi/publish-unit-test-result-action/issues/12
131
+ check_name: Ruby-CI Tests
132
+ github_token: ${{ secrets.GITHUB_TOKEN }}
133
+ report_individual_runs: true
134
+ hide_comments: orphaned commits
135
+ check_run_annotations: 'none'
136
+ compare_to_earlier_commit: false
137
+ files: 'artifacts/**/*.xml'
data/.gitignore CHANGED
@@ -11,6 +11,7 @@
11
11
  *.sass-cache
12
12
  *.iml
13
13
 
14
+
14
15
  # OS or Editor folders
15
16
  .DS_Store
16
17
  .cache
@@ -25,6 +26,8 @@ intermediate
25
26
  publish
26
27
  target
27
28
  .idea
29
+ .direnv
30
+ .env
28
31
  out
29
32
 
30
33
  # markdown previews
@@ -36,7 +39,6 @@ out
36
39
  .bundle
37
40
  .config
38
41
  .yardoc
39
- Gemfile.lock
40
42
  Gemfile.optional.lock
41
43
  InstalledFiles
42
44
  _yardoc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ### [0.1.4](https://www.github.com/looker-open-source/looker-sdk-ruby/compare/v0.1.3...v0.1.4) (2023-03-14)
4
+
5
+
6
+ ### Features
7
+
8
+ * upgrade faraday dependency ([#108](https://www.github.com/looker-open-source/looker-sdk-ruby/issues/108)) ([0abdea6](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/0abdea60e579a104e4f060a9ca9b3cd7ae17d7b0))
9
+ ### [0.1.3](https://www.github.com/looker-open-source/looker-sdk-ruby/compare/v0.1.2...v0.1.3) (2023-03-11)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * Add processing to look up error documents ([a982253](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/a982253a806833b4ec53ca5322f6ba046ad8fe74))
15
+ * Add release-please workflow ([8e8de5b](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/8e8de5b9cb0063047a0f92511ce3f5e93237d109))
16
+ * allow faraday 2.x ([cbf1d6d](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/cbf1d6df15e1c3e2101772de3be78e95e7a6cf06))
17
+ * change references from old location github.com/looker to new location github.com/looker-open-source ([baf0f31](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/baf0f315deec45d04d53ca2ba08ad7139beed884))
18
+ * fix api version in CI workflow ([158334b](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/158334bf7675ebbc3293f8fc06b028e0039eddf7))
19
+ * initial implementation of CI ([241b28e](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/241b28ef9569fc4c7b940803537d49c48a4b3224))
20
+ * minor typo in release.yml ([44ea762](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/44ea76282eade774b82750ee2dfa98c603a60733))
21
+ * rename readme.md to more common README.md ([83aa2c7](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/83aa2c788c60c7a305b7af40990e75128353cb8d))
22
+ * set proper version of looker in CI workflow ([a452c91](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/a452c91a364ebecd420bf1a110f9b497b3fb0349))
23
+ * slight adjustment to output of documentation url in error plus added error example ([5a4a75a](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/5a4a75ad0af2c477db9980743fe59388e2a6cfb6))
24
+ * update ports back to 19999 for defaults. ([3f91b99](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/3f91b9923c1821e840e84014759c54ea07b7072f))
25
+
3
26
  ### [0.1.2](https://www.github.com/looker-open-source/looker-sdk-ruby/compare/v0.1.1...v0.1.2) (2021-11-19)
4
27
 
5
28
 
data/Gemfile.lock ADDED
@@ -0,0 +1,85 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ looker-sdk (0.1.4)
5
+ faraday (>= 1.2, < 3.0)
6
+ sawyer (~> 0.8)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.8.1)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
+ awesome_print (1.6.1)
14
+ builder (3.2.4)
15
+ ci_reporter (2.1.0)
16
+ builder (>= 2.1.2)
17
+ rexml
18
+ ci_reporter_minitest (1.0.0)
19
+ ci_reporter (~> 2.0)
20
+ minitest (~> 5.0)
21
+ faraday (1.10.3)
22
+ faraday-em_http (~> 1.0)
23
+ faraday-em_synchrony (~> 1.0)
24
+ faraday-excon (~> 1.1)
25
+ faraday-httpclient (~> 1.0)
26
+ faraday-multipart (~> 1.0)
27
+ faraday-net_http (~> 1.0)
28
+ faraday-net_http_persistent (~> 1.0)
29
+ faraday-patron (~> 1.0)
30
+ faraday-rack (~> 1.0)
31
+ faraday-retry (~> 1.0)
32
+ ruby2_keywords (>= 0.0.4)
33
+ faraday-em_http (1.0.0)
34
+ faraday-em_synchrony (1.0.0)
35
+ faraday-excon (1.1.0)
36
+ faraday-httpclient (1.0.1)
37
+ faraday-multipart (1.0.4)
38
+ multipart-post (~> 2)
39
+ faraday-net_http (1.0.1)
40
+ faraday-net_http_persistent (1.2.0)
41
+ faraday-patron (1.0.0)
42
+ faraday-rack (1.0.0)
43
+ faraday-retry (1.0.3)
44
+ metaclass (0.0.4)
45
+ minitest (5.9.1)
46
+ mocha (1.1.0)
47
+ metaclass (~> 0.0.1)
48
+ multi_json (1.15.0)
49
+ multipart-post (2.3.0)
50
+ netrc (0.7.9)
51
+ public_suffix (5.0.1)
52
+ rack (1.6.4)
53
+ rack-test (0.6.2)
54
+ rack (>= 1.0)
55
+ rake (10.5.0)
56
+ redcarpet (3.1.2)
57
+ rexml (3.2.5)
58
+ ruby2_keywords (0.0.5)
59
+ sawyer (0.9.2)
60
+ addressable (>= 2.3.5)
61
+ faraday (>= 0.17.3, < 3)
62
+ simplecov (0.7.1)
63
+ multi_json (~> 1.0)
64
+ simplecov-html (~> 0.7.1)
65
+ simplecov-html (0.7.1)
66
+
67
+ PLATFORMS
68
+ x86_64-linux
69
+
70
+ DEPENDENCIES
71
+ awesome_print (~> 1.6.1)
72
+ ci_reporter_minitest (~> 1.0)
73
+ faraday (~> 1.10)
74
+ looker-sdk!
75
+ minitest (= 5.9.1)
76
+ mocha (= 1.1.0)
77
+ netrc (~> 0.7.7)
78
+ rack (= 1.6.4)
79
+ rack-test (= 0.6.2)
80
+ rake (< 11.0)
81
+ redcarpet (~> 3.1.2)
82
+ simplecov (~> 0.7.1)
83
+
84
+ BUNDLED WITH
85
+ 2.4.8
data/LICENSE.md CHANGED
@@ -1,33 +1,21 @@
1
1
  The MIT License (MIT)
2
2
 
3
3
  Copyright (c) 2015 Looker Data Sciences, Inc.
4
+ Copyright (c) 2021 Google LLC
4
5
 
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:
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ this software and associated documentation files (the "Software"), to deal in
8
+ the Software without restriction, including without limitation the rights to
9
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10
+ the Software, and to permit persons to whom the Software is furnished to do so,
11
+ subject to the following conditions:
11
12
 
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
14
15
 
15
16
  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.
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,22 @@
1
+ The Looker SDK for Ruby is based in part on [Octokit](https://github.com/octokit/octokit.rb).
2
+
3
+ Octokit's license:
4
+
5
+ Copyright (c) 2009-2014 Wynn Netherland, Adam Stacoviak, Erik Michaels-Ober
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
8
+ this software and associated documentation files (the "Software"), to deal in
9
+ the Software without restriction, including without limitation the rights to
10
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11
+ the Software, and to permit persons to whom the Software is furnished to do so,
12
+ 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, FITNESS
19
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,4 +1,4 @@
1
- [![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)
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
2
  # [Looker](http://looker.com/) SDK for Ruby
3
3
  ### Overview
4
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.
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.2"
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
@@ -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 = '>= 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/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
+ }
data/test/helper.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
@@ -61,7 +61,7 @@ end
61
61
  def setup_sdk
62
62
  LookerSDK.reset!
63
63
 
64
- base_url = ENV['LOOKERSDK_BASE_URL'] || 'https://localhost:20000'
64
+ base_url = ENV['LOOKERSDK_BASE_URL'] || 'https://localhost:19999'
65
65
  verify_ssl = case ENV['LOOKERSDK_VERIFY_SSL']
66
66
  when /false/i
67
67
  false
@@ -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,7 +30,7 @@ describe LookerSDK::Client do
30
30
  setup_sdk
31
31
  end
32
32
 
33
- base_url = ENV['LOOKERSDK_BASE_URL'] || 'https://localhost:20000'
33
+ base_url = ENV['LOOKERSDK_BASE_URL'] || 'https://localhost:19999'
34
34
  verify_ssl = case ENV['LOOKERSDK_VERIFY_SSL']
35
35
  when /false/i
36
36
  false
@@ -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
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.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Looker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-19 00:00:00.000000000 Z
11
+ date: 2023-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sawyer
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '1.2'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '2.0'
36
+ version: '3.0'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,35 @@ dependencies:
43
43
  version: '1.2'
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '2.0'
46
+ version: '3.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: ci_reporter_minitest
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: faraday
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.10'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.10'
47
75
  description: Use this SDK to access the Looker API. The Looker API provides functions
48
76
  to perform administrative tasks such as provisioning users, configuring database
49
77
  connections, and so on. It also enables you to leverage the Looker data analytics
@@ -55,6 +83,7 @@ extensions: []
55
83
  extra_rdoc_files: []
56
84
  files:
57
85
  - ".github/scripts/wait_for_looker.sh"
86
+ - ".github/workflows/release-metrics.yml"
58
87
  - ".github/workflows/release.yml"
59
88
  - ".github/workflows/ruby-ci.yml"
60
89
  - ".gitignore"
@@ -63,8 +92,11 @@ files:
63
92
  - CODE_OF_CONDUCT.md
64
93
  - CONTRIBUTING.md
65
94
  - Gemfile
95
+ - Gemfile.lock
66
96
  - LICENSE.md
67
97
  - Makefile
98
+ - Octokit_LICENSE.md
99
+ - README.md
68
100
  - Rakefile
69
101
  - authentication.md
70
102
  - examples/.netrc
@@ -74,6 +106,7 @@ files:
74
106
  - examples/create_credentials_email_for_users.rb
75
107
  - examples/delete_all_user_sessions.rb
76
108
  - examples/delete_credentials_google_for_users.rb
109
+ - examples/errors.rb
77
110
  - examples/generate_password_reset_tokens_for_users.rb
78
111
  - examples/ldap_roles_test.rb
79
112
  - examples/me.rb
@@ -97,7 +130,7 @@ files:
97
130
  - lib/looker-sdk/sawyer_patch.rb
98
131
  - lib/looker-sdk/version.rb
99
132
  - looker-sdk.gemspec
100
- - readme.md
133
+ - shell.nix
101
134
  - shell/.gitignore
102
135
  - shell/.netrc
103
136
  - shell/Gemfile
@@ -123,7 +156,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
156
  requirements:
124
157
  - - ">="
125
158
  - !ruby/object:Gem::Version
126
- version: '2.5'
159
+ version: '2.7'
127
160
  required_rubygems_version: !ruby/object:Gem::Requirement
128
161
  requirements:
129
162
  - - ">="
@@ -131,8 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
164
  version: '0'
132
165
  requirements:
133
166
  - Looker version 4.0 or later
134
- rubyforge_project:
135
- rubygems_version: 2.7.6.2
167
+ rubygems_version: 3.1.6
136
168
  signing_key:
137
169
  specification_version: 4
138
170
  summary: Looker Ruby SDK