sfrest 0.0.26 → 0.0.27
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 +4 -4
- data/lib/sfrest/audit.rb +2 -0
- data/lib/sfrest/backup.rb +2 -0
- data/lib/sfrest/codebase.rb +2 -0
- data/lib/sfrest/collection.rb +3 -1
- data/lib/sfrest/connection.rb +4 -2
- data/lib/sfrest/domains.rb +2 -0
- data/lib/sfrest/error.rb +2 -0
- data/lib/sfrest/group.rb +5 -3
- data/lib/sfrest/info.rb +2 -0
- data/lib/sfrest/pathbuilder.rb +2 -0
- data/lib/sfrest/role.rb +3 -1
- data/lib/sfrest/site.rb +3 -1
- data/lib/sfrest/stage.rb +2 -0
- data/lib/sfrest/task.rb +12 -10
- data/lib/sfrest/theme.rb +2 -0
- data/lib/sfrest/update.rb +3 -1
- data/lib/sfrest/usage.rb +2 -0
- data/lib/sfrest/user.rb +3 -1
- data/lib/sfrest/variable.rb +3 -1
- data/lib/sfrest/version.rb +3 -1
- data/lib/sfrest.rb +2 -0
- 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: 68df6f447ad598b5f0cb7c2069016978fa49447ef19be534060d861b160f1817
|
4
|
+
data.tar.gz: f86a6154bcf5b735445bee40ae085135d153b63b41c74300032704460fa9a63e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 909a76936f3a281bb493e5f3d063a84024f6ee6aba946590fbc66f5fbb02942ee54f4968685521d0c835c261f86024da8b7ab32aea564f48f870ba70e02607d5
|
7
|
+
data.tar.gz: 3e2510b147e4bc76f2a2c81b4af9d1ea664ffb2eeb24c3ff962d78f51fdbda8763fe1a9a119ed6266bafd8b0b262ad77c88dde2f3e5f9dcdf1a9208121608a1c
|
data/lib/sfrest/audit.rb
CHANGED
data/lib/sfrest/backup.rb
CHANGED
data/lib/sfrest/codebase.rb
CHANGED
data/lib/sfrest/collection.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SFRest
|
2
4
|
# Find colletions, return their data.
|
3
5
|
class Collection
|
@@ -61,7 +63,7 @@ module SFRest
|
|
61
63
|
not_done = true
|
62
64
|
count = 0
|
63
65
|
while not_done
|
64
|
-
current_path = '/api/v1/collections?page=' << page.to_s
|
66
|
+
current_path = '/api/v1/collections?page='.dup << page.to_s
|
65
67
|
res = @conn.get(current_path)
|
66
68
|
if res['collections'] == []
|
67
69
|
not_done = false
|
data/lib/sfrest/connection.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SFRest
|
2
4
|
# Generic http methods
|
3
5
|
# accessors for all the sub classes.
|
@@ -179,8 +181,8 @@ module SFRest
|
|
179
181
|
|
180
182
|
REST_METHODS.each do |m|
|
181
183
|
define_method(m) do
|
182
|
-
m.capitalize!
|
183
|
-
sfrest_klass = "SFRest::#{
|
184
|
+
klazz = m.dup.capitalize!
|
185
|
+
sfrest_klass = "SFRest::#{klazz}"
|
184
186
|
Object.const_get(sfrest_klass).new(self)
|
185
187
|
end
|
186
188
|
end
|
data/lib/sfrest/domains.rb
CHANGED
data/lib/sfrest/error.rb
CHANGED
data/lib/sfrest/group.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SFRest
|
2
4
|
# SF Group management
|
3
5
|
class Group
|
@@ -18,7 +20,7 @@ module SFRest
|
|
18
20
|
# Deletes the group with the specified id
|
19
21
|
# @param [Integer] group_id Id of the group to fetch
|
20
22
|
def delete_group(group_id)
|
21
|
-
current_path = '/api/v1/groups/'
|
23
|
+
current_path = '/api/v1/groups/' + group_id.to_s
|
22
24
|
@conn.delete(current_path)
|
23
25
|
end
|
24
26
|
|
@@ -35,7 +37,7 @@ module SFRest
|
|
35
37
|
# @param [Integer] group_id Id of the group to fetch
|
36
38
|
# @return [Hash] group object from the SF Api
|
37
39
|
def get_group(group_id = 0)
|
38
|
-
current_path = '/api/v1/groups/'
|
40
|
+
current_path = '/api/v1/groups/' + group_id.to_s
|
39
41
|
@conn.get(current_path)
|
40
42
|
end
|
41
43
|
|
@@ -116,7 +118,7 @@ module SFRest
|
|
116
118
|
not_done = true
|
117
119
|
count = 0
|
118
120
|
while not_done
|
119
|
-
current_path = '/api/v1/groups?page=' << page.to_s
|
121
|
+
current_path = '/api/v1/groups?page='.dup << page.to_s
|
120
122
|
res = @conn.get(current_path)
|
121
123
|
if res['groups'] == []
|
122
124
|
not_done = false
|
data/lib/sfrest/info.rb
CHANGED
data/lib/sfrest/pathbuilder.rb
CHANGED
data/lib/sfrest/role.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SFRest
|
2
4
|
# create, delete, update, roles
|
3
5
|
class Role
|
@@ -16,7 +18,7 @@ module SFRest
|
|
16
18
|
not_done = true
|
17
19
|
count = 0
|
18
20
|
while not_done
|
19
|
-
current_path = '/api/v1/roles?page=' << page.to_s
|
21
|
+
current_path = '/api/v1/roles?page='.dup << page.to_s
|
20
22
|
res = @conn.get(current_path)
|
21
23
|
if res['roles'] == []
|
22
24
|
not_done = false
|
data/lib/sfrest/site.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SFRest
|
2
4
|
# Find sites, create a site,
|
3
5
|
class Site
|
@@ -64,7 +66,7 @@ module SFRest
|
|
64
66
|
count = 0
|
65
67
|
sites = []
|
66
68
|
while not_done
|
67
|
-
current_path = '/api/v1/sites?page=' << page.to_s
|
69
|
+
current_path = '/api/v1/sites?page='.dup << page.to_s
|
68
70
|
current_path <<= '&show_incomplete=true' if show_incomplete
|
69
71
|
res = @conn.get(current_path)
|
70
72
|
if res['sites'] == []
|
data/lib/sfrest/stage.rb
CHANGED
data/lib/sfrest/task.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SFRest
|
2
4
|
# Deal with tasks, find them, pause them...
|
3
5
|
class Task
|
@@ -23,7 +25,7 @@ module SFRest
|
|
23
25
|
# @param [Integer] status
|
24
26
|
# @return [Boolean]
|
25
27
|
def status_not_started?(status)
|
26
|
-
return true if (status.to_i & STATUS_TO_BE_RUN)
|
28
|
+
return true if (status.to_i & STATUS_TO_BE_RUN).positive?
|
27
29
|
|
28
30
|
false
|
29
31
|
end
|
@@ -42,7 +44,7 @@ module SFRest
|
|
42
44
|
# @param [Integer] status
|
43
45
|
# @return [Boolean]
|
44
46
|
def status_running?(status)
|
45
|
-
return true if (status.to_i & STATUS_RUNNING)
|
47
|
+
return true if (status.to_i & STATUS_RUNNING).positive?
|
46
48
|
|
47
49
|
false
|
48
50
|
end
|
@@ -70,7 +72,7 @@ module SFRest
|
|
70
72
|
# @param [Integer] status
|
71
73
|
# @return [Boolean]
|
72
74
|
def status_done?(status)
|
73
|
-
return true if (status.to_i & STATUS_DONE)
|
75
|
+
return true if (status.to_i & STATUS_DONE).positive?
|
74
76
|
|
75
77
|
false
|
76
78
|
end
|
@@ -207,7 +209,7 @@ module SFRest
|
|
207
209
|
# Get a specific task's logs
|
208
210
|
# @param [Integer] task_id
|
209
211
|
def get_task_logs(task_id)
|
210
|
-
current_path = '/api/v1/tasks/'
|
212
|
+
current_path = '/api/v1/tasks/' + task_id.to_s + '/logs'
|
211
213
|
@conn.get(current_path)
|
212
214
|
end
|
213
215
|
|
@@ -220,8 +222,8 @@ module SFRest
|
|
220
222
|
begin
|
221
223
|
res = @conn.get(current_path)
|
222
224
|
paused = res['wip_pause_global']
|
223
|
-
rescue SFRest::SFError =>
|
224
|
-
paused = false if
|
225
|
+
rescue SFRest::SFError => e
|
226
|
+
paused = false if e.message =~ /Variable not found/
|
225
227
|
end
|
226
228
|
paused
|
227
229
|
end
|
@@ -231,7 +233,7 @@ module SFRest
|
|
231
233
|
# @param [Integer] task_id
|
232
234
|
# @param [String] level family|task
|
233
235
|
def pause_task(task_id, level = 'family')
|
234
|
-
current_path = '/api/v1/pause/'
|
236
|
+
current_path = '/api/v1/pause/' + task_id.to_s
|
235
237
|
payload = { 'paused' => true, 'level' => level }.to_json
|
236
238
|
@conn.post(current_path, payload)
|
237
239
|
end
|
@@ -241,7 +243,7 @@ module SFRest
|
|
241
243
|
# @param [Integer] task_id
|
242
244
|
# @param [String] level family|task
|
243
245
|
def resume_task(task_id, level = 'family')
|
244
|
-
current_path = '/api/v1/pause/'
|
246
|
+
current_path = '/api/v1/pause/' + task_id.to_s
|
245
247
|
payload = { 'paused' => false, 'level' => level }.to_json
|
246
248
|
@conn.post(current_path, payload)
|
247
249
|
end
|
@@ -259,7 +261,7 @@ module SFRest
|
|
259
261
|
# This will delete the task and its children
|
260
262
|
# @param [Integer] task_id
|
261
263
|
def delete_task(task_id)
|
262
|
-
current_path = '/api/v1/tasks/'
|
264
|
+
current_path = '/api/v1/tasks/' + task_id.to_s
|
263
265
|
@conn.delete(current_path)
|
264
266
|
end
|
265
267
|
|
@@ -267,7 +269,7 @@ module SFRest
|
|
267
269
|
# @param [String] type softpaused | softpause-for-update
|
268
270
|
# @return [Array] Array of wip classes
|
269
271
|
def get_task_class_info(type = '')
|
270
|
-
current_path = '/api/v1/classes/'
|
272
|
+
current_path = '/api/v1/classes/' + type
|
271
273
|
@conn.get(current_path)
|
272
274
|
end
|
273
275
|
|
data/lib/sfrest/theme.rb
CHANGED
data/lib/sfrest/update.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SFRest
|
2
4
|
# Drive updates on the Site Factory
|
3
5
|
class Update
|
@@ -24,7 +26,7 @@ module SFRest
|
|
24
26
|
|
25
27
|
# Lists vcs refs.
|
26
28
|
def list_vcs_refs(type = 'sites', stack_id = 1)
|
27
|
-
current_path = '/api/v1/vcs?type='
|
29
|
+
current_path = '/api/v1/vcs?type=' + type + '&stack_id=' + stack_id.to_s
|
28
30
|
@conn.get(current_path)
|
29
31
|
end
|
30
32
|
|
data/lib/sfrest/usage.rb
CHANGED
data/lib/sfrest/user.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SFRest
|
2
4
|
# Do User actions within the Site Factory
|
3
5
|
class User
|
@@ -14,7 +16,7 @@ module SFRest
|
|
14
16
|
not_done = true
|
15
17
|
count = 0
|
16
18
|
while not_done
|
17
|
-
current_path = '/api/v1/users?page='
|
19
|
+
current_path = '/api/v1/users?page=' + page.to_s
|
18
20
|
res = @conn.get(current_path)
|
19
21
|
if res['users'] == []
|
20
22
|
not_done = false
|
data/lib/sfrest/variable.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SFRest
|
2
4
|
# Perform actions against variables in the Factory
|
3
5
|
class Variable
|
@@ -14,7 +16,7 @@ module SFRest
|
|
14
16
|
|
15
17
|
# Gets the value of a specific variable.
|
16
18
|
def get_variable(name)
|
17
|
-
current_path = '/api/v1/variables?name='
|
19
|
+
current_path = '/api/v1/variables?name=' + name
|
18
20
|
@conn.get(current_path)
|
19
21
|
end
|
20
22
|
|
data/lib/sfrest/version.rb
CHANGED
data/lib/sfrest.rb
CHANGED