shotgun_api_ruby 0.0.8 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test_and_publish.yml +42 -57
- data/.github/workflows/test_only.yml +25 -41
- data/.github/workflows/verify_version_change.yml +3 -3
- data/.gitignore +1 -0
- data/.overcommit.yml +9 -0
- data/.prettierrc.js +4 -0
- data/.rubocop.yml +14 -49
- data/CHANGELOG.md +34 -1
- data/Guardfile +47 -0
- data/README.md +87 -4
- data/Rakefile +1 -6
- data/bin/console +16 -7
- data/bin/prettirun +1 -0
- data/bin/ruborun +1 -0
- data/lib/shotgun_api_ruby.rb +4 -2
- data/lib/shotgun_api_ruby/auth.rb +41 -20
- data/lib/shotgun_api_ruby/client.rb +21 -11
- data/lib/shotgun_api_ruby/entities.rb +75 -90
- data/lib/shotgun_api_ruby/entities/params.rb +128 -10
- data/lib/shotgun_api_ruby/entities/schema.rb +11 -10
- data/lib/shotgun_api_ruby/entities/summarize.rb +64 -0
- data/lib/shotgun_api_ruby/entity.rb +2 -3
- data/lib/shotgun_api_ruby/preferences.rb +1 -1
- data/lib/shotgun_api_ruby/server_info.rb +1 -1
- data/lib/shotgun_api_ruby/version.rb +1 -1
- data/package.json +12 -0
- data/shotgun_api_ruby.gemspec +9 -2
- data/yarn.lock +15 -0
- metadata +137 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ba416f8dc0858ce91112f5f283d36878e31e777438b293c07ecfa63bfda0553
|
|
4
|
+
data.tar.gz: 2a8d1af31bd3936b5290250f6865bd832d76e4f92734bf0175d581be29bb71b3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42f2984ef2a0f98e0e54d9e6c470bed71647d3f8a49d9dff17a8111f8081478425320f44f21ac65b2e41f6c5e7c395c9fbcf382393ff2c9ff4017be48c50c068
|
|
7
|
+
data.tar.gz: d1bb4d22f4375688fe930b36c31a9a90c0bab8081103924671fe834cb7ee036ca9106cea64faf8ffbb52d1f2da63e3d9c1a39aa433d64ba9363db18c28d46eae
|
|
@@ -2,72 +2,57 @@ name: Test and Release
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches:
|
|
5
|
+
branches:
|
|
6
6
|
- main
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
|
-
|
|
9
|
+
tests:
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
ruby: [2.6, 2.7, 3.0]
|
|
10
13
|
runs-on: ubuntu-latest
|
|
11
14
|
|
|
12
15
|
steps:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
test-2_6:
|
|
16
|
+
- uses: actions/checkout@v2
|
|
17
|
+
- name: Set up Ruby
|
|
18
|
+
uses: ruby/setup-ruby@v1
|
|
19
|
+
with:
|
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
|
21
|
+
bundler-cache: true
|
|
22
|
+
- name: Run linter
|
|
23
|
+
run: bundle exec rubocop
|
|
24
|
+
- name: Run tests
|
|
25
|
+
run: bundle exec rspec
|
|
26
|
+
prettier:
|
|
25
27
|
runs-on: ubuntu-latest
|
|
26
|
-
|
|
27
|
-
steps:
|
|
28
|
-
- uses: actions/checkout@v2
|
|
29
|
-
- name: Set up Ruby
|
|
30
|
-
uses: ruby/setup-ruby@v1
|
|
31
|
-
with:
|
|
32
|
-
ruby-version: 2.6
|
|
33
|
-
- name: Install dependencies
|
|
34
|
-
run: bundle install
|
|
35
|
-
- name: Run linter
|
|
36
|
-
run: bundle exec rubocop
|
|
37
|
-
- name: Run tests
|
|
38
|
-
run: bundle exec rspec
|
|
39
|
-
test-2_7:
|
|
40
|
-
runs-on: ubuntu-latest
|
|
41
|
-
|
|
42
28
|
steps:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- name: Run tests
|
|
53
|
-
run: bundle exec rspec
|
|
29
|
+
- uses: actions/checkout@v2
|
|
30
|
+
- name: Set up Node
|
|
31
|
+
uses: actions/setup-node@v2
|
|
32
|
+
with:
|
|
33
|
+
node-version: '14'
|
|
34
|
+
- name: Install yarn dep
|
|
35
|
+
run: yarn install
|
|
36
|
+
- name: Check prettier
|
|
37
|
+
run: yarn prettier -c '**/*.rb'
|
|
54
38
|
release:
|
|
55
|
-
needs: [
|
|
39
|
+
needs: [tests, prettier]
|
|
56
40
|
runs-on: ubuntu-latest
|
|
57
41
|
|
|
58
42
|
steps:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
43
|
+
- uses: actions/checkout@v2
|
|
44
|
+
- name: Set up Ruby
|
|
45
|
+
uses: ruby/setup-ruby@v1
|
|
46
|
+
with:
|
|
47
|
+
ruby-version: 3.0
|
|
48
|
+
bundler-cache: true
|
|
49
|
+
- name: Prepare credentials
|
|
50
|
+
env:
|
|
51
|
+
RUBYGEM_KEY: ${{ secrets.RUBYGEM_KEY }}
|
|
52
|
+
run: "mkdir -p ~/.gem && echo -e \"---\\r\\n:rubygems_api_key: $RUBYGEM_KEY\" > ~/.gem/credentials && chmod 0600 ~/.gem/credentials"
|
|
53
|
+
- name: Setup username/email
|
|
54
|
+
run: 'git config --global user.email zaratan@hey.com && git config --global user.name "Denis <Zaratan> Pasin"'
|
|
55
|
+
- name: Fetch tags from remote
|
|
56
|
+
run: 'git fetch -t'
|
|
57
|
+
- name: Publish if version change
|
|
58
|
+
run: 'git diff `git tag | tail -1` -- lib/shotgun_api_ruby/version.rb | grep -E "^\+.*VERSION" && rake release || echo "No release for now"'
|
|
@@ -2,52 +2,36 @@ name: Tests
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches-ignore:
|
|
5
|
+
branches-ignore:
|
|
6
6
|
- main
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
|
-
|
|
9
|
+
tests:
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
ruby: [2.6, 2.7, 3.0]
|
|
10
13
|
runs-on: ubuntu-latest
|
|
11
14
|
|
|
12
15
|
steps:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
test-2_6:
|
|
16
|
+
- uses: actions/checkout@v2
|
|
17
|
+
- name: Set up Ruby
|
|
18
|
+
uses: ruby/setup-ruby@v1
|
|
19
|
+
with:
|
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
|
21
|
+
bundler-cache: true
|
|
22
|
+
- name: Run linter
|
|
23
|
+
run: bundle exec rubocop
|
|
24
|
+
- name: Run tests
|
|
25
|
+
run: bundle exec rspec
|
|
26
|
+
prettier:
|
|
25
27
|
runs-on: ubuntu-latest
|
|
26
|
-
|
|
27
|
-
steps:
|
|
28
|
-
- uses: actions/checkout@v2
|
|
29
|
-
- name: Set up Ruby
|
|
30
|
-
uses: ruby/setup-ruby@v1
|
|
31
|
-
with:
|
|
32
|
-
ruby-version: 2.6
|
|
33
|
-
- name: Install dependencies
|
|
34
|
-
run: bundle install
|
|
35
|
-
- name: Run linter
|
|
36
|
-
run: bundle exec rubocop
|
|
37
|
-
- name: Run tests
|
|
38
|
-
run: bundle exec rspec
|
|
39
|
-
test-2_7:
|
|
40
|
-
runs-on: ubuntu-latest
|
|
41
|
-
|
|
42
28
|
steps:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- name: Run tests
|
|
53
|
-
run: bundle exec rspec
|
|
29
|
+
- uses: actions/checkout@v2
|
|
30
|
+
- name: Set up Node
|
|
31
|
+
uses: actions/setup-node@v2
|
|
32
|
+
with:
|
|
33
|
+
node-version: '14'
|
|
34
|
+
- name: Install yarn dep
|
|
35
|
+
run: yarn install
|
|
36
|
+
- name: Check prettier
|
|
37
|
+
run: yarn prettier -c '**/*.rb'
|
|
@@ -14,8 +14,8 @@ jobs:
|
|
|
14
14
|
- name: Fetch main branch
|
|
15
15
|
run: git fetch origin main:main
|
|
16
16
|
- name: Verify if there's a change in version
|
|
17
|
-
run: "git diff main lib/shotgun_api_ruby/version.rb | grep VERSION"
|
|
17
|
+
run: "git diff main -- lib/shotgun_api_ruby/version.rb | grep VERSION"
|
|
18
18
|
- name: Print new version
|
|
19
|
-
run: 'git diff main lib/shotgun_api_ruby/version.rb | grep -E "^\+.*VERSION" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?"'
|
|
19
|
+
run: 'git diff main -- lib/shotgun_api_ruby/version.rb | grep -E "^\+.*VERSION" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?"'
|
|
20
20
|
- name: Verify if higher version
|
|
21
|
-
run: '[[ $(git diff main lib/shotgun_api_ruby/version.rb | grep -E "^\+.*VERSION" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?") > $(git diff main lib/shotgun_api_ruby/version.rb | grep -E "^-.*VERSION" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?") ]]'
|
|
21
|
+
run: '[[ $(git diff main -- lib/shotgun_api_ruby/version.rb | grep -E "^\+.*VERSION" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?") > $(git diff main -- lib/shotgun_api_ruby/version.rb | grep -E "^-.*VERSION" | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?") ]]'
|
data/.gitignore
CHANGED
data/.overcommit.yml
CHANGED
|
@@ -6,7 +6,16 @@ PreCommit:
|
|
|
6
6
|
enabled: true
|
|
7
7
|
BundleAudit:
|
|
8
8
|
enabled: true
|
|
9
|
+
Prettier:
|
|
10
|
+
enabled: true
|
|
11
|
+
required_executable: './bin/prettirun'
|
|
9
12
|
PrePush:
|
|
10
13
|
RSpec:
|
|
11
14
|
enabled: true
|
|
12
15
|
command: ['bundle', 'exec', 'rspec', '-f', 'p'] # Invoke within Bundler context
|
|
16
|
+
Prettier:
|
|
17
|
+
enabled: true
|
|
18
|
+
required_executable: './bin/prettirun'
|
|
19
|
+
Rubocop:
|
|
20
|
+
enabled: true
|
|
21
|
+
required_executable: './bin/ruborun'
|
data/.prettierrc.js
ADDED
data/.rubocop.yml
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
inherit_from:
|
|
2
2
|
- http://relaxed.ruby.style/rubocop.yml
|
|
3
3
|
|
|
4
|
+
inherit_gem:
|
|
5
|
+
prettier: rubocop.yml
|
|
6
|
+
|
|
4
7
|
require:
|
|
5
8
|
- rubocop-performance
|
|
6
9
|
|
|
@@ -8,56 +11,11 @@ AllCops:
|
|
|
8
11
|
NewCops: enable
|
|
9
12
|
DisplayStyleGuide: true
|
|
10
13
|
DisplayCopNames: true
|
|
14
|
+
SuggestExtensions: false
|
|
11
15
|
Exclude:
|
|
12
|
-
- '
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Enabled: false
|
|
16
|
-
|
|
17
|
-
Gemspec/RequiredRubyVersion:
|
|
18
|
-
Enabled: false
|
|
19
|
-
|
|
20
|
-
Layout/DotPosition:
|
|
21
|
-
Enabled: true
|
|
22
|
-
EnforcedStyle: trailing
|
|
23
|
-
|
|
24
|
-
Style/TrailingCommaInArrayLiteral:
|
|
25
|
-
Enabled: true
|
|
26
|
-
EnforcedStyleForMultiline: comma
|
|
27
|
-
|
|
28
|
-
Style/TrailingCommaInHashLiteral:
|
|
29
|
-
Enabled: true
|
|
30
|
-
EnforcedStyleForMultiline: comma
|
|
31
|
-
|
|
32
|
-
Layout/MultilineArrayLineBreaks:
|
|
33
|
-
Enabled: true
|
|
34
|
-
|
|
35
|
-
Layout/MultilineHashKeyLineBreaks:
|
|
36
|
-
Enabled: true
|
|
37
|
-
|
|
38
|
-
Layout/MultilineMethodArgumentLineBreaks:
|
|
39
|
-
Enabled: true
|
|
40
|
-
|
|
41
|
-
Layout/FirstArrayElementLineBreak:
|
|
42
|
-
Enabled: true
|
|
43
|
-
|
|
44
|
-
Layout/FirstHashElementLineBreak:
|
|
45
|
-
Enabled: true
|
|
46
|
-
|
|
47
|
-
Layout/FirstMethodArgumentLineBreak:
|
|
48
|
-
Enabled: true
|
|
49
|
-
|
|
50
|
-
Layout/MultilineAssignmentLayout:
|
|
51
|
-
Enabled: true
|
|
52
|
-
|
|
53
|
-
Layout/LineLength:
|
|
54
|
-
Enabled: true
|
|
55
|
-
Max: 120
|
|
56
|
-
AutoCorrect: true
|
|
57
|
-
Exclude:
|
|
58
|
-
- Gemfile
|
|
59
|
-
- Guardfile
|
|
60
|
-
- spec/interactors/send_gdpr_response_spec.rb
|
|
16
|
+
- 'bin/*'
|
|
17
|
+
- 'vendor/**/*'
|
|
18
|
+
- 'node_modules/**/*'
|
|
61
19
|
|
|
62
20
|
Metrics/BlockLength:
|
|
63
21
|
Exclude:
|
|
@@ -66,3 +24,10 @@ Metrics/BlockLength:
|
|
|
66
24
|
- 'config/environments/*.rb'
|
|
67
25
|
- 'lib/tasks/*.rake'
|
|
68
26
|
- 'shotgun_api_ruby.gemspec'
|
|
27
|
+
|
|
28
|
+
### Prettier
|
|
29
|
+
Style:
|
|
30
|
+
Enabled: false
|
|
31
|
+
|
|
32
|
+
Gemspec/RequiredRubyVersion:
|
|
33
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.1] - 2021-06-15
|
|
10
|
+
### Added
|
|
11
|
+
- summarize and count support
|
|
12
|
+
|
|
13
|
+
## [0.1.0] - 2021-06-14
|
|
14
|
+
### Added
|
|
15
|
+
- Complete test coverage (Unit + Integration tests)
|
|
16
|
+
- Adding minimum coverage for tests
|
|
17
|
+
- Adding Guard
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- Fixed many edge-case bugs
|
|
21
|
+
|
|
22
|
+
### Removed
|
|
23
|
+
- Removed the `Gemfile.lock` since it shouldn't be commited in gems
|
|
24
|
+
|
|
25
|
+
## [0.0.8.5] - 2021-01-15
|
|
26
|
+
### Added
|
|
27
|
+
- Added prettier for ruby style
|
|
28
|
+
|
|
29
|
+
## [0.0.8.4] - 2021-01-07
|
|
30
|
+
### Changed
|
|
31
|
+
- Safer eager_load
|
|
32
|
+
|
|
33
|
+
## [0.0.8.3] - 2021-01-07
|
|
34
|
+
### Added
|
|
35
|
+
- eager_load files to fix weird bugs in rspec
|
|
36
|
+
|
|
9
37
|
## [0.0.8] - 2020-12-16
|
|
10
38
|
### Added
|
|
11
39
|
- Schema: read
|
|
@@ -18,6 +46,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
18
46
|
- Entities: delete
|
|
19
47
|
- Entities: revive
|
|
20
48
|
|
|
21
|
-
[Unreleased]: https://github.com/shotgunsoftware/shotgun_api_ruby/compare/v0.
|
|
49
|
+
[Unreleased]: https://github.com/shotgunsoftware/shotgun_api_ruby/compare/v0.1.1...HEAD
|
|
50
|
+
[0.1.1]: https://github.com/shotgunsoftware/shotgun_api_ruby/releases/tag/v0.1.1
|
|
51
|
+
[0.1.0]: https://github.com/shotgunsoftware/shotgun_api_ruby/releases/tag/v0.1.0
|
|
52
|
+
[0.0.8.5]: https://github.com/shotgunsoftware/shotgun_api_ruby/releases/tag/v0.0.8.5
|
|
53
|
+
[0.0.8.4]: https://github.com/shotgunsoftware/shotgun_api_ruby/releases/tag/v0.0.8.4
|
|
54
|
+
[0.0.8.3]: https://github.com/shotgunsoftware/shotgun_api_ruby/releases/tag/v0.0.8.3
|
|
22
55
|
[0.0.8]: https://github.com/shotgunsoftware/shotgun_api_ruby/releases/tag/v0.0.8
|
|
23
56
|
[0.0.7]: https://github.com/shotgunsoftware/shotgun_api_ruby/releases/tag/v0.0.7
|
data/Guardfile
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# A sample Guardfile
|
|
4
|
+
# More info at https://github.com/guard/guard#readme
|
|
5
|
+
|
|
6
|
+
## Uncomment and set this to only include directories you want to watch
|
|
7
|
+
# directories %w(app lib config test spec features) \
|
|
8
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
|
9
|
+
|
|
10
|
+
## Note: if you are using the `directories` clause above and you are not
|
|
11
|
+
## watching the project directory ('.'), then you will want to move
|
|
12
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
|
13
|
+
#
|
|
14
|
+
# $ mkdir config
|
|
15
|
+
# $ mv Guardfile config/
|
|
16
|
+
# $ ln -s config/Guardfile .
|
|
17
|
+
#
|
|
18
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
|
19
|
+
|
|
20
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
|
21
|
+
# rspec may be run, below are examples of the most common uses.
|
|
22
|
+
# * bundler: 'bundle exec rspec'
|
|
23
|
+
# * bundler binstubs: 'bin/rspec'
|
|
24
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
|
25
|
+
# installed the spring binstubs per the docs)
|
|
26
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
|
27
|
+
# * 'just' rspec: 'rspec'
|
|
28
|
+
|
|
29
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
|
30
|
+
require "guard/rspec/dsl"
|
|
31
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
|
32
|
+
|
|
33
|
+
# Feel free to open issues for suggestions and improvements
|
|
34
|
+
|
|
35
|
+
# RSpec files
|
|
36
|
+
rspec = dsl.rspec
|
|
37
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
|
38
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
|
39
|
+
watch(rspec.spec_files)
|
|
40
|
+
|
|
41
|
+
# map lib files to corresponding file
|
|
42
|
+
watch(%r{lib/(.*)/([^/]*).rb}) { |m| rspec.spec.call("#{m[1]}/#{m[2]}") }
|
|
43
|
+
|
|
44
|
+
# Ruby files
|
|
45
|
+
ruby = dsl.ruby
|
|
46
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
|
47
|
+
end
|
data/README.md
CHANGED
|
@@ -306,7 +306,7 @@ Example:
|
|
|
306
306
|
client.assets.find(724, fields: [:code, 'description'], retired: false)
|
|
307
307
|
```
|
|
308
308
|
|
|
309
|
-
|
|
309
|
+
### Create
|
|
310
310
|
|
|
311
311
|
Will create the entity referenced by the id with the following fields.
|
|
312
312
|
If successful, it will return the newly created entity.
|
|
@@ -315,7 +315,7 @@ If successful, it will return the newly created entity.
|
|
|
315
315
|
client.assets.create(code: 'New Asset', project: {type: 'Project', id: 63})
|
|
316
316
|
```
|
|
317
317
|
|
|
318
|
-
|
|
318
|
+
### Update
|
|
319
319
|
|
|
320
320
|
Will update the entity referenced by the id with the following fields.
|
|
321
321
|
If successful, it will return the modified entity.
|
|
@@ -324,7 +324,7 @@ If successful, it will return the modified entity.
|
|
|
324
324
|
client.assets.update(1226, code: 'Updated Asset', sg_status_list: 'fin')
|
|
325
325
|
```
|
|
326
326
|
|
|
327
|
-
|
|
327
|
+
### Delete
|
|
328
328
|
|
|
329
329
|
Will destroys the entity referenced by the id. Will return true if successful.
|
|
330
330
|
|
|
@@ -332,7 +332,7 @@ Will destroys the entity referenced by the id. Will return true if successful.
|
|
|
332
332
|
client.assets.delete(1226)
|
|
333
333
|
```
|
|
334
334
|
|
|
335
|
-
|
|
335
|
+
### Revive
|
|
336
336
|
|
|
337
337
|
Will try to revive the entity referenced by the id. Will return true if successful.
|
|
338
338
|
|
|
@@ -340,6 +340,89 @@ Will try to revive the entity referenced by the id. Will return true if successf
|
|
|
340
340
|
client.assets.revive(1226)
|
|
341
341
|
```
|
|
342
342
|
|
|
343
|
+
### Summarize
|
|
344
|
+
|
|
345
|
+
Will summarize data for an entity type.
|
|
346
|
+
|
|
347
|
+
Example:
|
|
348
|
+
```ruby
|
|
349
|
+
# Simplest example
|
|
350
|
+
client.assets.summarize(summary_fields: {id: :count})
|
|
351
|
+
|
|
352
|
+
# Full complex example
|
|
353
|
+
client.assets.summarize(
|
|
354
|
+
filter: { project: { id: 155 }, sg_status_list: :act },
|
|
355
|
+
logical_operator: 'or',
|
|
356
|
+
include_archived_projects: true,
|
|
357
|
+
grouping: {
|
|
358
|
+
code: {direction: :desc, type: 'exact'}
|
|
359
|
+
},
|
|
360
|
+
summary_fields: { id: :count }
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
# Raw shotgun queries
|
|
364
|
+
client.assets.summarize(
|
|
365
|
+
grouping: [
|
|
366
|
+
{
|
|
367
|
+
"field": "sg_asset_type",
|
|
368
|
+
"type": "exact",
|
|
369
|
+
"direction": "asc"
|
|
370
|
+
}
|
|
371
|
+
],
|
|
372
|
+
summary_fields: [
|
|
373
|
+
{
|
|
374
|
+
"field": "id",
|
|
375
|
+
"type": "count"
|
|
376
|
+
}
|
|
377
|
+
],
|
|
378
|
+
)
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
It accepts the same `filter` and `logical_operator` as a `search` will.
|
|
382
|
+
|
|
383
|
+
#### Summary fields
|
|
384
|
+
|
|
385
|
+
Those can have two forms:
|
|
386
|
+
|
|
387
|
+
##### The normal API form
|
|
388
|
+
|
|
389
|
+
You need to supply the summary_fields as an array and it will be passed directly to the SG REST API
|
|
390
|
+
|
|
391
|
+
#### The convenient form
|
|
392
|
+
|
|
393
|
+
Using an array isn't very convenient most of the time. You can use a hash instead and it will be translated into a "SG summary_fields array".
|
|
394
|
+
|
|
395
|
+
Each key of the hash is the field name and the corresponding value is the type a summary you want (can be a string or a symbol)
|
|
396
|
+
|
|
397
|
+
#### Grouping
|
|
398
|
+
|
|
399
|
+
Those can have two forms:
|
|
400
|
+
|
|
401
|
+
##### The normal API form
|
|
402
|
+
|
|
403
|
+
You need to supply the grouping as an array and it will be passed directly to the SG REST API
|
|
404
|
+
|
|
405
|
+
#### The convenient form
|
|
406
|
+
|
|
407
|
+
Using an array isn't very convenient most of the time. You can use a hash instead and it will be translated into a "SG grouping array".
|
|
408
|
+
|
|
409
|
+
Each key of the hash is the field name and the corresponding value can either be :
|
|
410
|
+
* A String/Symbol and then will be used a a direction. The type will be 'exact'
|
|
411
|
+
* A Hash with optional 'type' and 'direction' keys. If a key is not specified it will be 'exact' and 'asc' respectively.
|
|
412
|
+
|
|
413
|
+
### Count
|
|
414
|
+
|
|
415
|
+
This is a helper for more a readable count summary. This can be passed `filter` and `logical_operator`.
|
|
416
|
+
|
|
417
|
+
Example:
|
|
418
|
+
|
|
419
|
+
```ruby
|
|
420
|
+
client.assets.count
|
|
421
|
+
|
|
422
|
+
# This will be equivalent as doing:
|
|
423
|
+
client.assets.summarize(summary_fields: [{type: :record_count, field: :id}])
|
|
424
|
+
```
|
|
425
|
+
|
|
343
426
|
### Schema
|
|
344
427
|
|
|
345
428
|
Those calls allow to inspect the schema for a shotgun site.
|