shotgrid_api_ruby 0.1.2 → 0.1.3.3
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/ISSUE_TEMPLATE/bug_report.md +38 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.rubocop.yml +3 -2
- data/.ruby-version +1 -1
- data/CHANGELOG.md +22 -1
- data/CODE_OF_CONDUCT.md +128 -0
- data/README.md +17 -0
- data/lib/shotgrid_api_ruby/auth.rb +6 -1
- data/lib/shotgrid_api_ruby/entities/params.rb +9 -6
- data/lib/shotgrid_api_ruby/entities/schema.rb +19 -10
- data/lib/shotgrid_api_ruby/entities/summarize.rb +5 -1
- data/lib/shotgrid_api_ruby/entities.rb +36 -11
- data/lib/shotgrid_api_ruby/preferences.rb +5 -1
- data/lib/shotgrid_api_ruby/server_info.rb +5 -1
- data/lib/shotgrid_api_ruby/shotgrid_call_error.rb +15 -0
- data/lib/shotgrid_api_ruby/version.rb +1 -1
- data/package.json +3 -0
- data/shotgrid_api_ruby.gemspec +1 -1
- data/yarn.lock +6 -6
- metadata +8 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b3d22a3f63c6e1fcccbce5467741ccea7df6d21c596beceadb41d97a728b23ee
|
|
4
|
+
data.tar.gz: cb1b8029e0da53a7c134101f8a2ec50ec64d898f63a106a8c7d1f063d58ab00e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a21da51ac645ddfd6e047554ee2539252f3b57c933a347a837b610b444c206cfec494d835159fa569243caffb9d08395bd1abd29821705183e060c12e0e54a1
|
|
7
|
+
data.tar.gz: a16b118eab23a178c324a3bae810965de85c4beb6c0dcb3e1486cd93bb410daa358a2990ccfc73eb835eca5834e2d427d436892df3426014b9cb22d208d29f25
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. Go to '...'
|
|
16
|
+
2. Click on '....'
|
|
17
|
+
3. Scroll down to '....'
|
|
18
|
+
4. See error
|
|
19
|
+
|
|
20
|
+
**Expected behavior**
|
|
21
|
+
A clear and concise description of what you expected to happen.
|
|
22
|
+
|
|
23
|
+
**Screenshots**
|
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
|
25
|
+
|
|
26
|
+
**Desktop (please complete the following information):**
|
|
27
|
+
- OS: [e.g. iOS]
|
|
28
|
+
- Browser [e.g. chrome, safari]
|
|
29
|
+
- Version [e.g. 22]
|
|
30
|
+
|
|
31
|
+
**Smartphone (please complete the following information):**
|
|
32
|
+
- Device: [e.g. iPhone6]
|
|
33
|
+
- OS: [e.g. iOS8.1]
|
|
34
|
+
- Browser [e.g. stock browser, safari]
|
|
35
|
+
- Version [e.g. 22]
|
|
36
|
+
|
|
37
|
+
**Additional context**
|
|
38
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
data/.rubocop.yml
CHANGED
|
@@ -4,7 +4,7 @@ inherit_from:
|
|
|
4
4
|
inherit_gem:
|
|
5
5
|
prettier: rubocop.yml
|
|
6
6
|
|
|
7
|
-
require:
|
|
7
|
+
require:
|
|
8
8
|
- rubocop-performance
|
|
9
9
|
|
|
10
10
|
AllCops:
|
|
@@ -12,6 +12,7 @@ AllCops:
|
|
|
12
12
|
DisplayStyleGuide: true
|
|
13
13
|
DisplayCopNames: true
|
|
14
14
|
SuggestExtensions: false
|
|
15
|
+
TargetRubyVersion: 2.6
|
|
15
16
|
Exclude:
|
|
16
17
|
- 'bin/*'
|
|
17
18
|
- 'vendor/**/*'
|
|
@@ -24,7 +25,7 @@ Metrics/BlockLength:
|
|
|
24
25
|
- 'config/environments/*.rb'
|
|
25
26
|
- 'lib/tasks/*.rake'
|
|
26
27
|
- 'shotgun_api_ruby.gemspec'
|
|
27
|
-
|
|
28
|
+
|
|
28
29
|
### Prettier
|
|
29
30
|
Style:
|
|
30
31
|
Enabled: false
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3.0.2
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.3.3] - 2021-08-28
|
|
10
|
+
### Added
|
|
11
|
+
- Issue default format
|
|
12
|
+
|
|
13
|
+
## [0.1.3.2] - 2021-08-24
|
|
14
|
+
### Added
|
|
15
|
+
- Code Of Conduct
|
|
16
|
+
|
|
17
|
+
## [0.1.3.1] - 2021-08-24
|
|
18
|
+
### Changed
|
|
19
|
+
- Correctly advertising the minimum ruby version to 2.6
|
|
20
|
+
|
|
21
|
+
## [0.1.3] - 2021-08-24
|
|
22
|
+
### Changed
|
|
23
|
+
- Updated tooling
|
|
24
|
+
- Adding `ShotgridCallError` to capture call errors and give access to the raw Faraday response
|
|
25
|
+
|
|
9
26
|
## [0.1.2] - 2021-06-16
|
|
10
27
|
### Changed
|
|
11
28
|
- Renamed to Shotgrid
|
|
@@ -50,7 +67,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
50
67
|
- Entities: delete
|
|
51
68
|
- Entities: revive
|
|
52
69
|
|
|
53
|
-
[Unreleased]: https://github.com/shotgunsoftware/shotgrid_api_ruby/compare/v0.1.
|
|
70
|
+
[Unreleased]: https://github.com/shotgunsoftware/shotgrid_api_ruby/compare/v0.1.3.3...HEAD
|
|
71
|
+
[0.1.3.3]: https://github.com/shotgunsoftware/shotgrid_api_ruby/releases/tag/v0.1.3.3
|
|
72
|
+
[0.1.3.2]: https://github.com/shotgunsoftware/shotgrid_api_ruby/releases/tag/v0.1.3.2
|
|
73
|
+
[0.1.3.1]: https://github.com/shotgunsoftware/shotgrid_api_ruby/releases/tag/v0.1.3.1
|
|
74
|
+
[0.1.3]: https://github.com/shotgunsoftware/shotgrid_api_ruby/releases/tag/v0.1.3
|
|
54
75
|
[0.1.2]: https://github.com/shotgunsoftware/shotgrid_api_ruby/releases/tag/v0.1.2
|
|
55
76
|
[0.1.1]: https://github.com/shotgunsoftware/shotgrid_api_ruby/releases/tag/v0.1.1
|
|
56
77
|
[0.1.0]: https://github.com/shotgunsoftware/shotgrid_api_ruby/releases/tag/v0.1.0
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
denis.pasin@autodesk.com.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.0, available at
|
|
119
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
122
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
123
|
+
|
|
124
|
+
[homepage]: https://www.contributor-covenant.org
|
|
125
|
+
|
|
126
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
127
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
128
|
+
https://www.contributor-covenant.org/translations.
|
data/README.md
CHANGED
|
@@ -71,6 +71,23 @@ client = ShotgridApiRuby.new(shotgrid_site: 'xxx', auth: {session_token: 'sessio
|
|
|
71
71
|
client = ShotgridApiRuby.new(shotgrid_site: 'xxx', auth: {refresh_token: 'refresh_token'})
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
### ShotgridCallError
|
|
75
|
+
|
|
76
|
+
Every ShotGrid call resulting in an error will throw a ShotgridCallError. This error class derive from StandardError and will implement 2 extra methods:
|
|
77
|
+
- `#response` => Will returns the original HTTP response (a Faraday::Response).
|
|
78
|
+
- `#status` => This method is a shortcut to get the status from the response.
|
|
79
|
+
|
|
80
|
+
exemple
|
|
81
|
+
```ruby
|
|
82
|
+
begin
|
|
83
|
+
# A ShotGrid call resulting in a error
|
|
84
|
+
rescue StandardError => e
|
|
85
|
+
p e.message, e.backtrace # Will behave as a normal StandardError
|
|
86
|
+
p e.response.body # Original unparsed body from ShotGrid response
|
|
87
|
+
p e.status # Status code from ShotGrid answer
|
|
88
|
+
end
|
|
89
|
+
```
|
|
90
|
+
|
|
74
91
|
### Server Infos
|
|
75
92
|
|
|
76
93
|
Get general server infos:
|
|
@@ -107,7 +107,12 @@ module ShotgridApiRuby
|
|
|
107
107
|
end
|
|
108
108
|
resp_body = JSON.parse(resp.body)
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
if resp.status >= 300
|
|
111
|
+
raise ShotgridCallError.new(
|
|
112
|
+
response: resp,
|
|
113
|
+
message: "Can't login: #{resp_body['errors']}",
|
|
114
|
+
)
|
|
115
|
+
end
|
|
111
116
|
|
|
112
117
|
@access_token = resp_body['access_token']
|
|
113
118
|
@token_expiry = Time.now + resp_body['expires_in']
|
|
@@ -11,9 +11,11 @@ module ShotgridApiRuby
|
|
|
11
11
|
|
|
12
12
|
self[:sort] =
|
|
13
13
|
if sort.is_a?(Hash)
|
|
14
|
-
sort
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
sort
|
|
15
|
+
.map do |field, direction|
|
|
16
|
+
"#{direction.to_s.start_with?('desc') ? '-' : ''}#{field}"
|
|
17
|
+
end
|
|
18
|
+
.join(',')
|
|
17
19
|
else
|
|
18
20
|
[sort].flatten.join(',')
|
|
19
21
|
end
|
|
@@ -122,9 +124,10 @@ module ShotgridApiRuby
|
|
|
122
124
|
filter_val.is_a?(Symbol)
|
|
123
125
|
) ||
|
|
124
126
|
(
|
|
125
|
-
filter_val.is_a?(Array) &&
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
filter_val.is_a?(Array) &&
|
|
128
|
+
filter_val.all? do |val|
|
|
129
|
+
val.is_a?(String) || val.is_a?(Symbol) || val.is_a?(Integer)
|
|
130
|
+
end
|
|
128
131
|
)
|
|
129
132
|
end
|
|
130
133
|
end
|
|
@@ -14,7 +14,10 @@ module ShotgridApiRuby
|
|
|
14
14
|
resp = @connection.get('')
|
|
15
15
|
|
|
16
16
|
if resp.status >= 300
|
|
17
|
-
raise
|
|
17
|
+
raise ShotgridCallError.new(
|
|
18
|
+
response: resp,
|
|
19
|
+
message: "Error while read schema for #{type}: #{resp.body}",
|
|
20
|
+
)
|
|
18
21
|
end
|
|
19
22
|
|
|
20
23
|
resp_body = JSON.parse(resp.body)
|
|
@@ -27,20 +30,26 @@ module ShotgridApiRuby
|
|
|
27
30
|
resp_body = JSON.parse(resp.body)
|
|
28
31
|
|
|
29
32
|
if resp.status >= 300
|
|
30
|
-
raise
|
|
33
|
+
raise ShotgridCallError.new(
|
|
34
|
+
response: resp,
|
|
35
|
+
message:
|
|
36
|
+
"Error while read schema fields for #{type}: #{resp.body}",
|
|
37
|
+
)
|
|
31
38
|
end
|
|
32
39
|
|
|
33
40
|
OpenStruct.new(
|
|
34
41
|
resp_body['data'].transform_values do |value|
|
|
35
42
|
OpenStruct.new(
|
|
36
|
-
value
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
value
|
|
44
|
+
.transform_values { |attribute| attribute['value'] }
|
|
45
|
+
.merge(
|
|
46
|
+
properties:
|
|
47
|
+
OpenStruct.new(
|
|
48
|
+
value['properties'].transform_values do |prop|
|
|
49
|
+
prop['value']
|
|
50
|
+
end,
|
|
51
|
+
),
|
|
52
|
+
),
|
|
44
53
|
)
|
|
45
54
|
end,
|
|
46
55
|
)
|
|
@@ -51,7 +51,11 @@ module ShotgridApiRuby
|
|
|
51
51
|
resp_body = JSON.parse(resp.body)
|
|
52
52
|
|
|
53
53
|
if resp.status >= 300
|
|
54
|
-
raise
|
|
54
|
+
raise ShotgridCallError.new(
|
|
55
|
+
response: resp,
|
|
56
|
+
message:
|
|
57
|
+
"Error while getting summarize for #{type}: #{resp_body['errors']}",
|
|
58
|
+
)
|
|
55
59
|
end
|
|
56
60
|
|
|
57
61
|
Summary.new(
|
|
@@ -40,7 +40,10 @@ module ShotgridApiRuby
|
|
|
40
40
|
resp_body = JSON.parse(resp.body)
|
|
41
41
|
|
|
42
42
|
if resp.status >= 300
|
|
43
|
-
raise
|
|
43
|
+
raise ShotgridCallError.new(
|
|
44
|
+
message: "Error while getting #{type}: #{resp_body['errors']}",
|
|
45
|
+
response: resp,
|
|
46
|
+
)
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
entity = resp_body['data']
|
|
@@ -62,9 +65,13 @@ module ShotgridApiRuby
|
|
|
62
65
|
resp_body = JSON.parse(resp.body)
|
|
63
66
|
|
|
64
67
|
if resp.status >= 300
|
|
65
|
-
raise
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
raise ShotgridCallError.new(
|
|
69
|
+
response: resp,
|
|
70
|
+
message:
|
|
71
|
+
"Error while creating #{type} with #{attributes}: #{
|
|
72
|
+
resp_body['errors']
|
|
73
|
+
}",
|
|
74
|
+
)
|
|
68
75
|
end
|
|
69
76
|
|
|
70
77
|
entity = resp_body['data']
|
|
@@ -88,9 +95,13 @@ module ShotgridApiRuby
|
|
|
88
95
|
resp_body = JSON.parse(resp.body)
|
|
89
96
|
|
|
90
97
|
if resp.status >= 300
|
|
91
|
-
raise
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
raise ShotgridCallError.new(
|
|
99
|
+
response: resp,
|
|
100
|
+
message:
|
|
101
|
+
"Error while updating #{type}##{id} with #{changes}: #{
|
|
102
|
+
resp_body['errors']
|
|
103
|
+
}",
|
|
104
|
+
)
|
|
94
105
|
end
|
|
95
106
|
|
|
96
107
|
entity = resp_body['data']
|
|
@@ -111,7 +122,11 @@ module ShotgridApiRuby
|
|
|
111
122
|
|
|
112
123
|
if resp.status >= 300
|
|
113
124
|
resp_body = JSON.parse(resp.body)
|
|
114
|
-
raise
|
|
125
|
+
raise ShotgridCallError.new(
|
|
126
|
+
response: resp,
|
|
127
|
+
message:
|
|
128
|
+
"Error while deleting #{type}##{id}: #{resp_body['errors']}",
|
|
129
|
+
)
|
|
115
130
|
end
|
|
116
131
|
|
|
117
132
|
true
|
|
@@ -122,7 +137,11 @@ module ShotgridApiRuby
|
|
|
122
137
|
|
|
123
138
|
if resp.status >= 300
|
|
124
139
|
resp_body = JSON.parse(resp.body)
|
|
125
|
-
raise
|
|
140
|
+
raise ShotgridCallError.new(
|
|
141
|
+
response: resp,
|
|
142
|
+
message:
|
|
143
|
+
"Error while reviving #{type}##{id}: #{resp_body['errors']}",
|
|
144
|
+
)
|
|
126
145
|
end
|
|
127
146
|
|
|
128
147
|
true
|
|
@@ -165,7 +184,10 @@ module ShotgridApiRuby
|
|
|
165
184
|
resp_body = JSON.parse(resp.body)
|
|
166
185
|
|
|
167
186
|
if resp.status >= 300
|
|
168
|
-
raise
|
|
187
|
+
raise ShotgridCallError.new(
|
|
188
|
+
response: resp,
|
|
189
|
+
message: "Error while getting #{type}: #{resp_body['errors']}",
|
|
190
|
+
)
|
|
169
191
|
end
|
|
170
192
|
|
|
171
193
|
resp_body['data'].map do |entity|
|
|
@@ -228,7 +250,10 @@ module ShotgridApiRuby
|
|
|
228
250
|
resp_body = JSON.parse(resp.body)
|
|
229
251
|
|
|
230
252
|
if resp.status >= 300
|
|
231
|
-
raise
|
|
253
|
+
raise ShotgridCallError.new(
|
|
254
|
+
response: resp,
|
|
255
|
+
message: "Error while getting #{type}: #{resp_body['errors']}",
|
|
256
|
+
)
|
|
232
257
|
end
|
|
233
258
|
|
|
234
259
|
resp_body['data'].map do |entity|
|
|
@@ -14,7 +14,11 @@ module ShotgridApiRuby
|
|
|
14
14
|
resp_body = JSON.parse(resp.body)
|
|
15
15
|
|
|
16
16
|
if resp.status >= 300
|
|
17
|
-
raise
|
|
17
|
+
raise ShotgridCallError.new(
|
|
18
|
+
response: resp,
|
|
19
|
+
message:
|
|
20
|
+
"Error while getting server preferences: #{resp_body['errors']}",
|
|
21
|
+
)
|
|
18
22
|
end
|
|
19
23
|
|
|
20
24
|
data = resp_body['data']
|
|
@@ -13,7 +13,11 @@ module ShotgridApiRuby
|
|
|
13
13
|
resp_body = JSON.parse(resp.body)
|
|
14
14
|
|
|
15
15
|
if resp.status >= 300
|
|
16
|
-
raise
|
|
16
|
+
raise ShotgridCallError.new(
|
|
17
|
+
response: resp,
|
|
18
|
+
message:
|
|
19
|
+
"Error while getting server infos: #{resp_body['errors']}",
|
|
20
|
+
)
|
|
17
21
|
end
|
|
18
22
|
|
|
19
23
|
data = resp_body['data']
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'forwardable'
|
|
2
|
+
|
|
3
|
+
module ShotgridApiRuby
|
|
4
|
+
class ShotgridCallError < StandardError
|
|
5
|
+
extend Forwardable
|
|
6
|
+
|
|
7
|
+
def initialize(response:, message:)
|
|
8
|
+
@response = response
|
|
9
|
+
super(message)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
attr_reader :response
|
|
13
|
+
def_delegators :response, :status
|
|
14
|
+
end
|
|
15
|
+
end
|
data/package.json
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
"repository": "git@github.com:shotgunsoftware/shotgrid_api_ruby.git",
|
|
6
6
|
"author": "Denis <Zaratan> Pasin <zaratan@hey.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"lint": "prettier -w '**/*.rb'"
|
|
10
|
+
},
|
|
8
11
|
"devDependencies": {
|
|
9
12
|
"@prettier/plugin-ruby": "^1.3.0",
|
|
10
13
|
"prettier": "^2.2.1"
|
data/shotgrid_api_ruby.gemspec
CHANGED
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
|
15
15
|
"Gem to facilitate the interaction with Shotgrid's REST API."
|
|
16
16
|
spec.homepage = 'https://github.com/shotgunsoftware/shotgrid_api_ruby'
|
|
17
17
|
spec.license = 'MIT'
|
|
18
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
|
18
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
|
|
19
19
|
|
|
20
20
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
21
21
|
spec.metadata['source_code_uri'] =
|
data/yarn.lock
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
"@prettier/plugin-ruby@^1.3.0":
|
|
6
|
-
version "1.
|
|
7
|
-
resolved "https://registry.yarnpkg.com/@prettier/plugin-ruby/-/plugin-ruby-1.
|
|
8
|
-
integrity sha512-
|
|
6
|
+
version "1.6.1"
|
|
7
|
+
resolved "https://registry.yarnpkg.com/@prettier/plugin-ruby/-/plugin-ruby-1.6.1.tgz#14489985513a72e052b57c1cf9beae288880faa8"
|
|
8
|
+
integrity sha512-PGDCATgVTQz0s/NB9nStiXVCIr+hG/XnKeAO/kguaHrNf8VwCpP5Ul+/KQao0z0QFBy2PDY8kWptfDQCa7WMXg==
|
|
9
9
|
dependencies:
|
|
10
10
|
prettier ">=1.10"
|
|
11
11
|
|
|
12
12
|
prettier@>=1.10, prettier@^2.2.1:
|
|
13
|
-
version "2.3.
|
|
14
|
-
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.
|
|
15
|
-
integrity sha512-
|
|
13
|
+
version "2.3.2"
|
|
14
|
+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
|
|
15
|
+
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shotgrid_api_ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Denis <Zaratan> Pasin
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-08-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -325,6 +325,8 @@ executables: []
|
|
|
325
325
|
extensions: []
|
|
326
326
|
extra_rdoc_files: []
|
|
327
327
|
files:
|
|
328
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
|
329
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
|
328
330
|
- ".github/workflows/test_and_publish.yml"
|
|
329
331
|
- ".github/workflows/test_only.yml"
|
|
330
332
|
- ".github/workflows/verify_version_change.yml"
|
|
@@ -338,6 +340,7 @@ files:
|
|
|
338
340
|
- ".ruby-version"
|
|
339
341
|
- ".travis.yml"
|
|
340
342
|
- CHANGELOG.md
|
|
343
|
+
- CODE_OF_CONDUCT.md
|
|
341
344
|
- Gemfile
|
|
342
345
|
- Guardfile
|
|
343
346
|
- LICENSE.txt
|
|
@@ -357,6 +360,7 @@ files:
|
|
|
357
360
|
- lib/shotgrid_api_ruby/entity.rb
|
|
358
361
|
- lib/shotgrid_api_ruby/preferences.rb
|
|
359
362
|
- lib/shotgrid_api_ruby/server_info.rb
|
|
363
|
+
- lib/shotgrid_api_ruby/shotgrid_call_error.rb
|
|
360
364
|
- lib/shotgrid_api_ruby/version.rb
|
|
361
365
|
- package.json
|
|
362
366
|
- shotgrid_api_ruby.gemspec
|
|
@@ -376,14 +380,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
376
380
|
requirements:
|
|
377
381
|
- - ">="
|
|
378
382
|
- !ruby/object:Gem::Version
|
|
379
|
-
version: 2.
|
|
383
|
+
version: 2.6.0
|
|
380
384
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
381
385
|
requirements:
|
|
382
386
|
- - ">="
|
|
383
387
|
- !ruby/object:Gem::Version
|
|
384
388
|
version: '0'
|
|
385
389
|
requirements: []
|
|
386
|
-
rubygems_version: 3.2.
|
|
390
|
+
rubygems_version: 3.2.22
|
|
387
391
|
signing_key:
|
|
388
392
|
specification_version: 4
|
|
389
393
|
summary: Gem to interact easily with Shotgrid REST api.
|