iibee 0.1.13 → 0.1.14

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
  SHA1:
3
- metadata.gz: 388dd031885bb2030f07bc384b3384b831e23f36
4
- data.tar.gz: d27a27f3e578b11f83640c8181730e7fb762a9c5
3
+ metadata.gz: 53e0a7b571694003eb4e64a41bbbefbd47059a4d
4
+ data.tar.gz: 03e2b32a90485a20b30932d6b89a1c012069e670
5
5
  SHA512:
6
- metadata.gz: 26bd48eaafbe153a2557d13642f1a24238042608527ab9cc3d22b94fa14ba3a944c74b72fcba89cb238d75465a914ecba2aa9e8addb421789774ec8b75f0557b
7
- data.tar.gz: feba69b58c5f6ca474bbcaf7723bb2cab50f4533bf7f335a832ea58eb55175d9b57f4dcebe885214086b007560b3dc02bab795c0cc15f5901ac09b5520db2fb1
6
+ metadata.gz: ae49639f14f771147960c15f5a76e3b49939c96e1b873b61bcccc4b3926e168d50d0153d6c70bf480f92e2eef2f5f79559e37494a6b4f014286b2936af55b891
7
+ data.tar.gz: c1449facd13b5dd63535f549044b8bc667af812b3ac578557e124c5d42959612f5d86c76e7e7099841a38b4eeeaab37c74cb900e24218f3ca4be875098b1a71a
@@ -16,33 +16,47 @@ module Iibee
16
16
  end
17
17
  CONTEXT_PATH = "apiv1/executiongroups"
18
18
 
19
- attr_reader :type, :isRunning, :runMode, :startMode, :hasChildren, :uuid, :name, :propertiesUri
19
+ attr_reader :type, :isRunning, :runMode, :startMode, :hasChildren, :uuid, :name, :propertiesUri, :executionGroupName, :options
20
20
 
21
- def initialize(document)
22
- document.xpath('application/@*').each do |attribute|
21
+ def initialize(document, executionGroupName, options)
22
+ document.xpath('@*').each do |attribute|
23
23
  instance_variable_set("@#{attribute.name}", attribute.value)
24
24
  end
25
+ @executionGroupName = executionGroupName
26
+ @options = options
27
+ end
28
+
29
+ def executionGroup
30
+ Iibee::ExecutionGroup.find_by(name: executionGroupName, options: @options)
25
31
  end
26
32
 
27
33
  def properties
28
- response = Faraday.get("#{Iibee.configuration.base_url}/#{self.propertiesUri}")
34
+ response = Iibee::Connection.new(options: options).get("#{self.propertiesUri}")
29
35
  document = Oga.parse_xml(response.body)
30
36
  @properties = Iibee::Application::Properties.new(document)
31
37
  end
32
38
 
33
- def self.all(egName)
34
- applications = []
35
- response = Faraday.get("#{Iibee.configuration.base_url}/#{CONTEXT_PATH}/#{egName}/applications/")
36
- document = Oga.parse_xml(response.body)
37
- document.xpath('applications/application').each do |application|
38
- applications << new(document)
39
- end
39
+ def self.find_by(executionGroupName: nil, name: nil, options: {})
40
+ where(executionGroupName: executionGroupName, name: name, options: options).first
40
41
  end
41
42
 
42
- def self.find_by_name(egName, name)
43
- response = Faraday.get("#{Iibee.configuration.base_url}/#{CONTEXT_PATH}/#{egName}/applications/#{name}")
43
+ def self.where(executionGroupName: nil, name: nil, options: {})
44
+ applications = []
45
+
46
+ unless executionGroupName.nil?
47
+ application_url = "/#{CONTEXT_PATH}/#{executionGroupName}/?depth=2"
48
+ else
49
+ application_url = "/#{CONTEXT_PATH}/?depth=3"
50
+ end
51
+
52
+ response = Iibee::Connection.new(options: options).get(application_url)
44
53
  document = Oga.parse_xml(response.body)
45
- new(document)
54
+
55
+ document.xpath("//application[@name='#{name}']").each do |application|
56
+ applications << new(application, application.parent.parent.get('name'), options)
57
+ end
58
+
59
+ return applications
46
60
  end
47
61
  end
48
62
  end
data/lib/iibee/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Iibee
2
- VERSION = "0.1.13"
2
+ VERSION = "0.1.14"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iibee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - akil
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  version: '0'
196
196
  requirements: []
197
197
  rubyforge_project:
198
- rubygems_version: 2.4.7
198
+ rubygems_version: 2.4.6
199
199
  signing_key:
200
200
  specification_version: 4
201
201
  summary: Gem to wrap the IIB 9 REST API.