lex-aha 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 (64) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ci.yml +16 -0
  3. data/.gitignore +12 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +66 -0
  6. data/CHANGELOG.md +12 -0
  7. data/CLAUDE.md +88 -0
  8. data/Dockerfile +6 -0
  9. data/Gemfile +12 -0
  10. data/LICENSE +21 -0
  11. data/README.md +62 -0
  12. data/lex-aha.gemspec +30 -0
  13. data/lib/legion/extensions/aha/base_client.rb +23 -0
  14. data/lib/legion/extensions/aha/core/client.rb +42 -0
  15. data/lib/legion/extensions/aha/core/runners/admin.rb +65 -0
  16. data/lib/legion/extensions/aha/core/runners/attachments.rb +39 -0
  17. data/lib/legion/extensions/aha/core/runners/audits.rb +37 -0
  18. data/lib/legion/extensions/aha/core/runners/comments.rb +66 -0
  19. data/lib/legion/extensions/aha/core/runners/custom_fields.rb +59 -0
  20. data/lib/legion/extensions/aha/core/runners/custom_table_records.rb +42 -0
  21. data/lib/legion/extensions/aha/core/runners/integrations.rb +49 -0
  22. data/lib/legion/extensions/aha/core/runners/me.rb +35 -0
  23. data/lib/legion/extensions/aha/core/runners/record_links.rb +42 -0
  24. data/lib/legion/extensions/aha/core/runners/teams.rb +71 -0
  25. data/lib/legion/extensions/aha/core/runners/todos.rb +59 -0
  26. data/lib/legion/extensions/aha/core/runners/users.rb +49 -0
  27. data/lib/legion/extensions/aha/core/runners/webhooks.rb +25 -0
  28. data/lib/legion/extensions/aha/core/runners/workflows.rb +30 -0
  29. data/lib/legion/extensions/aha/core.rb +26 -0
  30. data/lib/legion/extensions/aha/helpers/client.rb +23 -0
  31. data/lib/legion/extensions/aha/ideas/client.rb +30 -0
  32. data/lib/legion/extensions/aha/ideas/runners/idea_categories.rb +25 -0
  33. data/lib/legion/extensions/aha/ideas/runners/idea_comments.rb +40 -0
  34. data/lib/legion/extensions/aha/ideas/runners/idea_organizations.rb +45 -0
  35. data/lib/legion/extensions/aha/ideas/runners/idea_portals.rb +30 -0
  36. data/lib/legion/extensions/aha/ideas/runners/idea_subscriptions.rb +40 -0
  37. data/lib/legion/extensions/aha/ideas/runners/idea_users.rb +45 -0
  38. data/lib/legion/extensions/aha/ideas/runners/idea_votes.rb +50 -0
  39. data/lib/legion/extensions/aha/ideas/runners/ideas.rb +55 -0
  40. data/lib/legion/extensions/aha/ideas.rb +20 -0
  41. data/lib/legion/extensions/aha/knowledge/client.rb +20 -0
  42. data/lib/legion/extensions/aha/knowledge/runners/knowledge_bases.rb +29 -0
  43. data/lib/legion/extensions/aha/knowledge/runners/notes.rb +44 -0
  44. data/lib/legion/extensions/aha/knowledge/runners/pages.rb +44 -0
  45. data/lib/legion/extensions/aha/knowledge.rb +15 -0
  46. data/lib/legion/extensions/aha/roadmaps/client.rb +42 -0
  47. data/lib/legion/extensions/aha/roadmaps/runners/capacity.rb +54 -0
  48. data/lib/legion/extensions/aha/roadmaps/runners/competitors.rb +44 -0
  49. data/lib/legion/extensions/aha/roadmaps/runners/epics.rb +59 -0
  50. data/lib/legion/extensions/aha/roadmaps/runners/features.rb +59 -0
  51. data/lib/legion/extensions/aha/roadmaps/runners/goals.rb +54 -0
  52. data/lib/legion/extensions/aha/roadmaps/runners/initiatives.rb +54 -0
  53. data/lib/legion/extensions/aha/roadmaps/runners/key_results.rb +44 -0
  54. data/lib/legion/extensions/aha/roadmaps/runners/personas.rb +44 -0
  55. data/lib/legion/extensions/aha/roadmaps/runners/products.rb +34 -0
  56. data/lib/legion/extensions/aha/roadmaps/runners/release_phases.rb +49 -0
  57. data/lib/legion/extensions/aha/roadmaps/runners/releases.rb +49 -0
  58. data/lib/legion/extensions/aha/roadmaps/runners/requirements.rb +44 -0
  59. data/lib/legion/extensions/aha/roadmaps/runners/roll_up_releases.rb +39 -0
  60. data/lib/legion/extensions/aha/roadmaps/runners/strategy.rb +49 -0
  61. data/lib/legion/extensions/aha/roadmaps.rb +26 -0
  62. data/lib/legion/extensions/aha/version.rb +9 -0
  63. data/lib/legion/extensions/aha.rb +17 -0
  64. metadata +122 -0
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Core
9
+ module Runners
10
+ module CustomFields
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def list_custom_fields(**)
14
+ response = client(**).get('/custom_field_definitions')
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ def list_custom_field_options(custom_field_definition_id:, **)
19
+ response = client(**).get("/custom_field_definitions/#{custom_field_definition_id}/custom_field_options")
20
+ { result: response.body, status: response.status }
21
+ end
22
+
23
+ def create_custom_field_option(custom_field_definition_id:, custom_field_option:, **)
24
+ response = client(**).post("/custom_field_definitions/#{custom_field_definition_id}/custom_field_options") do |req|
25
+ req.body = { custom_field_option: custom_field_option }
26
+ end
27
+ { result: response.body, status: response.status }
28
+ end
29
+
30
+ def update_custom_field_option(custom_field_definition_id:, id:, custom_field_option:, **)
31
+ response = client(**).put("/custom_field_definitions/#{custom_field_definition_id}/custom_field_options/#{id}") do |req|
32
+ req.body = { custom_field_option: custom_field_option }
33
+ end
34
+ { result: response.body, status: response.status }
35
+ end
36
+
37
+ def delete_custom_field_option(custom_field_definition_id:, id:, **)
38
+ response = client(**).delete("/custom_field_definitions/#{custom_field_definition_id}/custom_field_options/#{id}")
39
+ { result: response.body, status: response.status }
40
+ end
41
+
42
+ def list_custom_layouts(**)
43
+ response = client(**).get('/screen_definitions')
44
+ { result: response.body, status: response.status }
45
+ end
46
+
47
+ def get_custom_layout(id:, **)
48
+ response = client(**).get("/screen_definitions/#{id}")
49
+ { result: response.body, status: response.status }
50
+ end
51
+
52
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
53
+ Legion::Extensions::Helpers.const_defined?(:Lex)
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Core
9
+ module Runners
10
+ module CustomTableRecords
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def list_custom_table_records(product_id:, key:, **)
14
+ response = client(**).get("/products/#{product_id}/custom_objects/#{key}/records")
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ def create_custom_table_record(product_id:, key:, custom_object_record:, **)
19
+ response = client(**).post("/products/#{product_id}/custom_objects/#{key}/records") do |req|
20
+ req.body = { custom_object_record: custom_object_record }
21
+ end
22
+ { result: response.body, status: response.status }
23
+ end
24
+
25
+ def get_custom_table_record(id:, **)
26
+ response = client(**).get("/custom_object_records/#{id}")
27
+ { result: response.body, status: response.status }
28
+ end
29
+
30
+ def delete_custom_table_record(id:, **)
31
+ response = client(**).delete("/custom_object_records/#{id}")
32
+ { result: response.body, status: response.status }
33
+ end
34
+
35
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
36
+ Legion::Extensions::Helpers.const_defined?(:Lex)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Core
9
+ module Runners
10
+ module Integrations
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def list_integrations(**)
14
+ response = client(**).get('/integrations')
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ def list_integrations_in_product(product_id:, **)
19
+ response = client(**).get("/products/#{product_id}/integrations")
20
+ { result: response.body, status: response.status }
21
+ end
22
+
23
+ def get_integration(product_id:, integration_id:, **)
24
+ response = client(**).get("/products/#{product_id}/integrations/#{integration_id}")
25
+ { result: response.body, status: response.status }
26
+ end
27
+
28
+ def create_integration(integration:, **)
29
+ response = client(**).post('/integrations') do |req|
30
+ req.body = { integration: integration }
31
+ end
32
+ { result: response.body, status: response.status }
33
+ end
34
+
35
+ def enable_integration(product_id:, integration_id:, integration:, **)
36
+ response = client(**).put("/products/#{product_id}/integrations/#{integration_id}") do |req|
37
+ req.body = { integration: integration }
38
+ end
39
+ { result: response.body, status: response.status }
40
+ end
41
+
42
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
43
+ Legion::Extensions::Helpers.const_defined?(:Lex)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Core
9
+ module Runners
10
+ module Me
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def get_profile(**)
14
+ response = client(**).get('/me')
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ def list_assigned(**)
19
+ response = client(**).get('/me/assigned')
20
+ { result: response.body, status: response.status }
21
+ end
22
+
23
+ def list_tasks(**)
24
+ response = client(**).get('/me/tasks')
25
+ { result: response.body, status: response.status }
26
+ end
27
+
28
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
29
+ Legion::Extensions::Helpers.const_defined?(:Lex)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Core
9
+ module Runners
10
+ module RecordLinks
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def list_record_links(feature_id:, **)
14
+ response = client(**).get("/features/#{feature_id}/record_links")
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ def get_record_link(id:, **)
19
+ response = client(**).get("/record_links/#{id}")
20
+ { result: response.body, status: response.status }
21
+ end
22
+
23
+ def create_record_link(record_type:, id:, record_link:, **)
24
+ response = client(**).post("/#{record_type}/#{id}/record_links") do |req|
25
+ req.body = { record_link: record_link }
26
+ end
27
+ { result: response.body, status: response.status }
28
+ end
29
+
30
+ def delete_record_link(id:, **)
31
+ response = client(**).delete("/record_links/#{id}")
32
+ { result: response.body, status: response.status }
33
+ end
34
+
35
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
36
+ Legion::Extensions::Helpers.const_defined?(:Lex)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Core
9
+ module Runners
10
+ module Teams
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def list_teams(**)
14
+ response = client(**).get('/teams')
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ def list_teams_in_product(product_id:, **)
19
+ response = client(**).get("/products/#{product_id}/teams")
20
+ { result: response.body, status: response.status }
21
+ end
22
+
23
+ def get_team(id:, **)
24
+ response = client(**).get("/teams/#{id}")
25
+ { result: response.body, status: response.status }
26
+ end
27
+
28
+ def create_team(team:, **)
29
+ response = client(**).post('/teams') do |req|
30
+ req.body = { team: team }
31
+ end
32
+ { result: response.body, status: response.status }
33
+ end
34
+
35
+ def update_team(id:, team:, **)
36
+ response = client(**).put("/teams/#{id}") do |req|
37
+ req.body = { team: team }
38
+ end
39
+ { result: response.body, status: response.status }
40
+ end
41
+
42
+ def delete_team(id:, **)
43
+ response = client(**).delete("/teams/#{id}")
44
+ { result: response.body, status: response.status }
45
+ end
46
+
47
+ def list_team_memberships(team_id:, **)
48
+ response = client(**).get("/teams/#{team_id}/team_memberships")
49
+ { result: response.body, status: response.status }
50
+ end
51
+
52
+ def add_team_member(team_id:, team_membership:, **)
53
+ response = client(**).post("/teams/#{team_id}/team_memberships") do |req|
54
+ req.body = { team_membership: team_membership }
55
+ end
56
+ { result: response.body, status: response.status }
57
+ end
58
+
59
+ def remove_team_member(team_id:, id:, **)
60
+ response = client(**).delete("/teams/#{team_id}/team_memberships/#{id}")
61
+ { result: response.body, status: response.status }
62
+ end
63
+
64
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
65
+ Legion::Extensions::Helpers.const_defined?(:Lex)
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Core
9
+ module Runners
10
+ module Todos
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def list_todos(**)
14
+ response = client(**).get('/tasks')
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ def list_todos_for_feature(feature_id:, **)
19
+ response = client(**).get("/features/#{feature_id}/tasks")
20
+ { result: response.body, status: response.status }
21
+ end
22
+
23
+ def list_todos_for_user(user_id:, **)
24
+ response = client(**).get("/users/#{user_id}/tasks")
25
+ { result: response.body, status: response.status }
26
+ end
27
+
28
+ def get_todo(id:, **)
29
+ response = client(**).get("/tasks/#{id}")
30
+ { result: response.body, status: response.status }
31
+ end
32
+
33
+ def create_todo(task:, **)
34
+ response = client(**).post('/tasks') do |req|
35
+ req.body = { task: task }
36
+ end
37
+ { result: response.body, status: response.status }
38
+ end
39
+
40
+ def update_todo(id:, task:, **)
41
+ response = client(**).put("/tasks/#{id}") do |req|
42
+ req.body = { task: task }
43
+ end
44
+ { result: response.body, status: response.status }
45
+ end
46
+
47
+ def delete_todo(id:, **)
48
+ response = client(**).delete("/tasks/#{id}")
49
+ { result: response.body, status: response.status }
50
+ end
51
+
52
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
53
+ Legion::Extensions::Helpers.const_defined?(:Lex)
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Core
9
+ module Runners
10
+ module Users
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def list_users(**)
14
+ response = client(**).get('/users')
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ def list_users_in_product(product_id:, **)
19
+ response = client(**).get("/products/#{product_id}/users")
20
+ { result: response.body, status: response.status }
21
+ end
22
+
23
+ def get_user(id:, **)
24
+ response = client(**).get("/users/#{id}")
25
+ { result: response.body, status: response.status }
26
+ end
27
+
28
+ def create_user(product_id:, user:, **)
29
+ response = client(**).post("/products/#{product_id}/users") do |req|
30
+ req.body = { user: user }
31
+ end
32
+ { result: response.body, status: response.status }
33
+ end
34
+
35
+ def update_user(id:, user:, **)
36
+ response = client(**).put("/users/#{id}") do |req|
37
+ req.body = { user: user }
38
+ end
39
+ { result: response.body, status: response.status }
40
+ end
41
+
42
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
43
+ Legion::Extensions::Helpers.const_defined?(:Lex)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Core
9
+ module Runners
10
+ module Webhooks
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def validate_webhook(token:, **)
14
+ response = client(**).get("/webhooks/#{token}")
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
19
+ Legion::Extensions::Helpers.const_defined?(:Lex)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Core
9
+ module Runners
10
+ module Workflows
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def list_workflows(product_id:, **)
14
+ response = client(**).get("/products/#{product_id}/workflows")
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ def get_workflow(id:, **)
19
+ response = client(**).get("/workflows/#{id}")
20
+ { result: response.body, status: response.status }
21
+ end
22
+
23
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
24
+ Legion::Extensions::Helpers.const_defined?(:Lex)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/core/runners/users'
4
+ require 'legion/extensions/aha/core/runners/teams'
5
+ require 'legion/extensions/aha/core/runners/me'
6
+ require 'legion/extensions/aha/core/runners/comments'
7
+ require 'legion/extensions/aha/core/runners/attachments'
8
+ require 'legion/extensions/aha/core/runners/todos'
9
+ require 'legion/extensions/aha/core/runners/record_links'
10
+ require 'legion/extensions/aha/core/runners/custom_fields'
11
+ require 'legion/extensions/aha/core/runners/custom_table_records'
12
+ require 'legion/extensions/aha/core/runners/integrations'
13
+ require 'legion/extensions/aha/core/runners/workflows'
14
+ require 'legion/extensions/aha/core/runners/audits'
15
+ require 'legion/extensions/aha/core/runners/webhooks'
16
+ require 'legion/extensions/aha/core/runners/admin'
17
+ require_relative 'core/client'
18
+
19
+ module Legion
20
+ module Extensions
21
+ module Aha
22
+ module Core
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Helpers
9
+ module Client
10
+ def client(subdomain:, api_key:, **)
11
+ Faraday.new(url: "https://#{subdomain}.aha.io/api/v1") do |conn|
12
+ conn.request :json
13
+ conn.response :json, content_type: /\bjson$/
14
+ conn.headers['Content-Type'] = 'application/json'
15
+ conn.headers['Authorization'] = "Bearer #{api_key}"
16
+ conn.headers['User-Agent'] = 'LegionIO/lex-aha'
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../base_client'
4
+ require_relative 'runners/ideas'
5
+ require_relative 'runners/idea_comments'
6
+ require_relative 'runners/idea_portals'
7
+ require_relative 'runners/idea_organizations'
8
+ require_relative 'runners/idea_users'
9
+ require_relative 'runners/idea_votes'
10
+ require_relative 'runners/idea_subscriptions'
11
+ require_relative 'runners/idea_categories'
12
+
13
+ module Legion
14
+ module Extensions
15
+ module Aha
16
+ module Ideas
17
+ class Client < Legion::Extensions::Aha::BaseClient
18
+ include Runners::Ideas
19
+ include Runners::IdeaComments
20
+ include Runners::IdeaPortals
21
+ include Runners::IdeaOrganizations
22
+ include Runners::IdeaUsers
23
+ include Runners::IdeaVotes
24
+ include Runners::IdeaSubscriptions
25
+ include Runners::IdeaCategories
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Ideas
9
+ module Runners
10
+ module IdeaCategories
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def list_idea_categories(product_id:, **)
14
+ response = client(**).get("/products/#{product_id}/idea_categories")
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
19
+ Legion::Extensions::Helpers.const_defined?(:Lex)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Ideas
9
+ module Runners
10
+ module IdeaComments
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def list_idea_comments(idea_id:, **)
14
+ response = client(**).get("/ideas/#{idea_id}/idea_comments")
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ def create_idea_comment(idea_id:, idea_comment:, **)
19
+ response = client(**).post("/ideas/#{idea_id}/idea_comments", { idea_comment: idea_comment })
20
+ { result: response.body, status: response.status }
21
+ end
22
+
23
+ def update_idea_comment(id:, idea_comment:, **)
24
+ response = client(**).put("/idea_comments/#{id}", { idea_comment: idea_comment })
25
+ { result: response.body, status: response.status }
26
+ end
27
+
28
+ def delete_idea_comment(idea_id:, id:, **)
29
+ response = client(**).delete("/ideas/#{idea_id}/idea_comments/#{id}")
30
+ { result: response.body, status: response.status }
31
+ end
32
+
33
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
34
+ Legion::Extensions::Helpers.const_defined?(:Lex)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/aha/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Aha
8
+ module Ideas
9
+ module Runners
10
+ module IdeaOrganizations
11
+ extend Legion::Extensions::Aha::Helpers::Client
12
+
13
+ def list_idea_organizations(**)
14
+ response = client(**).get('/idea_organizations')
15
+ { result: response.body, status: response.status }
16
+ end
17
+
18
+ def get_idea_organization(id:, **)
19
+ response = client(**).get("/idea_organizations/#{id}")
20
+ { result: response.body, status: response.status }
21
+ end
22
+
23
+ def create_idea_organization(idea_organization:, **)
24
+ response = client(**).post('/idea_organizations', { idea_organization: idea_organization })
25
+ { result: response.body, status: response.status }
26
+ end
27
+
28
+ def update_idea_organization(id:, idea_organization:, **)
29
+ response = client(**).put("/idea_organizations/#{id}", { idea_organization: idea_organization })
30
+ { result: response.body, status: response.status }
31
+ end
32
+
33
+ def delete_idea_organization(id:, **)
34
+ response = client(**).delete("/idea_organizations/#{id}")
35
+ { result: response.body, status: response.status }
36
+ end
37
+
38
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
39
+ Legion::Extensions::Helpers.const_defined?(:Lex)
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end