looker-sdk 0.0.6 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/scripts/wait_for_looker.sh +35 -0
- data/.github/workflows/release.yml +47 -0
- data/.github/workflows/ruby-ci.yml +60 -0
- data/.gitignore +3 -0
- data/CHANGELOG.md +13 -0
- data/CODE_OF_CONDUCT.md +73 -26
- data/CONTRIBUTING.md +29 -0
- data/Gemfile +1 -1
- data/LICENSE.md +33 -0
- data/Makefile +81 -0
- data/Rakefile +24 -27
- data/authentication.md +3 -3
- data/examples/add_delete_users.rb +24 -0
- data/examples/change_credentials_email_address_for_users.rb +24 -0
- data/examples/convert_look_to_lookless_tile.rb +71 -0
- data/examples/create_credentials_email_for_users.rb +24 -0
- data/examples/delete_all_user_sessions.rb +24 -0
- data/examples/delete_credentials_google_for_users.rb +24 -0
- data/examples/generate_password_reset_tokens_for_users.rb +24 -0
- data/examples/ldap_roles_test.rb +24 -0
- data/examples/me.rb +24 -0
- data/examples/refresh_user_notification_addresses.rb +24 -0
- data/examples/roles_and_users_with_permission.rb +24 -0
- data/examples/sdk_setup.rb +24 -0
- data/examples/streaming_downloads.rb +24 -0
- data/examples/users_with_credentials_email.rb +24 -0
- data/examples/users_with_credentials_embed.rb +24 -0
- data/examples/users_with_credentials_google.rb +23 -1
- data/examples/users_with_credentials_google_without_credentials_email.rb +24 -0
- data/lib/looker-sdk/authentication.rb +27 -2
- data/lib/looker-sdk/client/dynamic.rb +61 -11
- data/lib/looker-sdk/client.rb +52 -16
- data/lib/looker-sdk/configurable.rb +28 -2
- data/lib/looker-sdk/default.rb +30 -0
- data/lib/looker-sdk/error.rb +28 -0
- data/lib/looker-sdk/rate_limit.rb +24 -0
- data/lib/looker-sdk/response/raise_error.rb +25 -3
- data/lib/looker-sdk/sawyer_patch.rb +25 -1
- data/lib/looker-sdk/version.rb +25 -1
- data/lib/looker-sdk.rb +50 -0
- data/looker-sdk.gemspec +4 -4
- data/readme.md +9 -5
- data/shell/Gemfile +1 -1
- data/shell/shell.rb +24 -0
- data/test/fixtures/{.netrc → .netrc.template} +0 -0
- data/test/helper.rb +56 -6
- data/test/looker/swagger.json +1 -1
- data/test/looker/test_client.rb +117 -5
- data/test/looker/test_dynamic_client.rb +75 -3
- data/test/looker/test_dynamic_client_agent.rb +24 -0
- metadata +27 -21
- data/.travis.yml +0 -16
- data/LICENSE +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cc7e235cdbbb66fc48144899702643ac22bffcb5b9a9308aff125da08094b3b
|
4
|
+
data.tar.gz: 8517bfd25b5330d27486b579c4d8c113786c72553256582f0b4fd7d7ddd1e2f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e189a7bbfc601e3ba9cbd11826fd80494e6218caf68f2a12d1ba2d281dd66f8995eadf04397d1d814a22c0e5eafdf5045e9dd4064f92b2b0bb3064d7122d0ef
|
7
|
+
data.tar.gz: 4e17c8adec821082d10556b2d4122f17c21cbc5db58b3d4f5b4cefdb9022542eab77428256793180d5ab1dda6dccf6dc4604f803a50fa6a8e2c95f9dee698c24
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
check_looker() {
|
4
|
+
status=$(curl --silent --insecure --write "%{http_code}" \
|
5
|
+
--data "client_id=$LOOKERSDK_CLIENT_ID&client_secret=$LOOKERSDK_CLIENT_SECRET"\
|
6
|
+
$LOOKERSDK_BASE_URL/api/${LOOKERSDK_API_VERSION:-4.0}/login\
|
7
|
+
-o /dev/null)
|
8
|
+
}
|
9
|
+
|
10
|
+
MAX_RETRIES=160
|
11
|
+
ATTEMPTS=1
|
12
|
+
status=0
|
13
|
+
check_looker
|
14
|
+
while [ $status -ne 200 ];
|
15
|
+
do
|
16
|
+
RETRY_MSG="after $ATTEMPTS attempts: $MAX_RETRIES retries remaining."
|
17
|
+
if [ $ATTEMPTS -ge $MAX_RETRIES ];
|
18
|
+
then
|
19
|
+
echo 'Looker took too long to start'
|
20
|
+
exit 1
|
21
|
+
else
|
22
|
+
if [ $status -ne 0 ];
|
23
|
+
then
|
24
|
+
echo "Received status($status) from Looker $RETRY_MSG"
|
25
|
+
else
|
26
|
+
echo "Looker server connection rejected $RETRY_MSG"
|
27
|
+
fi
|
28
|
+
fi
|
29
|
+
|
30
|
+
sleep 2
|
31
|
+
ATTEMPTS=$(( $ATTEMPTS + 1 ))
|
32
|
+
check_looker
|
33
|
+
done
|
34
|
+
echo "Looker ready after $ATTEMPTS attempts"
|
35
|
+
exit 0
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# .github/workflows/release.yml
|
2
|
+
|
3
|
+
name: release
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches:
|
8
|
+
- main
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
release-please:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- uses: GoogleCloudPlatform/release-please-action@v2
|
15
|
+
id: release
|
16
|
+
with:
|
17
|
+
release-type: ruby
|
18
|
+
package-name: looker-sdk
|
19
|
+
bump-minor-pre-major: true
|
20
|
+
bump-patch-for-minor-pre-major: true
|
21
|
+
version-file: "lib/looker-sdk/version.rb"
|
22
|
+
token: ${{ secrets.LOS_AUTO_BOT_RP_TOKEN }}
|
23
|
+
# Checkout code if release was created
|
24
|
+
- uses: actions/checkout@v2
|
25
|
+
if: ${{ steps.release.outputs.release_created }}
|
26
|
+
# Setup ruby if a release was created
|
27
|
+
- uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: 2.5.8
|
30
|
+
if: ${{ steps.release.outputs.release_created }}
|
31
|
+
# Bundle install
|
32
|
+
- run: bundle install
|
33
|
+
if: ${{ steps.release.outputs.release_created }}
|
34
|
+
# Publish
|
35
|
+
- name: publish gem
|
36
|
+
run: |
|
37
|
+
mkdir -p $HOME/.gem
|
38
|
+
touch $HOME/.gem/credentials
|
39
|
+
chmod 0600 $HOME/.gem/credentials
|
40
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
41
|
+
gem build *.gemspec
|
42
|
+
gem push *.gem
|
43
|
+
env:
|
44
|
+
# Make sure to update the secret name
|
45
|
+
# if yours isn't named RUBYGEMS_AUTH_TOKEN
|
46
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
47
|
+
if: ${{ steps.release.outputs.release_created }}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
name: Ruby-CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main ]
|
8
|
+
|
9
|
+
env:
|
10
|
+
LOOKERSDK_BASE_URL: https://localhost:20000
|
11
|
+
LOOKERSDK_VERIFY_SSL: false
|
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
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
strategy:
|
21
|
+
matrix:
|
22
|
+
ruby-version: [2.5.8]
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v2
|
26
|
+
|
27
|
+
- name: Set up Cloud SDK
|
28
|
+
uses: google-github-actions/setup-gcloud@v0.2.0
|
29
|
+
with:
|
30
|
+
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
31
|
+
service_account_key: ${{ secrets.GCP_AR_READER_SA_KEY }}
|
32
|
+
export_default_credentials: true
|
33
|
+
|
34
|
+
- name: Authenticate Artifact Repository
|
35
|
+
run: gcloud auth configure-docker us-west1-docker.pkg.dev --quiet
|
36
|
+
|
37
|
+
- name: Pull and run Looker docker image
|
38
|
+
# TODO: can we cache some layers of the image for faster download?
|
39
|
+
# we probably don't want to cache the final image for IP security...
|
40
|
+
run: |
|
41
|
+
docker pull --quiet us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker/21_20
|
42
|
+
# 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
|
44
|
+
docker logs -f looker-sdk-codegen-ci --until=30s &
|
45
|
+
|
46
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
47
|
+
uses: ruby/setup-ruby@v1
|
48
|
+
with:
|
49
|
+
ruby-version: ${{ matrix.ruby-version }}
|
50
|
+
bundler-cache: true
|
51
|
+
|
52
|
+
- name: Install dependencies
|
53
|
+
run: bundle install
|
54
|
+
|
55
|
+
- name: Check that Looker is ready
|
56
|
+
run: |
|
57
|
+
${{ github.workspace }}/.github/scripts/wait_for_looker.sh
|
58
|
+
|
59
|
+
- name: Run tests
|
60
|
+
run: bundle exec rake test
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
### [0.1.2](https://www.github.com/looker-open-source/looker-sdk-ruby/compare/v0.1.1...v0.1.2) (2021-11-19)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* Add release-please workflow ([8e8de5b](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/8e8de5b9cb0063047a0f92511ce3f5e93237d109))
|
9
|
+
* 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))
|
10
|
+
* fix api version in CI workflow ([158334b](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/158334bf7675ebbc3293f8fc06b028e0039eddf7))
|
11
|
+
* initial implementation of CI ([241b28e](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/241b28ef9569fc4c7b940803537d49c48a4b3224))
|
12
|
+
* minor typo in release.yml ([44ea762](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/44ea76282eade774b82750ee2dfa98c603a60733))
|
13
|
+
* set proper version of looker in CI workflow ([a452c91](https://www.github.com/looker-open-source/looker-sdk-ruby/commit/a452c91a364ebecd420bf1a110f9b497b3fb0349))
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -1,46 +1,93 @@
|
|
1
|
-
#
|
1
|
+
# Code of Conduct
|
2
2
|
|
3
3
|
## Our Pledge
|
4
4
|
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of
|
9
|
+
experience, education, socio-economic status, nationality, personal appearance,
|
10
|
+
race, religion, or sexual identity and orientation.
|
6
11
|
|
7
12
|
## Our Standards
|
8
13
|
|
9
|
-
Examples of behavior that contributes to creating a positive environment
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
10
16
|
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
*
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
16
22
|
|
17
23
|
Examples of unacceptable behavior by participants include:
|
18
24
|
|
19
|
-
*
|
20
|
-
|
21
|
-
*
|
22
|
-
*
|
23
|
-
*
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
24
33
|
|
25
34
|
## Our Responsibilities
|
26
35
|
|
27
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
28
39
|
|
29
|
-
Project maintainers have the right and responsibility to remove, edit, or reject
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or reject
|
41
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
42
|
+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
|
43
|
+
contributor for other behaviors that they deem inappropriate, threatening,
|
44
|
+
offensive, or harmful.
|
30
45
|
|
31
46
|
## Scope
|
32
47
|
|
33
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
This Code of Conduct also applies outside the project spaces when the Project
|
56
|
+
Steward has a reasonable belief that an individual's behavior may have a
|
57
|
+
negative impact on the project or its community.
|
58
|
+
|
59
|
+
## Conflict Resolution
|
60
|
+
|
61
|
+
We do not believe that all conflict is bad; healthy debate and disagreement
|
62
|
+
often yield positive results. However, it is never okay to be disrespectful or
|
63
|
+
to engage in behavior that violates the project’s code of conduct.
|
64
|
+
|
65
|
+
If you see someone violating the code of conduct, you are encouraged to address
|
66
|
+
the behavior directly with those involved. Many issues can be resolved quickly
|
67
|
+
and easily, and this gives people more control over the outcome of their
|
68
|
+
dispute. If you are unable to resolve the matter for any reason, or if the
|
69
|
+
behavior is threatening or harassing, report it. We are dedicated to providing
|
70
|
+
an environment where participants feel welcome and safe.
|
71
|
+
|
72
|
+
Reports should be directed to *Mike DeAngelo* drstrangelove@google.com, the
|
73
|
+
Project Steward(s) for *looker-sdk-ruby*. It is the Project Steward’s duty to
|
74
|
+
receive and address reported violations of the code of conduct. They will then
|
75
|
+
work with a committee consisting of representatives from the Open Source
|
76
|
+
Programs Office and the Google Open Source Strategy team. If for any reason you
|
77
|
+
are uncomfortable reaching out to the Project Steward, please email
|
78
|
+
opensource@google.com.
|
79
|
+
|
80
|
+
We will investigate every complaint, but you may not receive a direct response.
|
81
|
+
We will use our discretion in determining when and how to follow up on reported
|
82
|
+
incidents, which may range from not taking action to permanent expulsion from
|
83
|
+
the project and project-sponsored spaces. We will notify the accused of the
|
84
|
+
report and provide them an opportunity to discuss it before any action is taken.
|
85
|
+
The identity of the reporter will be omitted from the details of the report
|
86
|
+
supplied to the accused. In potentially harmful situations, such as ongoing
|
87
|
+
harassment or threats to anyone's safety, we may take action without notice.
|
40
88
|
|
41
89
|
## Attribution
|
42
90
|
|
43
|
-
This Code of Conduct is adapted from the
|
44
|
-
|
45
|
-
|
46
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
91
|
+
This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
|
92
|
+
available at
|
93
|
+
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# How to Contribute
|
2
|
+
|
3
|
+
We'd love to accept your patches and contributions to this project. There are
|
4
|
+
just a few small guidelines you need to follow.
|
5
|
+
|
6
|
+
## Contributor License Agreement
|
7
|
+
|
8
|
+
Contributions to this project must be accompanied by a Contributor License
|
9
|
+
Agreement (CLA). You (or your employer) retain the copyright to your
|
10
|
+
contribution; this simply gives us permission to use and redistribute your
|
11
|
+
contributions as part of the project. Head over to
|
12
|
+
<https://cla.developers.google.com/> to see your current agreements on file or
|
13
|
+
to sign a new one.
|
14
|
+
|
15
|
+
You generally only need to submit a CLA once, so if you've already submitted one
|
16
|
+
(even if it was for a different project), you probably don't need to do it
|
17
|
+
again.
|
18
|
+
|
19
|
+
## Code Reviews
|
20
|
+
|
21
|
+
All submissions, including submissions by project members, require review. We
|
22
|
+
use GitHub pull requests for this purpose. Consult
|
23
|
+
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
|
24
|
+
information on using pull requests.
|
25
|
+
|
26
|
+
## Community Guidelines
|
27
|
+
|
28
|
+
This project follows
|
29
|
+
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
|
data/Gemfile
CHANGED
data/LICENSE.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Looker Data Sciences, Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
23
|
+
The Looker SDK for Ruby is based in part on [Octokit](https://github.com/octokit/octokit.rb).
|
24
|
+
|
25
|
+
Octokit's license:
|
26
|
+
|
27
|
+
Copyright (c) 2009-2014 Wynn Netherland, Adam Stacoviak, Erik Michaels-Ober
|
28
|
+
|
29
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
30
|
+
|
31
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
32
|
+
|
33
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Makefile
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
#############################################################################################
|
2
|
+
# The MIT License (MIT)
|
3
|
+
#
|
4
|
+
# Copyright (c) 2014 Zee Spencer
|
5
|
+
# Copyright (c) 2020 Google LLC
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
#############################################################################################
|
25
|
+
|
26
|
+
# Allows running (and re-running) of tests against several ruby versions,
|
27
|
+
# assuming you use rbenv instead of rvm.
|
28
|
+
|
29
|
+
# Uses pattern rules (task-$:) and automatic variables ($*).
|
30
|
+
# Pattern rules: http://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_10.html#SEC98
|
31
|
+
# Automatic variables: http://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_10.html#SEC101
|
32
|
+
|
33
|
+
# Rbenv-friendly version identifiers for supported Rubys
|
34
|
+
25_version = 2.5.7
|
35
|
+
jruby_92160_version = jruby-9.2.16.0
|
36
|
+
|
37
|
+
# The ruby version for use in a given rule.
|
38
|
+
# Requires a matched pattern rule and a supported ruby version.
|
39
|
+
#
|
40
|
+
# Given a pattern rule defined as "install-ruby-%"
|
41
|
+
# When the rule is ran as "install-ruby-193"
|
42
|
+
# Then the inner addsuffix call evaluates to "193_version"
|
43
|
+
# And given_ruby_version becomes "1.9.3-p551"
|
44
|
+
given_ruby_version = $($(addsuffix _version, $*))
|
45
|
+
|
46
|
+
# Instruct rbenv on which Ruby version to use when running a command.
|
47
|
+
# Requires a pattern rule and a supported ruby version.
|
48
|
+
#
|
49
|
+
# Given a pattern rule defined as "test-%"
|
50
|
+
# When the rule is ran as "test-187"
|
51
|
+
# Then with_given_ruby becomes "RBENV_VERSION=1.8.7-p375"
|
52
|
+
with_given_ruby = RBENV_VERSION=$(given_ruby_version)
|
53
|
+
|
54
|
+
# Runs tests for all supported ruby versions.
|
55
|
+
test: test-25 test-jruby_92160
|
56
|
+
|
57
|
+
# Runs tests against a specific ruby version
|
58
|
+
test-%:
|
59
|
+
rm -f Gemfile.lock
|
60
|
+
$(with_given_ruby) bundle install --quiet
|
61
|
+
$(with_given_ruby) bundle exec rake
|
62
|
+
|
63
|
+
# Installs all ruby versions and their gems
|
64
|
+
install: install-25 install-jruby_92160
|
65
|
+
|
66
|
+
# Install a particular ruby version
|
67
|
+
install-ruby-%:
|
68
|
+
rm -f Gemfile.lock
|
69
|
+
rbenv install -s $(given_ruby_version)
|
70
|
+
|
71
|
+
# Install gems into a specific ruby version
|
72
|
+
install-gems-%:
|
73
|
+
rm -f Gemfile.lock
|
74
|
+
$(with_given_ruby) gem update --system
|
75
|
+
$(with_given_ruby) gem install bundler
|
76
|
+
$(with_given_ruby) bundle install
|
77
|
+
|
78
|
+
# Installs a specific ruby version and it's gems
|
79
|
+
# At the bottom so it doesn't match install-gems and install-ruby tasks.
|
80
|
+
install-%:
|
81
|
+
make install-ruby-$* install-gems-$*
|
data/Rakefile
CHANGED
@@ -1,4 +1,27 @@
|
|
1
|
-
|
1
|
+
############################################################################################
|
2
|
+
# The MIT License (MIT)
|
3
|
+
#
|
4
|
+
# Copyright (c) 2018 Looker Data Sciences, Inc.
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
############################################################################################
|
24
|
+
|
2
25
|
require "bundler/gem_tasks"
|
3
26
|
|
4
27
|
require "rake/testtask"
|
@@ -8,30 +31,4 @@ Rake::TestTask.new do |t|
|
|
8
31
|
t.verbose = true
|
9
32
|
end
|
10
33
|
|
11
|
-
namespace :test do
|
12
|
-
desc "Run tests against all supported Rubies"
|
13
|
-
task :all do
|
14
|
-
supported_rubies = ['ruby-1.9.3', 'ruby-2.0', 'ruby-2.1', 'ruby-2.3.1', 'jruby-1.7.19', 'jruby-9.1.5.0']
|
15
|
-
failing_rubies = []
|
16
|
-
|
17
|
-
supported_rubies.each do |ruby|
|
18
|
-
cmd = "rvm install #{ruby} && rvm #{ruby} exec gem install bundler && rvm #{ruby} exec bundle install && rvm #{ruby} exec bundle exec rake"
|
19
|
-
system cmd
|
20
|
-
if $? != 0
|
21
|
-
failing_rubies << ruby
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
failing_rubies.each do |ruby|
|
26
|
-
puts "FAIL: #{ruby}. Problem with the tests on #{ruby}."
|
27
|
-
end
|
28
|
-
|
29
|
-
if failing_rubies
|
30
|
-
exit 1
|
31
|
-
else
|
32
|
-
exit 0
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
34
|
task :default => :test
|
data/authentication.md
CHANGED
@@ -22,7 +22,7 @@ Note that API 3 tokens should be created for 'regular' Looker users and *not* vi
|
|
22
22
|
|
23
23
|
|
24
24
|
### Ensure that the API is accessible
|
25
|
-
Looker versions 3.4 (and beyond) expose the
|
25
|
+
Looker versions 3.4 (and beyond) expose the API via a port different from the port used by the web app.
|
26
26
|
The default port is 19999. It may be necessary to have the Ops team managing the looker instance ensure that this
|
27
27
|
port is made accessible network-wise to client software running on non-local hosts.
|
28
28
|
|
@@ -78,14 +78,14 @@ Content-Length: 99
|
|
78
78
|
{"access_token":"4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4","token_type":"Bearer","expires_in":3600}
|
79
79
|
|
80
80
|
# Use an access_token (the token can be used over and over for API calls until it expires)
|
81
|
-
> curl -i -H "Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4" https://localhost:19999/api/
|
81
|
+
> curl -i -H "Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4" https://localhost:19999/api/4.0/user
|
82
82
|
HTTP/1.1 200 OK
|
83
83
|
Content-Type: application/json;charset=utf-8
|
84
84
|
Vary: Accept-Encoding
|
85
85
|
X-Content-Type-Options: nosniff
|
86
86
|
Content-Length: 502
|
87
87
|
|
88
|
-
{"id":14,"first_name":"Plain","last_name":"User","email":"dude+1@looker.com","models_dir":null,"is_disabled":false,"look_access":[14],"avatar_url":"https://www.gravatar.com/avatar/b7f792a6180a36a4058f36875584bc45?s=156&d=mm","credentials_email":{"email":"dude+1@looker.com","url":"https://localhost:19999/api/
|
88
|
+
{"id":14,"first_name":"Plain","last_name":"User","email":"dude+1@looker.com","models_dir":null,"is_disabled":false,"look_access":[14],"avatar_url":"https://www.gravatar.com/avatar/b7f792a6180a36a4058f36875584bc45?s=156&d=mm","credentials_email":{"email":"dude+1@looker.com","url":"https://localhost:19999/api/4.0/users/14/credentials_email","user_url":"https://localhost:19999/api/4.0/users/14","password_reset_url":"https://localhost:19999/api/4.0"},"url":"https://localhost:19999/api/4.0/users/14"}
|
89
89
|
|
90
90
|
# Logout to revoke an access_token
|
91
91
|
> curl -i -X DELETE -H "Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4" https://localhost:19999/logout
|
@@ -1,3 +1,27 @@
|
|
1
|
+
############################################################################################
|
2
|
+
# The MIT License (MIT)
|
3
|
+
#
|
4
|
+
# Copyright (c) 2018 Looker Data Sciences, Inc.
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
############################################################################################
|
24
|
+
|
1
25
|
require './sdk_setup'
|
2
26
|
|
3
27
|
############################################################################################
|
@@ -1,3 +1,27 @@
|
|
1
|
+
############################################################################################
|
2
|
+
# The MIT License (MIT)
|
3
|
+
#
|
4
|
+
# Copyright (c) 2018 Looker Data Sciences, Inc.
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
# THE SOFTWARE.
|
23
|
+
############################################################################################
|
24
|
+
|
1
25
|
require './sdk_setup'
|
2
26
|
|
3
27
|
users = Hash[
|