bloomy 0.10.0 → 0.11.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c37c4101db5cde3d7ccb8d650abeea58416383c131eb35b71a74878aec1c6e69
4
- data.tar.gz: '04397e91d4acaf30dddf615d01464c234c87e940b22d00eb2678da63f82fdcba'
3
+ metadata.gz: 54194503af40ece6bf43213c629ef356ace57155c5a2e8a482b0fe6aee05db3d
4
+ data.tar.gz: 331f8e7ee2c8b8a81430e8189637516f0de6749ebe015c4088bb5891722b645b
5
5
  SHA512:
6
- metadata.gz: c2e00f5ce8c4435083d1809b3663d810a5a2b296be289e873c82a44180cc324eb0b297607b9c6314f925adb9ba7e17aaea5dcfbcca20df07b10b06d5f0f8cef3
7
- data.tar.gz: 47be893750490311029c294edc904468bc147e902dabc6dbb16634c5c76bfe5b005c0cf9386b57cb4012ff412f578979ef3d3fa28c259b663202b27a4b2958eb
6
+ metadata.gz: 6edf8e382af72ec5ad3fe708958437c9e5af9cf84029453002c42a0237bcc327f544642e748da56d0d5fffd50c96722807fd7db6a11393754c8a1bae0986cc44
7
+ data.tar.gz: c2e67dfc490dc5cedf8f3994989ff57c30f0e60161d7a6673e40678b24e091277a4a58d8cedd93f702dfe1e7123031b4d55473a33d7706debeb46e66657034c8
data/CONTRIBUTING.md CHANGED
@@ -16,6 +16,9 @@ If you want to contribute to the project, please follow these steps:
16
16
 
17
17
  ### Development Setup
18
18
 
19
+ > [!IMPORTANT]
20
+ > Make sure you have a Bloom Growth account and that you're using a user that won't disrupt the experience of other users. The tests will create and delete meetings, so make sure you're not using a user that has important meetings scheduled.
21
+
19
22
  1. Fork and clone the repository:
20
23
 
21
24
  ```sh
@@ -28,7 +31,7 @@ git clone https://github.com/your-username/bloomy.git
28
31
  bundle install
29
32
  ```
30
33
 
