yandex_tracker 0.1.0

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.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +22 -0
  4. data/CHANGELOG.md +3 -0
  5. data/Gemfile +17 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +122 -0
  8. data/Rakefile +12 -0
  9. data/lib/yandex_tracker/auth.rb +76 -0
  10. data/lib/yandex_tracker/client.rb +89 -0
  11. data/lib/yandex_tracker/collections/attachments.rb +43 -0
  12. data/lib/yandex_tracker/collections/base.rb +30 -0
  13. data/lib/yandex_tracker/collections/categories.rb +34 -0
  14. data/lib/yandex_tracker/collections/comments.rb +44 -0
  15. data/lib/yandex_tracker/collections/fields.rb +38 -0
  16. data/lib/yandex_tracker/collections/issues.rb +49 -0
  17. data/lib/yandex_tracker/collections/local_fields.rb +39 -0
  18. data/lib/yandex_tracker/collections/queues.rb +34 -0
  19. data/lib/yandex_tracker/collections/resolutions.rb +29 -0
  20. data/lib/yandex_tracker/collections/users.rb +34 -0
  21. data/lib/yandex_tracker/collections/workflows.rb +29 -0
  22. data/lib/yandex_tracker/configuration.rb +66 -0
  23. data/lib/yandex_tracker/errors.rb +30 -0
  24. data/lib/yandex_tracker/objects/attachment.rb +24 -0
  25. data/lib/yandex_tracker/objects/base.rb +81 -0
  26. data/lib/yandex_tracker/objects/category.rb +16 -0
  27. data/lib/yandex_tracker/objects/comment.rb +27 -0
  28. data/lib/yandex_tracker/objects/field.rb +16 -0
  29. data/lib/yandex_tracker/objects/issue.rb +37 -0
  30. data/lib/yandex_tracker/objects/local_field.rb +16 -0
  31. data/lib/yandex_tracker/objects/queue.rb +29 -0
  32. data/lib/yandex_tracker/objects/resolution.rb +16 -0
  33. data/lib/yandex_tracker/objects/user.rb +16 -0
  34. data/lib/yandex_tracker/objects/workflow.rb +16 -0
  35. data/lib/yandex_tracker/resources/attachment.rb +54 -0
  36. data/lib/yandex_tracker/resources/base.rb +72 -0
  37. data/lib/yandex_tracker/resources/category.rb +22 -0
  38. data/lib/yandex_tracker/resources/comment.rb +22 -0
  39. data/lib/yandex_tracker/resources/field.rb +22 -0
  40. data/lib/yandex_tracker/resources/issue.rb +42 -0
  41. data/lib/yandex_tracker/resources/local_field.rb +22 -0
  42. data/lib/yandex_tracker/resources/queue.rb +22 -0
  43. data/lib/yandex_tracker/resources/resolution.rb +18 -0
  44. data/lib/yandex_tracker/resources/user.rb +22 -0
  45. data/lib/yandex_tracker/resources/workflow.rb +18 -0
  46. data/lib/yandex_tracker/version.rb +5 -0
  47. data/lib/yandex_tracker.rb +63 -0
  48. data/sig/yandex_tracker.rbs +4 -0
  49. data/yandex_tracker.gemspec +40 -0
  50. metadata +150 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4eb7de823552b7b73610f844930961a8acffc1fc96fca5a06d9474f0e1f61b86
