shotgun_api_ruby 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81e63f04a043edf0f4e28d98959cde8ca3b28d758b899f13f2a6f0888d7e2c79
4
- data.tar.gz: bc6c97071892f5f236d95e1f47d59ccff5e53c2b4cb0c370951f9823d243c9d3
3
+ metadata.gz: b6d880dc29b34107ab40d5a654154bdfdfdc1c952ddebe0064c6c75f19c3be66
4
+ data.tar.gz: 4ee1c00b595e5160abf204ec89eba23e166fa84e67f8b3b7c012e41cb4dcd3d9
5
5
  SHA512:
6
- metadata.gz: 20fe88744936a2fce96771ca1abdb1310536d94547ecb276a6a28b052bb11794338dc49dde98e6a2846f9eba8a86cdbbd677b628ca2b9697d67679858827b1d9
7
- data.tar.gz: 1fc22594f7144215eeed1b5895e3891ba5dab62ce9ccfa8b93181fa7268bf22f92420121bad44822d1fc9d67cc06361182bab0828cd0506f7f205c3933d4b98d
6
+ metadata.gz: 04b8b6b04c605b88ffd1b0368a1155b49473a2f8b2cc8d9e251bb9e5602b18c4ee0d83b91d99c60167064b8146d3afae15860e0db852cc5219b8e7dfee8c71fa
7
+ data.tar.gz: 9fc472cf42c00379eda01f84eecf39407ace44ff1f1f59622793a464e263cc8a611036151f8a030fce772dbebf5318735c2d026718f6fc6ab20ce739adf601e7
@@ -1,5 +1,5 @@
1
1
  # Relaxed.Ruby.Style
2
- ## Version 2.4
2
+ ## Version 2.5
3
3
 
4
4
  Style/Alias:
5
5
  Enabled: false
@@ -145,30 +145,9 @@ Lint/AssignmentInCondition:
145
145
  Enabled: false
146
146
  StyleGuide: https://relaxed.ruby.style/#lintassignmentincondition
147
147
 
148
- Metrics/AbcSize:
148
+ Layout/LineLength:
149
149
  Enabled: false
150
150
 
151
- Metrics/BlockNesting:
152
- Enabled: false
153
-
154
- Metrics/ClassLength:
155
- Enabled: false
156
-
157
- Metrics/ModuleLength:
158
- Enabled: false
159
-
160
- Metrics/CyclomaticComplexity:
161
- Enabled: false
162
-
163
- Metrics/LineLength:
164
- Enabled: false
165
-
166
- Metrics/MethodLength:
167
- Enabled: false
168
-
169
- Metrics/ParameterLists:
170
- Enabled: false
171
-
172
- Metrics/PerceivedComplexity:
151
+ Metrics:
173
152
  Enabled: false
174
153
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shotgun_api_ruby (0.0.3)
4
+ shotgun_api_ruby (0.0.4)
5
5
  activesupport
6
6
  faraday (~> 0.17)
7
7
  zeitwerk (~> 2.2)
@@ -9,12 +9,12 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.0.0)
12
+ activesupport (6.0.2.1)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
14
  i18n (>= 0.7, < 2)
15
15
  minitest (~> 5.1)
16
16
  tzinfo (~> 1.1)
17
- zeitwerk (~> 2.1, >= 2.1.8)
17
+ zeitwerk (~> 2.2)
18
18
  ast (2.4.0)
19
19
  bundler-audit (0.6.1)
20
20
  bundler (>= 1.2.0, < 3)
@@ -23,20 +23,20 @@ GEM
23
23
  coderay (1.1.2)
24
24
  concurrent-ruby (1.1.5)
25
25
  diff-lcs (1.3)
26
- faraday (0.17.0)
26
+ faraday (0.17.3)
27
27
  multipart-post (>= 1.2, < 3)
28
- i18n (1.7.0)
28
+ i18n (1.8.2)
29
29
  concurrent-ruby (~> 1.0)
30
30
  iniparse (1.4.4)
31
- jaro_winkler (1.5.3)
31
+ jaro_winkler (1.5.4)
32
32
  method_source (0.9.2)
33
- minitest (5.12.2)
33
+ minitest (5.14.0)
34
34
  multipart-post (2.1.1)
35
- overcommit (0.51.0)
35
+ overcommit (0.52.1)
36
36
  childprocess (>= 0.6.3, < 4)
37
37
  iniparse (~> 1.4)
38
- parallel (1.18.0)
39
- parser (2.6.5.0)
38
+ parallel (1.19.1)
39
+ parser (2.7.0.2)
40
40
  ast (~> 2.4.0)
41
41
  pry (0.12.2)
42
42
  coderay (~> 1.1.0)
@@ -47,31 +47,31 @@ GEM
47
47
  rspec-core (~> 3.9.0)
48
48
  rspec-expectations (~> 3.9.0)
49
49
  rspec-mocks (~> 3.9.0)
