bloomy 0.4.2 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -30
- data/lib/bloomy/client.rb +3 -0
- data/lib/bloomy/operations/goals.rb +4 -4
- data/lib/bloomy/operations/headlines.rb +4 -9
- data/lib/bloomy/operations/issues.rb +4 -4
- data/lib/bloomy/operations/meetings.rb +4 -3
- data/lib/bloomy/operations/scorecard.rb +11 -8
- data/lib/bloomy/operations/todos.rb +4 -5
- data/lib/bloomy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5967a74a2cb5758a74e4877ab46a57eeba59f85a023039c1252d47087007bfd7
|
4
|
+
data.tar.gz: 6ded65188a434b4a3fa47cb9007b5c1e10e97b88266c6442e4e74684b7f7f552
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5eaeb394ba3edbd99e433ab9760f510a9a0e219c5b0de8cf2fe3ef0cac7a03a12fbf3325515e3485629186d600724e7e8001d32070baf400a23b9453fd64476
|
7
|
+
data.tar.gz: 9298429c7361153eb4f58e35604defb752362add6f43bb253413c21abe11e2ae4f6d4997c03df337e2f12dcc8097685333ab68c7f0b12656b8f3594804f773fa
|
data/.rubocop.yml
CHANGED
@@ -1,30 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
Metrics/BlockLength:
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
Metrics/CyclomaticComplexity:
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
Metrics/MethodLength:
|
18
|
-
Enabled: false
|
19
|
-
|
20
|
-
Metrics/PerceivedComplexity:
|
21
|
-
Enabled: false
|
22
|
-
|
23
|
-
Naming/AccessorMethodName:
|
24
|
-
Enabled: false
|
25
|
-
|
26
|
-
Gemspec/DevelopmentDependencies:
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
Style/StringLiterals:
|
30
|
-
EnforcedStyle: double_quotes
|
1
|
+
require:
|
2
|
+
- standard
|
3
|
+
- standard-custom
|
4
|
+
- standard-performance
|
5
|
+
- rubocop-performance
|
6
|
+
|
7
|
+
inherit_gem:
|
8
|
+
standard: config/base.yml
|
9
|
+
standard-custom: config/base.yml
|
10
|
+
standard-performance: config/base.yml
|
data/lib/bloomy/client.rb
CHANGED
@@ -25,6 +25,9 @@ module Bloomy
|
|
25
25
|
def initialize(api_key = nil)
|
26
26
|
@configuration = Configuration.new unless api_key
|
27
27
|
@api_key = api_key || @configuration.api_key
|
28
|
+
|
29
|
+
raise ArgumentError, "No API key provided. Set it in configuration or pass it directly." unless @api_key
|
30
|
+
|
28
31
|
@base_url = "https://app.bloomgrowth.com/api/v1"
|
29
32
|
@conn = Faraday.new(url: @base_url) do |faraday|
|
30
33
|
faraday.response :json
|
@@ -29,7 +29,7 @@ class Goal
|
|
29
29
|
due_date: goal["DueDate"],
|
30
30
|
status: goal["Complete"] ? "Completed" : "Incomplete",
|
31
31
|
meeting_id: goal["Origins"].empty? ? nil : goal["Origins"][0]["Id"],
|
32
|
-
|
32
|
+
meeting_title: goal["Origins"].empty? ? nil : goal["Origins"][0]["Name"]
|
33
33
|
}
|
34
34
|
end
|
35
35
|
|
@@ -52,7 +52,7 @@ class Goal
|
|
52
52
|
goal_id: response["Id"],
|
53
53
|
title: title,
|
54
54
|
meeting_id: meeting_id,
|
55
|
-
|
55
|
+
meeting_title: response["Origins"][0]["Name"],
|
56
56
|
user_id: user_id,
|
57
57
|
user_name: response["Owner"]["Name"],
|
58
58
|
created_at: DateTime.parse(response["CreateTime"])
|
@@ -68,7 +68,7 @@ class Goal
|
|
68
68
|
# #=> { status: 200 }
|
69
69
|
def delete(goal_id)
|
70
70
|
response = @conn.delete("/api/v1/rocks/#{goal_id}")
|
71
|
-
|
71
|
+
response.success?
|
72
72
|
end
|
73
73
|
|
74
74
|
# Updates a goal
|
@@ -83,7 +83,7 @@ class Goal
|
|
83
83
|
def update(goal_id:, title:, accountable_user: user_id)
|
84
84
|
payload = {title: title, accountableUserId: accountable_user}.to_json
|
85
85
|
response = @conn.put("/api/v1/rocks/#{goal_id}", payload)
|
86
|
-
|
86
|
+
response.success?
|
87
87
|
end
|
88
88
|
|
89
89
|
private
|
@@ -56,7 +56,7 @@ class Headline
|
|
56
56
|
notes_url: response.body["DetailsUrl"],
|
57
57
|
meeting_details: {
|
58
58
|
id: response.body["OriginId"],
|
59
|
-
|
59
|
+
title: response.body["Origin"]
|
60
60
|
},
|
61
61
|
owner_details: {
|
62
62
|
id: response.body["Owner"]["Id"],
|
@@ -79,9 +79,7 @@ class Headline
|
|
79
79
|
# client.headline.list
|
80
80
|
# #=> [{ id: 1, title: "Headline Title", meeting_details: { id: 1, name: "Team Meeting" }, ... }, ...]
|
81
81
|
def list(user_id: nil, meeting_id: nil)
|
82
|
-
if user_id && meeting_id
|
83
|
-
raise ArgumentError, "Please provide either `user_id` or `meeting_id`, not both."
|
84
|
-
end
|
82
|
+
raise ArgumentError, "Please provide either `user_id` or `meeting_id`, not both." if user_id && meeting_id
|
85
83
|
|
86
84
|
if meeting_id
|
87
85
|
response = @conn.get("/api/v1/l10/#{meeting_id}/headlines")
|
@@ -98,7 +96,7 @@ class Headline
|
|
98
96
|
title: headline["Name"],
|
99
97
|
meeting_details: {
|
100
98
|
id: headline["OriginId"],
|
101
|
-
|
99
|
+
title: headline["Origin"]
|
102
100
|
},
|
103
101
|
owner_details: {
|
104
102
|
id: headline["Owner"]["Id"],
|
@@ -118,9 +116,6 @@ class Headline
|
|
118
116
|
# @return [Boolean] true if the deletion was successful
|
119
117
|
def delete(meeting_id, headline_id)
|
120
118
|
response = @conn.delete("/api/v1/L10/#{meeting_id}/headlines/#{headline_id}")
|
121
|
-
|
122
|
-
# Raise an issue if response.status != 200
|
123
|
-
raise "Failed to delete headline" unless response.status == 200
|
124
|
-
true
|
119
|
+
response.success?
|
125
120
|
end
|
126
121
|
end
|
@@ -30,7 +30,7 @@ class Issue
|
|
30
30
|
completed_at: response["CloseTime"],
|
31
31
|
meeting_details: {
|
32
32
|
id: response["OriginId"],
|
33
|
-
|
33
|
+
title: response["Origin"]
|
34
34
|
},
|
35
35
|
owner_details: {
|
36
36
|
id: response["Owner"]["Id"],
|
@@ -73,7 +73,7 @@ class Issue
|
|
73
73
|
notes_url: issue["DetailsUrl"],
|
74
74
|
created_at: issue["CreateTime"],
|
75
75
|
meeting_id: issue["OriginId"],
|
76
|
-
|
76
|
+
meeting_title: issue["Origin"]
|
77
77
|
}
|
78
78
|
end
|
79
79
|
end
|
@@ -86,8 +86,8 @@ class Issue
|
|
86
86
|
# issue.complete(123)
|
87
87
|
# #=> true
|
88
88
|
def complete(issue_id)
|
89
|
-
response = @conn.post("issues/#{issue_id}/complete", {complete: true}.to_json)
|
90
|
-
response
|
89
|
+
response = @conn.post("issues/#{issue_id}/complete", {complete: true}.to_json)
|
90
|
+
response.success?
|
91
91
|
end
|
92
92
|
|
93
93
|
# Creates a new issue
|
@@ -100,7 +100,7 @@ class Meeting
|
|
100
100
|
response.map do |measurable|
|
101
101
|
{
|
102
102
|
id: measurable["Id"],
|
103
|
-
|
103
|
+
title: measurable["Name"].strip,
|
104
104
|
target: measurable["Target"],
|
105
105
|
operator: measurable["Direction"],
|
106
106
|
format: measurable["Modifiers"],
|
@@ -132,7 +132,7 @@ class Meeting
|
|
132
132
|
measurables = metrics(meeting_id)
|
133
133
|
{
|
134
134
|
id: meeting[:id],
|
135
|
-
|
135
|
+
title: meeting[:name],
|
136
136
|
attendees: attendees,
|
137
137
|
issues: issues,
|
138
138
|
todos: todos,
|
@@ -166,6 +166,7 @@ class Meeting
|
|
166
166
|
# @example
|
167
167
|
# client.meeting.delete(1)
|
168
168
|
def delete(meeting_id)
|
169
|
-
@conn.delete("L10/#{meeting_id}")
|
169
|
+
response = @conn.delete("L10/#{meeting_id}")
|
170
|
+
response.success?
|
170
171
|
end
|
171
172
|
end
|
@@ -49,10 +49,12 @@ class Scorecard
|
|
49
49
|
#
|
50
50
|
# # Fetch scorecards for a specific meeting
|
51
51
|
# client.scorecard.list(meeting_id: 99)
|
52
|
+
# @note
|
53
|
+
# The `week_offset` parameter is useful when fetching scores for previous or future weeks.
|
54
|
+
# For example, to fetch scores for the previous week, you can set `week_offset` to -1.
|
55
|
+
# To fetch scores for a future week, you can set `week_offset` to a positive value.
|
52
56
|
def list(user_id: nil, meeting_id: nil, show_empty: false, week_offset: nil)
|
53
|
-
if user_id && meeting_id
|
54
|
-
raise ArgumentError, "Please provide either `user_id` or `meeting_id`, not both."
|
55
|
-
end
|
57
|
+
raise ArgumentError, "Please provide either `user_id` or `meeting_id`, not both." if user_id && meeting_id
|
56
58
|
|
57
59
|
if meeting_id
|
58
60
|
response = @conn.get("scorecard/meeting/#{meeting_id}").body
|
@@ -70,14 +72,15 @@ class Scorecard
|
|
70
72
|
target: scorecard["Target"],
|
71
73
|
value: scorecard["Measured"],
|
72
74
|
week: scorecard["Week"],
|
75
|
+
week_id: scorecard["ForWeek"],
|
73
76
|
updated_at: scorecard["DateEntered"]
|
74
77
|
}
|
75
78
|
end
|
76
79
|
|
77
80
|
if week_offset
|
78
81
|
week_data = current_week
|
79
|
-
week_id = week_data[:week_number]
|
80
|
-
scorecards.select! { |scorecard| scorecard[:
|
82
|
+
week_id = week_data[:week_number] + week_offset
|
83
|
+
scorecards.select! { |scorecard| scorecard[:week_id] == week_id }
|
81
84
|
end
|
82
85
|
|
83
86
|
scorecards.select! { |scorecard| scorecard[:value] || show_empty } unless show_empty
|
@@ -95,11 +98,11 @@ class Scorecard
|
|
95
98
|
# #=> true
|
96
99
|
# @note
|
97
100
|
# The `week_offset` parameter is useful when updating scores for previous weeks.
|
98
|
-
# For example, to update the score for the previous week, you can set `week_offset` to 1.
|
99
|
-
# To update a future week's score, you can set `week_offset` to a
|
101
|
+
# For example, to update the score for the previous week, you can set `week_offset` to -1.
|
102
|
+
# To update a future week's score, you can set `week_offset` to a positive value.
|
100
103
|
def score(measurable_id:, score:, week_offset: 0)
|
101
104
|
week_data = current_week
|
102
|
-
week_id = week_data[:week_number]
|
105
|
+
week_id = week_data[:week_number] + week_offset
|
103
106
|
|
104
107
|
response = @conn.put("measurables/#{measurable_id}/week/#{week_id}", {value: score}.to_json)
|
105
108
|
response.success?
|
@@ -33,9 +33,7 @@ class Todo
|
|
33
33
|
# client.todo.list(meeting_id: 99)
|
34
34
|
# # => [{ id: 1, title: "New Todo", due_date: "2024-06-15", ... }]
|
35
35
|
def list(user_id: nil, meeting_id: nil)
|
36
|
-
if user_id && meeting_id
|
37
|
-
raise ArgumentError, "Please provide either `user_id` or `meeting_id`, not both."
|
38
|
-
end
|
36
|
+
raise ArgumentError, "Please provide either `user_id` or `meeting_id`, not both." if user_id && meeting_id
|
39
37
|
|
40
38
|
if meeting_id
|
41
39
|
response = @conn.get("l10/#{meeting_id}/todos").body
|
@@ -76,7 +74,7 @@ class Todo
|
|
76
74
|
{
|
77
75
|
id: response["Id"],
|
78
76
|
title: response["Name"],
|
79
|
-
|
77
|
+
meeting_title: response["Origin"],
|
80
78
|
meeting_id: response["OriginId"],
|
81
79
|
due_date: response["DueDate"],
|
82
80
|
notes_url: response["DetailsUrl"]
|
@@ -92,7 +90,7 @@ class Todo
|
|
92
90
|
# #=> { status: 200 }
|
93
91
|
def complete(todo_id)
|
94
92
|
response = @conn.post("/api/v1/todo/#{todo_id}/complete?status=true")
|
95
|
-
|
93
|
+
response.success?
|
96
94
|
end
|
97
95
|
|
98
96
|
# Updates an existing todo
|
@@ -138,6 +136,7 @@ class Todo
|
|
138
136
|
{
|
139
137
|
id: todo["Id"],
|
140
138
|
meeting_id: todo["OriginId"],
|
139
|
+
meeting_title: todo["Origin"],
|
141
140
|
title: todo["Name"],
|
142
141
|
notes_url: todo["DetailsUrl"],
|
143
142
|
due_date: todo["DueDate"],
|
data/lib/bloomy/version.rb
CHANGED