31
- 3. Set up pre-commit hooks:
34
+ 3. Set up [pre-commit](https://pre-commit.com) hooks:
32
35
 
33
36
  ```sh
34
37
  pre-commit install
@@ -41,10 +44,10 @@ export USERNAME=your_username
41
44
  export PASSWORD=your_password
42
45
  ```
43
46
 
44
- 5. Run the tests:
47
+ 5. Run the tests to make sure everything is green:
45
48
 
46
49
  ```sh
47
- bundle exec rspec
50
+ bundle exec rspec --fail-fast
48
51
  ```
49
52
 
50
53
  ### Making Changes
@@ -63,7 +66,7 @@ As for coding style guidelines make sure you:
63
66
  2. Make sure your PR passes the CI checks.
64
67
  3. Make sure your PR has a clear title and description.
65
68
  4. Update the version according to [Semantic Versioning](https://semver.org/).
66
- 5. Optionally, use [Conventional Commits](https://www.conventionalcommits.org/) for your commit messages.
69
+ 5. Use [Conventional Commits](https://www.conventionalcommits.org/) for your commit messages.
67
70
 
68
71
  Make sure to follow these guidelines to ensure your PR is accepted and merged quickly. Rinse and repeat! 🚀
69
72
 
data/lib/bloomy/client.rb CHANGED
@@ -1,14 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "faraday"
4
- require_relative "operations/users"
5
- require_relative "operations/todos"
6
- require_relative "operations/goals"
7
- require_relative "operations/meetings"
8
- require_relative "operations/scorecard"
9
- require_relative "operations/issues"
10
- require_relative "operations/headlines"
11
- require_relative "utils/plugin_loader"
4
+
5
+ require "bloomy/types/items"
6
+ require "bloomy/operations/users"
7
+ require "bloomy/operations/todos"
8
+ require "bloomy/operations/goals"
9
+ require "bloomy/operations/meetings"
10
+ require "bloomy/operations/scorecard"
11
+ require "bloomy/operations/issues"
12
+ require "bloomy/operations/headlines"
13
+ require "bloomy/utils/plugin_loader"
12
14
 
13
15
  module Bloomy
14
16
  # The Client class is the main entry point for interacting with the Bloomy API.
@@ -2,141 +2,158 @@
2
2
 
3
3
  require "bloomy/utils/get_user_id"
4
4
 
5
- # Class to handle all the operations related to goals
6
- class Goal
7
- include Bloomy::Utilities::UserIdUtility
8
- # Initializes a new Goal instance
9
- #
10
- # @param conn [Object] the connection object to interact with the API
11
- def initialize(conn)
12
- @conn = conn
13
- end
5
+ module Bloomy
6
+ # Class to handle all the operations related to goals (also known as "rocks")
7
+ # @note This class is already initialized via the client and usable as `client.goal.method`
8
+ class Goal
9
+ include Bloomy::Utilities::UserIdUtility
14
10
 
15
- # Lists all goals for a specific user
16
- #
17
- # @param user_id [Integer] the ID of the user (default is the initialized user ID)
18
- # @param archived [Boolean] whether to include archived goals (default: false)
19
- # @return [Array<Hash>] an array of hashes containing goal details or a hash with active and archived goals
20
- # @example
21
- # client.goal.list
22
- # #=> [{ id: 1, title: "Complete project", created_at: "2024-06-10", ... }, ...]
23
- def list(user_id = self.user_id, archived: false)
24
- active_goals = @conn.get("rocks/user/#{user_id}?include_origin=true").body.map do |goal|
25
- {
26
- id: goal["Id"],
27
- title: goal["Name"],
28
- created_at: goal["CreateTime"],
29
- due_date: goal["DueDate"],
30
- status: goal["Complete"] ? "Completed" : "Incomplete",
31
- meeting_id: goal["Origins"].empty? ? nil : goal["Origins"][0]["Id"],
32
- meeting_title: goal["Origins"].empty? ? nil : goal["Origins"][0]["Name"]
33
- }
11
+ # Initializes a new Goal instance
12
+ #
13
+ # @param conn [Object] the connection object to interact with the API
14
+ def initialize(conn)
15
+ @conn = conn
34
16
  end
35
17
 
36
- archived ? {active: active_goals, archived: get_archived_goals(self.user_id)} : active_goals
37
- end
18
+ # Lists all goals for a specific user
19
+ #
20
+ # @param user_id [Integer] the ID of the user (default is the initialized user ID)
21
+ # @param archived [Boolean] whether to include archived goals (default: false)
22
+ # @return [Array<GoalItem>, Hash] Returns either:
23
+ # - An array of GoalItem objects if archived is false
24
+ # - A hash with :active and :archived arrays of GoalItem objects if archived is true
25
+ # @example List active goals
26
+ # client.goal.list
27
+ # #=> [#<GoalItem id: 1, title: "Complete project", ...>]
28
+ #
29
+ # @example List both active and archived goals
30
+ # client.goal.list(archived: true)
31
+ # #=> {
32
+ # active: [#<GoalItem id: 1, ...>],
33
+ # archived: [#<GoalItem id: 2, ...>]
34
+ # }
35
+ def list(user_id = self.user_id, archived: false)
36
+ active_goals = @conn.get("rocks/user/#{user_id}?include_origin=true").body.map do |goal|
37
+ Types::GoalItem.new(
38
+ id: goal["Id"],
39
+ user_id: goal["Owner"]["Id"],
40
+ user_name: goal["Owner"]["Name"],
41
+ title: goal["Name"],
42
+ created_at: goal["CreateTime"],
43
+ due_date: goal["DueDate"],
44
+ status: goal["Complete"] ? "Completed" : "Incomplete",
45
+ meeting_id: goal["Origins"].empty? ? nil : goal["Origins"][0]["Id"],
46
+ meeting_title: goal["Origins"].empty? ? nil : goal["Origins"][0]["Name"]
47
+ )
48
+ end
38
49
 
39
- # Creates a new goal
40
- #
41
- # @param title [String] the title of the new goal
42
- # @param meeting_id [Integer] the ID of the meeting associated with the goal
43
- # @param user_id [Integer] the ID of the user responsible for the goal (default: initialized user ID)
44
- # @return [Hash] a hash containing the new goal's details
45
- # @example
46
- # client.goal.create(title: "New Goal", meeting_id: 1)
47
- # #=> { goal_id: 1, title: "New Goal", meeting_id: 1, ... }
48
- def create(title:, meeting_id:, user_id: self.user_id)
49
- payload = {title: title, accountableUserId: user_id}.to_json
50
- response = @conn.post("L10/#{meeting_id}/rocks", payload).body
51
- {
52
- goal_id: response["Id"],
53
- title: title,
54
- meeting_id: meeting_id,
55
- meeting_title: response["Origins"][0]["Name"],
56
- user_id: user_id,
57
- user_name: response["Owner"]["Name"],
58
- created_at: response["CreateTime"]
59
- }
60
- end
50
+ archived ? {active: active_goals, archived: get_archived_goals(user_id)} : active_goals
51
+ end
61
52
 
62
- # Deletes a goal
63
- #
64
- # @param goal_id [Integer] the ID of the goal to delete
65
- # @return [Hash] a hash containing the status of the delete operation
66
- # @example
67
- # client.goal.delete(1)
68
- # #=> { status: 200 }
69
- def delete(goal_id)
70
- response = @conn.delete("rocks/#{goal_id}")
71
- response.success?
72
- end
53
+ # Creates a new goal
54
+ #
55
+ # @param title [String] the title of the new goal
56
+ # @param meeting_id [Integer] the ID of the meeting associated with the goal
57
+ # @param user_id [Integer] the ID of the user responsible for the goal (default: initialized user ID)
58
+ # @return [GoalItem] the newly created goal
59
+ # @example
60
+ # client.goal.create(title: "New Goal", meeting_id: 1)
61
+ # #=> { goal_id: 1, title: "New Goal", meeting_id: 1, ... }
62
+ def create(title:, meeting_id:, user_id: self.user_id)
63
+ payload = {title: title, accountableUserId: user_id}.to_json
64
+ response = @conn.post("L10/#{meeting_id}/rocks", payload).body
65
+
66
+ Types::GoalItem.new(
67
+ id: response["Id"],
68
+ user_id: user_id,
69
+ user_name: response["Owner"]["Name"],
70
+ title: title,
71
+ meeting_id: meeting_id,
72
+ meeting_title: response["Origins"][0]["Name"],
73
+ status: {complete: 2, on: 1, off: 0}.key(response["Completion"]).to_s,
74
+ created_at: response["CreateTime"]
75
+ )
76
+ end
73
77
 
74
- # Updates a goal
75
- #
76
- # @param goal_id [Integer] the ID of the goal to update
77
- # @param title [String] the new title of the goal
78
- # @param accountable_user [Integer] the ID of the user responsible for the goal (default: initialized user ID)
79
- # @param status [String, nil] the status value ('on', 'off', or 'complete')
80
- # @return [Boolean] true if the update was successful
81
- # @raise [ArgumentError] if an invalid status value is provided
82
- # @example
83
- # client.goal.update(goal_id: 1, title: "Updated Goal", status: 'on')
84
- # #=> true
85
- def update(goal_id:, title:, accountable_user: user_id, status: nil)
86
- if status
87
- valid_status = {on: "OnTrack", off: "AtRisk", complete: "Complete"}
88
- status_key = status.downcase.to_sym
89
- unless valid_status.key?(status_key)
90
- raise ArgumentError, "Invalid status value. Must be 'on', 'off', or 'complete'."
78
+ # Deletes a goal
79
+ #
80
+ # @param goal_id [Integer] the ID of the goal to delete
81
+ # @return [Hash] a hash containing the status of the delete operation
82
+ # @example
83
+ # client.goal.delete(1)
84
+ # #=> { status: 200 }
85
+ def delete(goal_id)
86
+ response = @conn.delete("rocks/#{goal_id}")
87
+ response.success?
88
+ end
89
+
90
+ # Updates a goal
91
+ #
92
+ # @param goal_id [Integer] the ID of the goal to update
93
+ # @param title [String] the new title of the goal
94
+ # @param accountable_user [Integer] the ID of the user responsible for the goal (default: initialized user ID)
95
+ # @param status [String, nil] the status value ('on', 'off', or 'complete')
96
+ # @return [Boolean] true if the update was successful
97
+ # @raise [ArgumentError] if an invalid status value is provided
98
+ # @example
99
+ # client.goal.update(goal_id: 1, title: "Updated Goal", status: 'on')
100
+ # #=> true
101
+ def update(goal_id:, title: nil, accountable_user: user_id, status: nil)
102
+ if status
103
+ valid_status = {on: "OnTrack", off: "AtRisk", complete: "Complete"}
104
+ status_key = status.downcase.to_sym
105
+ unless valid_status.key?(status_key)
106
+ raise ArgumentError, "Invalid status value. Must be 'on', 'off', or 'complete'."
107
+ end
108
+ status = valid_status[status_key]
91
109
  end
92
- status = valid_status[status_key]
110
+ payload = {title: title, accountableUserId: accountable_user, completion: status}.to_json
111
+ response = @conn.put("rocks/#{goal_id}", payload)
112
+ response.success?
93
113
  end
94
- payload = {title: title, accountableUserId: accountable_user, completion: status}.to_json
95
- response = @conn.put("rocks/#{goal_id}", payload)
96
- response.success?
97
- end
98
114
 
99
- # Archives a rock with the specified goal ID.
100
- #
101
- # @param goal_id [Integer] The ID of the goal/rock to archive
102
- # @return [Boolean] Returns true if the archival was successful, false otherwise
103
- # @example
104
- # goals.archive(123) #=> true
105
- def archive(goal_id)
106
- response = @conn.put("rocks/#{goal_id}/archive")
107
- response.success?
108
- end
115
+ # Archives a rock with the specified goal ID.
116
+ #
117
+ # @param goal_id [Integer] The ID of the goal/rock to archive
118
+ # @return [Boolean] Returns true if the archival was successful, false otherwise
119
+ # @example
120
+ # goals.archive(123) #=> true
121
+ def archive(goal_id)
122
+ response = @conn.put("rocks/#{goal_id}/archive")
123
+ response.success?
124
+ end
109
125
 
110
- # Restores a previously archived goal identified by the provided goal ID.
111
- #
112
- # @param [String, Integer] goal_id The unique identifier of the goal to restore
113
- # @return [Boolean] true if the restore operation was successful, false otherwise
114
- # @example Restoring a goal
115
- # goals.restore("123") #=> true
116
- def restore(goal_id)
117
- response = @conn.put("rocks/#{goal_id}/restore")
118
- response.success?
119
- end
126
+ # Restores a previously archived goal identified by the provided goal ID.
127
+ #
128
+ # @param [String, Integer] goal_id The unique identifier of the goal to restore
129
+ # @return [Boolean] true if the restore operation was successful, false otherwise
130
+ # @example Restoring a goal
131
+ # goals.restore("123") #=> true
132
+ def restore(goal_id)
133
+ response = @conn.put("rocks/#{goal_id}/restore")
134
+ response.success?
135
+ end
120
136
 
121
- private
137
+ private
122
138
 
123
- # Retrieves all archived goals for a specific user (private method)
124
- #
125
- # @param user_id [Integer] the ID of the user (default is the initialized user ID)
126
- # @return [Array<Hash>] an array of hashes containing archived goal details
127
- # @example
128
- # goal.send(:get_archived_goals)
129
- # #=> [{ id: 1, title: "Archived Goal", created_at: "2024-06-10", ... }, ...]
130
- def get_archived_goals(user_id = self.user_id)
131
- response = @conn.get("archivedrocks/user/#{user_id}").body
132
- response.map do |goal|
133
- {
134
- id: goal["Id"],
135
- title: goal["Name"],
136
- created_at: goal["CreateTime"],
137
- due_date: goal["DueDate"],
138
- status: goal["Complete"] ? "Complete" : "Incomplete"
139
- }
139
+ # Retrieves all archived goals for a specific user (private method)
140
+ #
141
+ # @param user_id [Integer] the ID of the user (default is the initialized user ID)
142
+ # @return [Array<GoalItem>] an array of GoalItem objects containing archived goal details
143
+ # @example
144
+ # goal.send(:get_archived_goals)
145
+ # #=> [{ id: 1, title: "Archived Goal", created_at: "2024-06-10", ... }, ...]
146
+ def get_archived_goals(user_id = self.user_id)
147
+ response = @conn.get("archivedrocks/user/#{user_id}").body
148
+ response.map do |goal|
149
+ Types::GoalItem.new(
150
+ id: goal["Id"],
151
+ title: goal["Name"],
152
+ created_at: goal["CreateTime"],
153
+ due_date: goal["DueDate"],
154
+ status: goal["Complete"] ? "Complete" : "Incomplete"
155
+ )
156
+ end
140
157
  end
141
158
  end
142
159
  end
@@ -2,120 +2,138 @@
2
2
 
3
3
  require "bloomy/utils/get_user_id"
4
4
 
5
- class Headline
6
- include Bloomy::Utilities::UserIdUtility
7
- # Initializes a new headline instance
8
- #
9
- # @param conn [Object] the connection object to interact with the API
10
- def initialize(conn)
11
- @conn = conn
12
- end
5
+ module Bloomy
6
+ class Headline
7
+ include Bloomy::Utilities::UserIdUtility
8
+ # Initializes a new headline instance
9
+ #
10
+ # @param conn [Object] the connection object to interact with the API
11
+ def initialize(conn)
12
+ @conn = conn
13
+ end
13
14
 
14
- # Creates a new headline
15
- #
16
- # @param meeting_id [Integer] the ID of the meeting
17
- # @param title [String] the title of the headline
18
- # @param owner_id [Integer] the ID of the headline owner
19
- # @param notes [String] additional notes for the headline
20
- # @return [Hash] the created headline details
21
- def create(meeting_id:, title:, owner_id: user_id, notes: nil)
22
- response = @conn.post("/api/v1/L10/#{meeting_id}/headlines",
23
- {title: title, ownerId: owner_id, notes: notes}.to_json)
24
- raise "Failed to create headline" unless response.status == 200
15
+ # Creates a new headline
16
+ #
17
+ # @param meeting_id [Integer] the ID of the meeting
18
+ # @param title [String] the title of the headline
19
+ # @param owner_id [Integer] the ID of the headline owner
20
+ # @param notes [String] additional notes for the headline
21
+ # @return [HeadlineItem] containing id, title, owner_details, and notes_url
22
+ def create(meeting_id:, title:, owner_id: user_id, notes: nil)
23
+ response = @conn.post("/api/v1/L10/#{meeting_id}/headlines",
24
+ {title: title, ownerId: owner_id, notes: notes}.to_json)
25
+ raise "Failed to create headline" unless response.status == 200
25
26
 
26
- {
27
- id: response.body["Id"],
28
- title: response.body["Name"],
29
- owner_id: response.body["OwnerId"],
30
- notes_url: response.body["DetailsUrl"]
31
- }
32
- end
27
+ Types::HeadlineItem.new(
28
+ id: response.body["Id"],
29
+ title: response.body["Name"],
30
+ owner_details: Types::UserItem.new(id: response.body["OwnerId"]),
31
+ notes_url: response.body["DetailsUrl"]
32
+ )
33
+ end
33
34
 
34
- # Updates a headline
35
- #
36
- # @param headline_id [Integer] the ID of the headline to update
37
- # @param title [String] the new title of the headline
38
- # @return [Hash] the updated headline details
39
- def update(headline_id:, title:)
40
- response = @conn.put("/api/v1/headline/#{headline_id}", {title: title}.to_json)
41
- raise "Failed to update headline" unless response.status == 200
42
- true
43
- end
35
+ # Updates a headline
36
+ #
37
+ # @param headline_id [Integer] the ID of the headline to update
38
+ # @param title [String] the new title of the headline
39
+ # @return [Boolean] true if update was successful
40
+ def update(headline_id:, title:)
41
+ response = @conn.put("/api/v1/headline/#{headline_id}", {title: title}.to_json)
42
+ raise "Failed to update headline" unless response.status == 200
43
+ true
44
+ end
44
45
 
45
- # Get headline details
46
- #
47
- # @param headline_id [Integer] the ID of the headline
48
- # @return [Hash] the details of the headline
49
- def details(headline_id)
50
- response = @conn.get("/api/v1/headline/#{headline_id}?Include_Origin=true")
51
- raise "Failed to get headline details" unless response.status == 200
46
+ # Get headline details
47
+ #
48
+ # @param headline_id [Integer] the ID of the headline
49
+ # @return [HeadlineItem] containing id, title, notes_url, meeting_details,
50
+ # owner_details, archived, created_at, and closed_at
51
+ def details(headline_id)
52
+ response = @conn.get("/api/v1/headline/#{headline_id}?Include_Origin=true")
53
+ raise "Failed to get headline details" unless response.status == 200
52
54
 
53
- {
54
- id: response.body["Id"],
55
- title: response.body["Name"],
56
- notes_url: response.body["DetailsUrl"],
57
- meeting_details: {
58
- id: response.body["OriginId"],
59
- title: response.body["Origin"]
60
- },
61
- owner_details: {
62
- id: response.body["Owner"]["Id"],
63
- name: response.body["Owner"]["Name"]
64
- },
65
- archived: response.body["Archived"],
66
- created_at: response.body["CreateTime"],
67
- closed_at: response.body["CloseTime"]
68
- }
69
- end
55
+ Types::HeadlineItem.new(
56
+ id: response.body["Id"],
57
+ title: response.body["Name"],
58
+ notes_url: response.body["DetailsUrl"],
59
+ meeting_details: Types::MeetingItem.new(
60
+ id: response.body["OriginId"],
61
+ title: response.body["Origin"]
62
+ ),
63
+ owner_details: Types::UserItem.new(
64
+ id: response.body["Owner"]["Id"],
65
+ name: response.body["Owner"]["Name"]
66
+ ),
67
+ archived: response.body["Archived"],
68
+ created_at: response.body["CreateTime"],
69
+ closed_at: response.body["CloseTime"]
70
+ )
71
+ end
70
72
 
71
- # Get headlines for a user or a meeting.
72
- #
73
- # @param user_id [Integer, nil] the ID of the user (defaults to initialized user_id)
74
- # @param meeting_id [Integer, nil] the ID of the meeting
75
- # @raise [ArgumentError] if both `user_id` and `meeting_id` are provided
76
- # @return [Array<Hash>] the list of headlines
77
- # @example
78
- # # Fetch headlines for a user
79
- # client.headline.list
80
- # #=> [{ id: 1, title: "Headline Title", meeting_details: { id: 1, name: "Team Meeting" }, ... }, ...]
81
- def list(user_id: nil, meeting_id: nil)
82
- raise ArgumentError, "Please provide either `user_id` or `meeting_id`, not both." if user_id && meeting_id
73
+ # Get headlines for a user or a meeting.
74
+ #
75
+ # @param user_id [Integer, nil] the ID of the user (defaults to initialized user_id)
76
+ # @param meeting_id [Integer, nil] the ID of the meeting
77
+ # @raise [ArgumentError] if both `user_id` and `meeting_id` are provided
78
+ # @return [Array<HeadlineItem>] a list of headlines containing:
79
+ # - id
80
+ # - title
81
+ # - meeting_details
82
+ # - owner_details
83
+ # - archived
84
+ # - created_at
85
+ # - closed_at
86
+ # @example
87
+ # client.headline.list
88
+ # #=> [
89
+ # #<HeadlineItem
90
+ # id: 1,
91
+ # title: "Headline Title",
92
+ # meeting_details: #<MeetingItem id: 1, title: "Team Meeting">,
93
+ # owner_details: #<UserItem id: 1, name: "John Doe">,
94
+ # archived: false,
95
+ # created_at: "2023-01-01",
96
+ # closed_at: nil
97
+ # >
98
+ # ]
99
+ def list(user_id: nil, meeting_id: nil)
100
+ raise ArgumentError, "Please provide either `user_id` or `meeting_id`, not both." if user_id && meeting_id
83
101
 
84
- if meeting_id
85
- response = @conn.get("/api/v1/l10/#{meeting_id}/headlines")
86
- else
87
- user_id ||= self.user_id
88
- response = @conn.get("/api/v1/headline/users/#{user_id}")
89
- end
102
+ if meeting_id
103
+ response = @conn.get("/api/v1/l10/#{meeting_id}/headlines")
104
+ else
105
+ user_id ||= self.user_id
106
+ response = @conn.get("/api/v1/headline/users/#{user_id}")
107
+ end
90
108
 
91
- raise "Failed to list headlines" unless response.success?
109
+ raise "Failed to list headlines" unless response.success?
92
110
 
93
- response.body.map do |headline|
94
- {
95
- id: headline["Id"],
96
- title: headline["Name"],
97
- meeting_details: {
98
- id: headline["OriginId"],
99
- title: headline["Origin"]
100
- },
101
- owner_details: {
102
- id: headline["Owner"]["Id"],
103
- name: headline["Owner"]["Name"]
104
- },
105
- archived: headline["Archived"],
106
- created_at: headline["CreateTime"],
107
- closed_at: headline["CloseTime"]
108
- }
111
+ response.body.map do |headline|
112
+ Types::HeadlineItem.new(
113
+ id: headline["Id"],
114
+ title: headline["Name"],
115
+ meeting_details: Types::MeetingItem.new(
116
+ id: headline["OriginId"],
117
+ title: headline["Origin"]
118
+ ),
119
+ owner_details: Types::UserItem.new(
120
+ id: headline["Owner"]["Id"],
121
+ name: headline["Owner"]["Name"]
122
+ ),
123
+ archived: headline["Archived"],
124
+ created_at: headline["CreateTime"],
125
+ closed_at: headline["CloseTime"]
126
+ )
127
+ end
109
128
  end
110
- end
111
129
 
112
- # Deletes a headline
113
- #
114
- # @param meeting_id [Integer] the ID of the meeting
115
- # @param headline_id [Integer] the ID of the headline to delete
116
- # @return [Boolean] true if the deletion was successful
117
- def delete(headline_id)
118
- response = @conn.delete("/api/v1/headline/#{headline_id}")
119
- response.success?
130
+ # Deletes a headline
131
+ #
132
+ # @param headline_id [Integer] the ID of the headline to delete
133
+ # @return [Boolean] true if the deletion was successful
134
+ def delete(headline_id)
135
+ response = @conn.delete("/api/v1/headline/#{headline_id}")
136
+ response.success?
137
+ end
120
138
  end
121
139
  end