brpm_module_brpm 0.1.17 → 0.1.18
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 +8 -8
- data/config.yml +1 -1
- data/lib/brpm_rest_client.rb +88 -0
- data/tests/rest/list_items_spec.rb +24 -4
- data/tests/rest/lists_spec.rb +36 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDdhMjdmZTJjNDZkMjZjMjMwOGM0ZjY0MzIzYWM5YmYyMDdhNzJjYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjJlZDExNmYxYmVlMDE5NzliYzY1YzY5YTM5MjM3OGQzMDAyNDA1ZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2Q3OWU4NWFiN2FjMWFjNjllOGFhNWI4ZTM4YWNkMTU3MGYwYTFkMzI5ZTI2
|
10
|
+
ZDgzMjViY2I2MDg0NzUxMTk5YzQzNzVhZTFjZjYxOTc4MzA3ODkyYmExNTBk
|
11
|
+
NzQ0MmFjZjQ0ODVkOTE5MDM2ZTlmZmM1ZWY3MzQyMDUzNmY1MDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWI2ODk2MjFiNzY1YjBhMDQwNTAwYzJlNDIxYmM1ZDk5YWFkMzM1OGQ0MmM1
|
14
|
+
MTU0ZmRiYzUxOTA1NmUyMWM0MmNkZTZiNmMwMzFhZjJmZTFhZmI3YjFmOTE1
|
15
|
+
MTg5NDk0ZTI4NmZmYWEzNzIyN2JlMTdjZGQ3ZTllNGJiZTMzYTA=
|
data/config.yml
CHANGED
data/lib/brpm_rest_client.rb
CHANGED
@@ -1434,6 +1434,74 @@ class BrpmRestClient
|
|
1434
1434
|
end
|
1435
1435
|
end
|
1436
1436
|
|
1437
|
+
def get_list_by_id(list_id)
|
1438
|
+
result = brpm_get "v1/lists/#{list_id}"
|
1439
|
+
|
1440
|
+
if result["status"] == "success"
|
1441
|
+
result_hash = result["response"]
|
1442
|
+
else
|
1443
|
+
raise "Error searching for list #{list_id}: #{result["error_message"]}"
|
1444
|
+
end
|
1445
|
+
|
1446
|
+
result_hash
|
1447
|
+
end
|
1448
|
+
|
1449
|
+
def get_list_by_name(name)
|
1450
|
+
result = brpm_get "v1/lists?filters[name]=#{name}"
|
1451
|
+
|
1452
|
+
if result["status"] == "success"
|
1453
|
+
result_hash = result["response"].first
|
1454
|
+
else
|
1455
|
+
if result["code"] == 404
|
1456
|
+
result_hash = nil
|
1457
|
+
else
|
1458
|
+
raise "Could not find list item #{name}: #{result["error_message"]}"
|
1459
|
+
end
|
1460
|
+
end
|
1461
|
+
|
1462
|
+
result_hash
|
1463
|
+
end
|
1464
|
+
|
1465
|
+
def create_list_from_hash(list)
|
1466
|
+
result = brpm_post "v1/lists", { :list => list }
|
1467
|
+
|
1468
|
+
unless result["status"] == "success"
|
1469
|
+
raise "Could not create the list: #{result["error_message"]}"
|
1470
|
+
end
|
1471
|
+
|
1472
|
+
result["response"]
|
1473
|
+
end
|
1474
|
+
|
1475
|
+
def update_list_from_hash(list)
|
1476
|
+
result = brpm_put "v1/lists/#{list["id"]}", { :list => list }
|
1477
|
+
|
1478
|
+
unless result["status"] == "success"
|
1479
|
+
raise "Could not update the list: #{result["error_message"]}"
|
1480
|
+
end
|
1481
|
+
|
1482
|
+
result["response"]
|
1483
|
+
end
|
1484
|
+
|
1485
|
+
def archive_list(list_id)
|
1486
|
+
result = brpm_put "v1/lists/#{list_id}", { :toggle_archive => true }
|
1487
|
+
|
1488
|
+
unless result["status"] == "success"
|
1489
|
+
raise "Could not archive the list: #{result["error_message"]}"
|
1490
|
+
end
|
1491
|
+
|
1492
|
+
result["response"]
|
1493
|
+
end
|
1494
|
+
|
1495
|
+
def delete_list(list_id)
|
1496
|
+
result = brpm_delete "v1/lists/#{list_id}"
|
1497
|
+
|
1498
|
+
unless result["status"] == "success"
|
1499
|
+
raise "Could not delete the list: #{result["error_message"]}"
|
1500
|
+
end
|
1501
|
+
|
1502
|
+
result["response"]
|
1503
|
+
end
|
1504
|
+
|
1437
1505
|
def get_list_item_by_id(list_item_id)
|
1438
1506
|
result = brpm_get "v1/list_items/#{list_item_id}"
|
1439
1507
|
|
@@ -1534,6 +1602,26 @@ class BrpmRestClient
|
|
1534
1602
|
list_item
|
1535
1603
|
end
|
1536
1604
|
|
1605
|
+
def archive_list_item(list_item_id)
|
1606
|
+
result = brpm_put "v1/list_items/#{list_item_id}", { :toggle_archive => true }
|
1607
|
+
|
1608
|
+
unless result["status"] == "success"
|
1609
|
+
raise "Could not archive the list item: #{result["error_message"]}"
|
1610
|
+
end
|
1611
|
+
|
1612
|
+
result["response"]
|
1613
|
+
end
|
1614
|
+
|
1615
|
+
def delete_list_item(list_item_id)
|
1616
|
+
result = brpm_delete "v1/list_items/#{list_item_id}"
|
1617
|
+
|
1618
|
+
unless result["status"] == "success"
|
1619
|
+
raise "Could not delete the list item: #{result["error_message"]}"
|
1620
|
+
end
|
1621
|
+
|
1622
|
+
result["response"]
|
1623
|
+
end
|
1624
|
+
|
1537
1625
|
def get_script_by_name(name)
|
1538
1626
|
result = brpm_get "v1/scripts?filters[name]=#{name}"
|
1539
1627
|
|
@@ -6,24 +6,44 @@ describe 'List items REST API' do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'should create, read, update and delete a list item' do
|
9
|
+
list_items = @brpm_rest_client.get_list_items_by({:value_text => "MyAutomationCategory"})
|
10
|
+
list_items.each do |list_item|
|
11
|
+
@brpm_rest_client.archive_list_item(list_item["id"])
|
12
|
+
@brpm_rest_client.delete_list_item(list_item["id"])
|
13
|
+
end
|
14
|
+
|
15
|
+
list_id = @brpm_rest_client.get_list_by_name("AutomationCategory")["id"]
|
16
|
+
|
9
17
|
list_item = {}
|
10
|
-
list_item["list_id"] =
|
18
|
+
list_item["list_id"] = list_id
|
11
19
|
list_item["value_text"] = "MyAutomationCategory"
|
12
20
|
list_item = @brpm_rest_client.create_list_item_from_hash(list_item)
|
13
21
|
|
14
|
-
expect(list_item["list"]["id"]).to eq(
|
22
|
+
expect(list_item["list"]["id"]).to eq(list_id)
|
23
|
+
expect(list_item["value_text"]).to eq("MyAutomationCategory")
|
24
|
+
|
25
|
+
list_item = @brpm_rest_client.get_list_item_by_id(list_item["id"])
|
26
|
+
|
27
|
+
expect(list_item["list"]["id"]).to eq(list_id)
|
15
28
|
expect(list_item["value_text"]).to eq("MyAutomationCategory")
|
16
29
|
|
17
30
|
list_item = @brpm_rest_client.get_list_item_by_name("MyAutomationCategory")
|
18
31
|
|
19
|
-
expect(list_item["list"]["id"]).to eq(
|
32
|
+
expect(list_item["list"]["id"]).to eq(list_id)
|
20
33
|
expect(list_item["value_text"]).to eq("MyAutomationCategory")
|
21
34
|
|
22
35
|
list_item["value_text"] += " - UPDATED"
|
23
36
|
list_item = @brpm_rest_client.update_list_item_from_hash(list_item)
|
24
37
|
|
25
|
-
expect(list_item["list"]["id"]).to eq(
|
38
|
+
expect(list_item["list"]["id"]).to eq(list_id)
|
26
39
|
expect(list_item["value_text"]).to eq("MyAutomationCategory - UPDATED")
|
40
|
+
|
41
|
+
@brpm_rest_client.archive_list_item(list_item["id"])
|
42
|
+
|
43
|
+
@brpm_rest_client.delete_list_item(list_item["id"])
|
44
|
+
|
45
|
+
list_item = @brpm_rest_client.get_list_item_by_name("MyAutomationCategory")
|
46
|
+
expect(list_item).to be_nil
|
27
47
|
end
|
28
48
|
end
|
29
49
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative "../spec_helper"
|
2
|
+
|
3
|
+
describe 'Lists REST API' do
|
4
|
+
before(:all) do
|
5
|
+
setup_brpm_auto
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should create, read, update and delete a list' do
|
9
|
+
list = {}
|
10
|
+
list["name"] = "MyList"
|
11
|
+
list = @brpm_rest_client.create_list_from_hash(list)
|
12
|
+
|
13
|
+
expect(list["name"]).to eq("MyList")
|
14
|
+
|
15
|
+
list = @brpm_rest_client.get_list_by_id(list["id"])
|
16
|
+
|
17
|
+
expect(list["name"]).to eq("MyList")
|
18
|
+
|
19
|
+
list = @brpm_rest_client.get_list_by_name("MyList")
|
20
|
+
|
21
|
+
expect(list["name"]).to eq("MyList")
|
22
|
+
|
23
|
+
list["name"] += " - UPDATED"
|
24
|
+
list = @brpm_rest_client.update_list_from_hash(list)
|
25
|
+
|
26
|
+
expect(list["name"]).to eq("MyList - UPDATED")
|
27
|
+
|
28
|
+
@brpm_rest_client.archive_list(list["id"])
|
29
|
+
|
30
|
+
@brpm_rest_client.delete_list(list["id"])
|
31
|
+
|
32
|
+
list = @brpm_rest_client.get_list_by_name("MyList")
|
33
|
+
expect(list).to be_nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brpm_module_brpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Niek Bartholomeus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brpm_content
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- tests/create_release_request_spec.rb
|
99
99
|
- tests/create_request_spec.rb
|
100
100
|
- tests/rest/list_items_spec.rb
|
101
|
+
- tests/rest/lists_spec.rb
|
101
102
|
- tests/select_application_version_spec.rb
|
102
103
|
- tests/spec_helper.rb
|
103
104
|
homepage: https://github.com/BMC-RLM/brpm_module_brpm
|