4
+ data.tar.gz: cd15a1d640e61c9d85b8bfb9409f9147d1cfbea17a9dfdc3501dbd7e273b96bd
5
+ SHA512:
6
+ metadata.gz: 8d2df010caa85f960c4f7693aece42a44a28204ef245f9cdbbebd4a7a34fcc95f14237c166a24e669f71c61229f0f02e61c03310741feb224481bd77ac391bc1
7
+ data.tar.gz: de1e4b108220cc4a37fb40bf45b877881e60995cea0ef3336af2d45ad79b9cc8adc0e7b19ab2e75599b2055efee180a32baa3a815412c2b4b3efccf706de8350
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,22 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
14
+
15
+ Layout/MethodLength:
16
+ Max: 30
17
+
18
+ Metrics/BlockLength:
19
+ AllowedMethods: ['describe', 'context', 'it']
20
+
21
+ Metrics/AbcSize:
22
+ Max: 30
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 - 2024-12-12
2
+
3
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in yandex_tracker.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.21"
13
+
14
+ group :test do
15
+ gem "pry"
16
+ gem "webmock"
17
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 kirqe
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.
data/README.md ADDED
@@ -0,0 +1,122 @@
1
+ # YandexTracker
2
+
3
+ Ruby API client for [YandexTracker](https://yandex.cloud/en-ru/docs/tracker/about-api) with partially implemented resources for essential needs
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ $ bundle add yandex_tracker
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ $ gem install yandex_tracker
14
+
15
+ ## Configure
16
+
17
+ ```ruby
18
+ YandexTracker.configure do |config|
19
+ config.client_id = "abc"
20
+ config.client_secret = "def"
21
+ config.org_id = "123" # or cloud_org_id
22
+ end
23
+
24
+ YandexTracker::Auth.exchange_code(code)
25
+
26
+ # or
27
+
28
+ YandexTracker.configure do |config|
29
+ config.access_token = "xyz"
30
+ config.org_id = "123" # or cloud_org_id
31
+ end
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ```ruby
37
+ client = YandexTracker::Client.new
38
+
39
+ client.users.myself
40
+
41
+ client.workflows.list
42
+ client.resolutions.list
43
+
44
+ myqueue = client.queues.create(
45
+ key: "MYQUEUE",
46
+ name: "MYQUEUE",
47
+ lead: "me", # should have correct name
48
+ defaultType: "task",
49
+ defaultPriority: "normal",
50
+ issueTypesConfig: {
51
+ issueType: "task",
52
+ workflow: "developmentPresetWorkflow",
53
+ resolutions: ["wontFix"]
54
+ }
55
+ ) #<YandexTracker::Objects::Queue>
56
+
57
+ myqueue.issues #<YandexTracker::Collections::Issues>
58
+
59
+ issue = myqueue.issues.create(summary: "zxc")
60
+ comment = issue.comments.create(text: "ok")
61
+
62
+ issue.attachments.create(File.open("Screenshot.png"))
63
+
64
+ unattached_file = client.attachments.create(File.open("Screenshot.png"))
65
+ comment.create(text: "More details", attachmentIds: [temp_attachment.id])
66
+
67
+ issue.transitions.list
68
+ issue.transition('wont_fix', comment: 'wae')
69
+ issue.transition('reopen', comment: 'no')
70
+ issue.transition('close', resolution: 'wontFix')
71
+
72
+ client.issues.list
73
+ client.issues(queue: "MYQUEUE").list
74
+ attachments = client.attachments(issue: "MYQUEUE-1").list
75
+ attachments.first.download
76
+
77
+ client.comments(issue: "MYQUEUE-1").create(text: "hello")
78
+
79
+ issue = client.issues.search({
80
+ filter: { queue: "TEST", status: "open"}},
81
+ expand: "attachments"
82
+ ).first
83
+
84
+ issue.createdBy
85
+ issue.createdBy.expand
86
+
87
+ issue.attachments
88
+ issue.data
89
+
90
+ client.issues.import({
91
+ queue: "TEST",
92
+ summary: "Test",
93
+ createdAt: "2017-08-29T12:34:41.740+0000",
94
+ createdBy: "username",
95
+ ...
96
+ })
97
+
98
+ client.categories.list
99
+ client.categories.create(
100
+ name: { en: "My Category", ru: "Моя Категория" },
101
+ order: 1
102
+ )
103
+
104
+ client.fields.create(
105
+ name: { en: "My Field", ru: "Моe поле" },
106
+ id: "myglobalfield",
107
+ type: "ru.yandex.startrek.core.fields.StringFieldType",
108
+ category: "0000000000000003********"
109
+ )
110
+
111
+ myqueue.local_fields.list
112
+ myqueue.local_fields.create(
113
+ name: { en: "My Field", ru: "Моe поле" },
114
+ id: "myglobalfield",
115
+ category: "0000000000000003********",
116
+ type: "ru.yandex.startrek.core.fields.StringFieldType"
117
+ )
118
+ ```
119
+
120
+ ## License
121
+
122
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "base64"
4
+ require "faraday"
5
+
6
+ module YandexTracker
7
+ #
8
+ # Handles OAuth authentication flow and token management
9
+ #
10
+ class Auth
11
+ AUTH_URL = "https://oauth.yandex.ru/token"
12
+
13
+ class << self
14
+ def exchange_code(code)
15
+ raise ArgumentError, "code is required" if code.nil? || code.empty?
16
+
17
+ response = make_request(grant_type: "authorization_code", code: code)
18
+ update_configuration(response)
19
+ response
20
+ end
21
+
22
+ def refresh_token
23
+ validate_oauth_config!
24
+ refresh_token = YandexTracker.configuration.refresh_token
25
+ raise ArgumentError, "refresh_token is required" if refresh_token.nil? || refresh_token.empty?
26
+
27
+ response = make_request(grant_type: "refresh_token", refresh_token: refresh_token)
28
+ update_configuration(response)
29
+ response
30
+ end
31
+
32
+ private
33
+
34
+ def validate_oauth_config!
35
+ config = YandexTracker.configuration
36
+
37
+ raise Errors::AuthError, "client_id is required" if config.client_id.nil? || config.client_id.empty?
38
+ raise Errors::AuthError, "client_secret is required" if config.client_secret.nil? || config.client_secret.empty?
39
+ end
40
+
41
+ def make_request(params)
42
+ response = connection.post("", params)
43
+ handle_response(response)
44
+ rescue Faraday::Error => e
45
+ raise Errors::AuthError, "Authentication failed: #{e.message}"
46
+ end
47
+
48
+ def connection
49
+ Faraday.new(url: AUTH_URL) do |f|
50
+ f.request :url_encoded
51
+ f.response :json
52
+ f.headers["Authorization"] = "Basic #{basic_auth}"
53
+ end
54
+ end
55
+
56
+ def basic_auth
57
+ credentials = "#{YandexTracker.configuration.client_id}:#{YandexTracker.configuration.client_secret}"
58
+ Base64.strict_encode64(credentials)
59
+ end
60
+
61
+ def handle_response(response)
62
+ return response.body if response.success?
63
+
64
+ raise Errors::AuthError, Errors.format_message(response.body)
65
+ end
66
+
67
+ def update_configuration(response_body)
68
+ YandexTracker.configuration.update_tokens(
69
+ access_token: response_body["access_token"],
70
+ refresh_token: response_body["refresh_token"],
71
+ expires_in: response_body["expires_in"]
72
+ )
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "faraday/multipart"
5
+ require "faraday/retry"
6
+
7
+ module YandexTracker
8
+ #
9
+ # API client
10
+ #
11
+ class Client
12
+ BASE_URL = "https://api.tracker.yandex.net/v2"
13
+
14
+ attr_reader :conn, :multipart_conn
15
+
16
+ def initialize
17
+ YandexTracker.configuration.validate!
18
+ setup_connections
19
+ end
20
+
21
+ def setup_connections
22
+ @conn = make_client(:json)
23
+ @multipart_conn = make_client(:multipart)
24
+ end
25
+
26
+ def users
27
+ Collections::Users.new(self)
28
+ end
29
+
30
+ def queues
31
+ Collections::Queues.new(self)
32
+ end
33
+
34
+ def issues(queue: nil)
35
+ Collections::Issues.new(self, queue)
36
+ end
37
+
38
+ def comments(issue: nil)
39
+ Collections::Comments.new(self, issue)
40
+ end
41
+
42
+ def attachments(issue: nil)
43
+ Collections::Attachments.new(self, issue)
44
+ end
45
+
46
+ def workflows
47
+ Collections::Workflows.new(self)
48
+ end
49
+
50
+ def resolutions
51
+ Collections::Resolutions.new(self)
52
+ end
53
+
54
+ def fields
55
+ Collections::Fields.new(self)
56
+ end
57
+
58
+ def categories
59
+ Collections::Categories.new(self)
60
+ end
61
+
62
+ private
63
+
64
+ def make_client(request)
65
+ Faraday.new(url: BASE_URL) do |f|
66
+ f.request request
67
+ f.response :json
68
+ f.request :retry, { max: 3, retry_statuses: [401, 409, 500, 502, 503, 504] }
69
+ f.adapter Faraday.default_adapter
70
+ f.headers.merge!(YandexTracker.configuration.additional_headers)
71
+ f.request :authorization, "Bearer", -> { ensure_fresh_token }
72
+ end
73
+ end
74
+
75
+ def ensure_fresh_token
76
+ configuration = YandexTracker.configuration
77
+
78
+ if configuration.can_refresh? && configuration.token_expired?
79
+ if configuration.can_perform_oauth?
80
+ YandexTracker::Auth.refresh_token
81
+ else
82
+ raise YandexTracker::Errors::AuthError,
83
+ "Token expired and unable to refresh (missing refresh_token or OAuth credentials)"
84
+ end
85
+ end
86
+ configuration.access_token
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YandexTracker
4
+ module Collections
5
+ #
6
+ # Collections::Attachments
7
+ #
8
+ class Attachments < Base
9
+ def initialize(client, issue_id = nil, comment_id = nil)
10
+ super(client)
11
+ @resource = Resources::Attachment.new(client)
12
+ @issue_id = issue_id
13
+ @comment_id = comment_id
14
+ end
15
+
16
+ def create(file, **attributes)
17
+ response = if comment_id
18
+ resource.create_for_comment(issue_id, comment_id, file, **attributes)
19
+ elsif issue_id
20
+ resource.create_for_issue(issue_id, file, **attributes)
21
+ else
22
+ resource.create(file, **attributes) # Create unattached file
23
+ end
24
+ build_object(Objects::Attachment, response, { issue_id: issue_id })
25
+ end
26
+
27
+ def find(id)
28
+ response = resource.find(id)
29
+ build_object(Objects::Attachment, response, { issue_id: issue_id })
30
+ end
31
+
32
+ def list(**params)
33
+ params = params.merge(issue: issue_id) if issue_id
34
+ response = resource.list(issue_id, **params)
35
+ build_objects(Objects::Attachment, response, { issue_id: issue_id })
36
+ end
37
+
38
+ private
39
+
40
+ attr_reader :resource, :issue_id, :comment_id
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YandexTracker
4
+ module Collections
5
+ #
6
+ # Collections::Base
7
+ #
8
+ class Base
9
+ attr_reader :client
10
+
11
+ def initialize(client)
12
+ @client = client
13
+ end
14
+
15
+ def inspect
16
+ "#<#{self.class.name}>"
17
+ end
18
+
19
+ private
20
+
21
+ def build_object(klass, data, context = {})
22
+ klass.new(client, data, context)
23
+ end
24
+
25
+ def build_objects(klass, data, context = {})
26
+ data.map { |item| build_object(klass, item, context) }
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YandexTracker
4
+ module Collections
5
+ #
6
+ # Collections::Categories
7
+ #
8
+ class Categories < Base
9
+ def initialize(client)
10
+ super
11
+ @resource = Resources::Category.new(client)
12
+ end
13
+
14
+ def find(id)
15
+ response = resource.find(id)
16
+ build_object(Objects::Category, response)
17
+ end
18
+
19
+ def create(**attributes)
20
+ response = resource.create(**attributes)
21
+ build_object(Objects::Category, response)
22
+ end
23
+
24
+ def list(**params)
25
+ response = resource.list(**params)
26
+ build_objects(Objects::Category, response)
27
+ end
28
+
29
+ private
30
+
31
+ attr_reader :resource
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YandexTracker
4
+ module Collections
5
+ #
6
+ # Collections::Comments
7
+ #
8
+ class Comments < Base
9
+ attr_reader :issue_id
10
+
11
+ def initialize(client, issue_id)
12
+ raise ArgumentError, "issue_id is required" if issue_id.nil?
13
+
14
+ super(client)
15
+ @resource = Resources::Comment.new(client)
16
+ @issue_id = issue_id
17
+ end
18
+
19
+ def find(id)
20
+ response = resource.find(issue_id, id)
21
+ build_object(Objects::Comment, response, { issue_id: issue_id })
22
+ end
23
+
24
+ def create(**attributes)
25
+ response = resource.create(issue_id, **attributes)
26
+ build_object(Objects::Comment, response, { issue_id: issue_id })
27
+ end
28
+
29
+ def list(**params)
30
+ response = resource.list(issue_id, **params)
31
+ build_objects(Objects::Comment, response, { issue_id: issue_id })
32
+ end
33
+
34
+ def update(comment, **attributes)
35
+ response = resource.update(issue_id, comment.id, **attributes)
36
+ build_object(Objects::Comment, response, { issue_id: issue_id })
37
+ end
38
+
39
+ private
40
+
41
+ attr_reader :resource
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YandexTracker
4
+ module Collections
5
+ #
6
+ # Collections::Fields
7
+ #
8
+ class Fields < Base
9
+ def initialize(client)
10
+ super
11
+ @resource = Resources::Field.new(client)
12
+ end
13
+
14
+ def find(id)
15
+ response = resource.find(id)
16
+ build_object(Objects::Field, response)
17
+ end
18
+
19
+ def create(**attributes)
20
+ response = resource.create(**attributes)
21
+ build_object(Objects::Field, response)
22
+ end
23
+
24
+ def list(**params)
25
+ response = resource.list(**params)
26
+ build_objects(Objects::Field, response)
27
+ end
28
+
29
+ def categories
30
+ @categories ||= Categories.new(client)
31
+ end
32
+
33
+ private
34
+
35
+ attr_reader :resource
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YandexTracker
4
+ module Collections
5
+ #
6
+ # Collections::Issues
7
+ #
8
+ class Issues < Base
9
+ attr_reader :queue_id
10
+
11
+ def initialize(client, queue_id = nil)
12
+ super(client)
13
+ @resource = Resources::Issue.new(client)
14
+ @queue_id = queue_id
15
+ end
16
+
17
+ def find(id)
18
+ response = resource.find(id)
19
+ build_object(Objects::Issue, response, { queue_id: queue_id })
20
+ end
21
+
22
+ def create(**attributes)
23
+ attributes = attributes.merge(queue: queue_id) if queue_id
24
+ response = resource.create(**attributes)
25
+ build_object(Objects::Issue, response, { queue_id: queue_id })
26
+ end
27
+
28
+ def list(**params)
29
+ params = params.merge(queue: queue_id) if queue_id
30
+ response = resource.list(**params)
31
+ build_objects(Objects::Issue, response, { queue_id: queue_id })
32
+ end
33
+
34
+ def search(body = {}, **query_params)
35
+ response = resource.search(body, **query_params)
36
+ build_objects(Objects::Issue, response, { queue_id: queue_id })
37
+ end
38
+
39
+ def import(body = {}, **query_params)
40
+ response = resource.import(body, **query_params)
41
+ build_objects(Objects::Issue, response, { queue_id: queue_id })
42
+ end
43
+
44
+ private
45
+
46
+ attr_reader :resource
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YandexTracker
4
+ module Collections
5
+ #
6
+ # Collections::LocalFields
7
+ #
8
+ class LocalFields < Base
9
+ attr_reader :queue_id
10
+
11
+ def initialize(client, queue_id)
12
+ raise ArgumentError, "queue_id is required" if queue_id.nil?
13
+
14
+ super(client)
15
+ @resource = Resources::LocalField.new(client)
16
+ @queue_id = queue_id
17
+ end
18
+
19
+ def find(key)
20
+ response = resource.find(queue_id, key)
21
+ build_object(Objects::LocalField, response)
22
+ end
23
+
24
+ def create(**attributes)
25
+ response = resource.create(queue_id, **attributes)
26
+ build_object(Objects::LocalField, response)
27
+ end
28
+
29
+ def list(**params)
30
+ response = resource.list(queue_id, **params)
31
+ build_objects(Objects::LocalField, response)
32
+ end
33
+
34
+ private
35
+
36
+ attr_reader :resource
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YandexTracker
4
+ module Collections
5
+ #
6
+ # Collections::Queues
7
+ #
8
+ class Queues < Base
9
+ def initialize(client)
10
+ super
11
+ @resource = Resources::Queue.new(client)
12
+ end
13
+
14
+ def find(id)
15
+ response = resource.find(id)
16
+ build_object(Objects::Queue, response)
17
+ end
18
+
19
+ def create(**attributes)
20
+ response = resource.create(**attributes)
21
+ build_object(Objects::Queue, response)
22
+ end
23
+
24
+ def list(**params)
25
+ response = resource.list(**params)
26
+ build_objects(Objects::Queue, response)
27
+ end
28
+
29
+ private
30
+
31
+ attr_reader :resource
32
+ end
33
+ end
34
+ end