50
- rspec-core (3.9.0)
51
- rspec-support (~> 3.9.0)
50
+ rspec-core (3.9.1)
51
+ rspec-support (~> 3.9.1)
52
52
  rspec-expectations (3.9.0)
53
53
  diff-lcs (>= 1.2.0, < 2.0)
54
54
  rspec-support (~> 3.9.0)
55
- rspec-mocks (3.9.0)
55
+ rspec-mocks (3.9.1)
56
56
  diff-lcs (>= 1.2.0, < 2.0)
57
57
  rspec-support (~> 3.9.0)
58
- rspec-support (3.9.0)
59
- rubocop (0.75.1)
58
+ rspec-support (3.9.2)
59
+ rubocop (0.79.0)
60
60
  jaro_winkler (~> 1.5.1)
61
61
  parallel (~> 1.10)
62
- parser (>= 2.6)
62
+ parser (>= 2.7.0.1)
63
63
  rainbow (>= 2.2.2, < 4.0)
64
64
  ruby-progressbar (~> 1.7)
65
65
  unicode-display_width (>= 1.4.0, < 1.7)
66
- rubocop-performance (1.5.0)
66
+ rubocop-performance (1.5.2)
67
67
  rubocop (>= 0.71.0)
68
68
  ruby-progressbar (1.10.1)
69
69
  thor (0.20.3)
70
70
  thread_safe (0.3.6)
71
- tzinfo (1.2.5)
71
+ tzinfo (1.2.6)
72
72
  thread_safe (~> 0.1)
73
- unicode-display_width (1.6.0)
74
- zeitwerk (2.2.0)
73
+ unicode-display_width (1.6.1)
74
+ zeitwerk (2.2.2)
75
75
 
76
76
  PLATFORMS
77
77
  ruby
data/README.md CHANGED
@@ -150,9 +150,9 @@ assets.first.attributes.code # => "Buck"
150
150
  assets.first.code # => "Buck"
151
151
  ```
152
152
 
153
- #### Get
153
+ ### Search
154
154
 
155
- ##### all
155
+ #### all
156
156
 
157
157
  The all call will return all possible entities.
158
158
 
@@ -160,11 +160,11 @@ The all call will return all possible entities.
160
160
  client.assets.all
161
161
  ```
162
162
 
163
- ##### search
163
+ #### search
164
164
 
165
165
  Does the same thing as `all`
166
166
 
167
- ##### first
167
+ #### first
168
168
 
169
169
  Will return only the first entity found (same thing as setting the page_size to 1)
170
170
 
@@ -172,6 +172,8 @@ Will return only the first entity found (same thing as setting the page_size to
172
172
  client.assets.first
173
173
  ```
174
174
 
175
+ #### arguments
176
+
175
177
  ##### fields
176
178
 
177
179
  This attribute describe the wanted fields in the returned entity
@@ -251,6 +253,22 @@ client.assets.all(fields: [:code], retired: true)
251
253
  client.assets.all(fields: [:code], include_archived_projects: true)
252
254
  ```
253
255
 
256
+ ### Finding one element
257
+
258
+ `find` function on `entities` allow you to get one element in particular.
259
+
260
+ It accepts (all arguments are optional):
261
+
262
+ - fields: string, symbol or array of fields
263
+ - retired: boolean specifying if the record is retired
264
+ - include_archived_projects: boolean specifying if the entity is part of an archived project
265
+
266
+ Example:
267
+
268
+ ```ruby
269
+ client.assets.find(724, fields: [:code, 'description'], retired: false)
270
+ ```
271
+
254
272
  #### Create
255
273
 
256
274
  Not implemented yet
@@ -27,6 +27,29 @@ module ShotgunApiRuby
27
27
  )
28
28
  end
29
29
 
30
+ def find(id, fields: nil, retired: nil, include_archived_projects: nil)
31
+ params = Params.new
32
+
33
+ params.add_fields(fields)
34
+ params.add_options(retired, include_archived_projects)
35
+
36
+ resp = @connection.get(id.to_s, params)
37
+ resp_body = JSON.parse(resp.body)
38
+
39
+ if resp.status >= 300
40
+ raise "Error while getting #{type}: #{resp_body['errors']}"
41
+ end
42
+
43
+ entity = resp_body["data"]
44
+ Entity.new(
45
+ entity['type'],
46
+ OpenStruct.new(entity['attributes']),
47
+ entity['relationships'],
48
+ entity['id'],
49
+ entity['links']
50
+ )
51
+ end
52
+
30
53
  def all(
31
54
  fields: nil,
32
55
  sort: nil,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ShotgunApiRuby
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
@@ -21,9 +21,10 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- end
24
+ spec.files =
25
+ Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
+ end
27
28
  spec.bindir = "exe"
28
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
30
  spec.require_paths = ["lib"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shotgun_api_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis <Zaratan> Pasin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-28 00:00:00.000000000 Z
11
+ date: 2020-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport