brpm_module_brpm 0.1.18 → 0.1.19

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDdhMjdmZTJjNDZkMjZjMjMwOGM0ZjY0MzIzYWM5YmYyMDdhNzJjYg==
4
+ NGMzNzQ1YjM3Zjg3YTZhNDk2NjAxNDMwYjc3MTc3NmZiNDliYWM3Zg==
5
5
  data.tar.gz: !binary |-
6
- ZjJlZDExNmYxYmVlMDE5NzliYzY1YzY5YTM5MjM3OGQzMDAyNDA1ZQ==
6
+ ZWM1OGM0OGQ0OGY3MmJmMzhlY2E2OTBjZDg5ZThiNGQ1YmZkMGJmZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- N2Q3OWU4NWFiN2FjMWFjNjllOGFhNWI4ZTM4YWNkMTU3MGYwYTFkMzI5ZTI2
10
- ZDgzMjViY2I2MDg0NzUxMTk5YzQzNzVhZTFjZjYxOTc4MzA3ODkyYmExNTBk
11
- NzQ0MmFjZjQ0ODVkOTE5MDM2ZTlmZmM1ZWY3MzQyMDUzNmY1MDI=
9
+ OWFjODliNTFhYzllMTYzZWYxNGMyYzhhNDk2YWIyOWQyMGExMjViNTRmMmQ5
10
+ YTgyY2EyODE2YmFlYjMzZjJhMTcyNmFmMWIwODQ2MDAzZDBmZmZiM2I5Y2Zj
11
+ ODU0OGVlMGY4OTYyYzEyMjRiYWYxZWUzOTdmMWM4ZmFmNDZkMjI=
12
12
  data.tar.gz: !binary |-
13
- YWI2ODk2MjFiNzY1YjBhMDQwNTAwYzJlNDIxYmM1ZDk5YWFkMzM1OGQ0MmM1
14
- MTU0ZmRiYzUxOTA1NmUyMWM0MmNkZTZiNmMwMzFhZjJmZTFhZmI3YjFmOTE1
15
- MTg5NDk0ZTI4NmZmYWEzNzIyN2JlMTdjZGQ3ZTllNGJiZTMzYTA=
13
+ OWNhMjhhYmU0Mjc4ZTFmMGRlMjlhYmM5MzBjMzMxMTIxZTQ1ZmU4ZTE3YjM3
14
+ YzcyYTIwYWNjYWQzMDYwMzc1YTIyNmQyMjk3ZTg2NTE4YWFkNWFlOTk0MzUw
15
+ YWY2MmE5NmVmNWU5NWNmOTYzNTRkNjgxNmJmMWMxMjE1MmFhMWQ=
data/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  dependencies:
2
2
 
3
- version: 0.1.18
3
+ version: 0.1.19
4
4
 
5
5
  author: Niek Bartholomeus
6
6
  email: niek.bartholomeus@gmail.com
@@ -1514,8 +1514,8 @@ class BrpmRestClient
1514
1514
  result_hash
1515
1515
  end
1516
1516
 
1517
- def get_list_item_by_name(name)
1518
- result = brpm_get "v1/list_items?filters[value_text]=#{name}"
1517
+ def get_list_item_by_name(list_name, list_item_name)
1518
+ result = brpm_get "v1/list_items?filters[list_name]=#{list_name}&filters[value_text]=#{list_item_name}"
1519
1519
 
1520
1520
  if result["status"] == "success"
1521
1521
  result_hash = get_list_item_by_id(result["response"].first["id"])
@@ -1572,13 +1572,23 @@ class BrpmRestClient
1572
1572
  result["response"]
1573
1573
  end
1574
1574
 
1575
- def create_or_update_list_item(list_item)
1575
+ def create_or_update_list_item(list_name, list_item_name)
1576
1576
  BrpmAuto.log "Checking if the corresponding list item already exists ..."
1577
- existing_list_item = get_list_item_by_name list_item["name"]
1577
+ existing_list_item = get_list_item_by_name(list_name, list_item_name)
1578
1578
 
1579
+ list_item = {}
1580
+ list_item["value_text"] = list_item_name
1579
1581
  if existing_list_item.nil?
1580
1582
  BrpmAuto.log "List item doesn't exist yet."
1581
1583
  list_item_already_exists=false
1584
+
1585
+ list = get_list_by_name(list_name)
1586
+ if list
1587
+ list_item["list_id"] = list["id"]
1588
+ else
1589
+ raise "A list with the name #{list_name} doesn't exist."
1590
+ end
1591
+
1582
1592
  else
1583
1593
  BrpmAuto.log "List item already exists."
1584
1594
  list_item_already_exists=true
@@ -3,15 +3,15 @@ require_relative "../spec_helper"
3
3
  describe 'List items REST API' do
4
4
  before(:all) do
5
5
  setup_brpm_auto
6
- end
7
6
 
8
- it 'should create, read, update and delete a list item' do
9
7
  list_items = @brpm_rest_client.get_list_items_by({:value_text => "MyAutomationCategory"})
10
8
  list_items.each do |list_item|
11
9
  @brpm_rest_client.archive_list_item(list_item["id"])
12
10
  @brpm_rest_client.delete_list_item(list_item["id"])
13
11
  end
12
+ end
14
13
 
14
+ it 'should create, read, update and delete a list item' do
15
15
  list_id = @brpm_rest_client.get_list_by_name("AutomationCategory")["id"]
16
16
 
17
17
  list_item = {}
@@ -27,7 +27,7 @@ describe 'List items REST API' do
27
27
  expect(list_item["list"]["id"]).to eq(list_id)
28
28
  expect(list_item["value_text"]).to eq("MyAutomationCategory")
29
29
 
30
- list_item = @brpm_rest_client.get_list_item_by_name("MyAutomationCategory")
30
+ list_item = @brpm_rest_client.get_list_item_by_name("AutomationCategory", "MyAutomationCategory")
31
31
 
32
32
  expect(list_item["list"]["id"]).to eq(list_id)
33
33
  expect(list_item["value_text"]).to eq("MyAutomationCategory")
@@ -42,7 +42,7 @@ describe 'List items REST API' do
42
42
 
43
43
  @brpm_rest_client.delete_list_item(list_item["id"])
44
44
 
45
- list_item = @brpm_rest_client.get_list_item_by_name("MyAutomationCategory")
45
+ list_item = @brpm_rest_client.get_list_item_by_name("AutomationCategory", "MyAutomationCategory")
46
46
  expect(list_item).to be_nil
47
47
  end
48
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brpm_module_brpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niek Bartholomeus