iibee 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87c1089518ba3dd3d1b4f176418ae9388d22afac
4
- data.tar.gz: d293e920cd2c73fe449682e1a57e98e9927f737c
3
+ metadata.gz: 759337a76ea9c762263f1bf46202a02d395c4209
4
+ data.tar.gz: 2653f1e0b53e080847713d057172ef297b307853
5
5
  SHA512:
6
- metadata.gz: 12204e9c6e144bfdcd7c0906a52676358caf979d13467dab18fc27f95930c9bd1a6699f9271a81acd30ba492322200b18ac0d3474e867acaef0877f99c080c7d
7
- data.tar.gz: 826bb5d485d8ac91ce194ce3e0587b3be0e69c717408d953460e326aa4396624309be8e78799641e43b84ea3b4685417bbad8dade5e55713248e64d8c3e7d301
6
+ metadata.gz: a8b467d440838b33384caa5547ea06ad8f9db6c99ffd7f82dc016cb0f1c2a925bef5546aaf97d59097f1bda39ca3ffecfd0921b2e108ed1392c53f520fa9ad3d
7
+ data.tar.gz: eea9e7b5519a614e1dd7c38a125d57842f4c520d6bf7b71e209497c3c939b2b744b3d125109e1868c077751c79f257ac67a40980f8d06f5829d2e0e9ad6f1023
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Gem Version](https://badge.fury.io/rb/iibee.svg)](http://badge.fury.io/rb/iibee)
1
2
  [![Codeship Status for quantiguous/iibee](https://codeship.com/projects/8b85c0f0-36f8-0133-93cb-2615b91c1f97/status?branch=master)](https://codeship.com/projects/100974)
2
3
  [![Code Climate](https://codeclimate.com/github/quantiguous/iibee/badges/gpa.svg)](https://codeclimate.com/github/quantiguous/iibee)
3
4
  [![Test Coverage](https://codeclimate.com/github/quantiguous/iibee/badges/coverage.svg)](https://codeclimate.com/github/quantiguous/iibee/coverage)
data/iibee.gemspec CHANGED
@@ -25,7 +25,9 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "vcr"
26
26
  spec.add_development_dependency "webmock"
27
27
  spec.add_development_dependency "codeclimate-test-reporter"
28
-
28
+ spec.add_development_dependency "m"
29
+
30
+ spec.add_dependency "net-http-persistent"
29
31
  spec.add_dependency "faraday"
30
32
  spec.add_dependency "oga"
31
33
  end
@@ -4,27 +4,24 @@ require 'oga'
4
4
  module Iibee
5
5
  class Application
6
6
  class Properties
7
- attr_reader :label, :runMode, :uuid, :isRunning, :shortDesc, :longDesc, :processId, :traceLevel, :soapNodesUseEmbeddedListener,
8
- :compiledXPathCacheSizeEntries, :consoleMode, :httpNodesUseEmbeddedListener, :inactiveUserExitList, :activeUserExitList,
9
- :traceNodeLevel, :userTraceLevel, :modifyTime, :deployTime, :barFileName
7
+ attr_reader :processId, :traceLevel, :soapNodesUseEmbeddedListener, :compiledXPathCacheSizeEntries, :consoleMode, :httpNodesUseEmbeddedListener, :inactiveUserExitList, :activeUserExitList, :traceNodeLevel, :userTraceLevel
10
8
  def initialize(document)
11
- document.xpath('properties/*/property').each do |property|
9
+ document.xpath('properties/advancedProperties/property').each do |advancedProperty|
12
10
 
13
- propertyName = property.get('name')
14
- propertyValue = property.get('value')
11
+ propertyName = advancedProperty.get('name')
12
+ propertyValue = advancedProperty.get('value')
15
13
  instance_variable_set("@#{propertyName}", propertyValue)
16
- end
14
+ end
17
15
  end
18
16
  end
19
17
  CONTEXT_PATH = "apiv1/executiongroups"
20
18
 
21
- attr_reader :type, :isRunning, :runMode, :startMode, :hasChildren, :uuid, :name, :propertiesUri, :egName
19
+ attr_reader :type, :isRunning, :runMode, :startMode, :hasChildren, :uuid, :name, :propertiesUri
22
20
 
23
21
  def initialize(document)
24
- document.xpath('@*').each do |attribute|
22
+ document.xpath('application/@*').each do |attribute|
25
23
  instance_variable_set("@#{attribute.name}", attribute.value)
26
24
  end
27
- @executionGroupName = executionGroupName
28
25
  end
29
26
 
30
27
  def properties
@@ -37,37 +34,15 @@ module Iibee
37
34
  applications = []
38
35
  response = Faraday.get("#{Iibee.configuration.base_url}/#{CONTEXT_PATH}/#{egName}/applications/")
39
36
  document = Oga.parse_xml(response.body)
40
- p document.xpath('applications/application')
41
37
  document.xpath('applications/application').each do |application|
42
- applications << new(application)
38
+ applications << new(document)
43
39
  end
44
40
  end
45
41
 
46
- def self.find_by(egName: nil, name: nil)
47
- where(executionGroupName: egName, name: name).first
48
- end
49
-
50
- def self.where(executionGroupName: nil, name: nil)
51
- applications = []
52
-
53
- unless executionGroupName.nil?
54
- application_url = "#{Iibee.configuration.base_url}/#{CONTEXT_PATH}/#{executionGroupName}/?depth=2"
55
- else
56
- application_url = "#{Iibee.configuration.base_url}/#{CONTEXT_PATH}/?depth=3"
57
- end
58
-
59
- response = Faraday.get(application_url)
42
+ def self.find_by_name(egName, name)
43
+ response = Faraday.get("#{Iibee.configuration.base_url}/#{CONTEXT_PATH}/#{egName}/applications/#{name}")
60
44
  document = Oga.parse_xml(response.body)
61
-
62
- document.xpath("//application[@name='#{name}']").each do |application|
63
- applications << new(application, document.at_xpath("//executionGroup[applications/application/@uuid = '#{application.get('uuid')}']").get('name'))
64
- end
65
-
66
- return applications
67
- end
68
-
69
- def executionGroup
70
- Iibee::ExecutionGroup.find_by(name: executionGroupName)
45
+ new(document)
71
46
  end
72
47
  end
73
48
  end
data/lib/iibee/broker.rb CHANGED
@@ -28,8 +28,7 @@ module Iibee
28
28
  end
29
29
 
30
30
  def self.find_by(options: {})
31
- url = "#{options[:scheme]}://#{options[:host]}:#{options[:port]}".chomp(":")
32
- response = Faraday.get("#{url}#{CONTEXT_PATH}")
31
+ response = Iibee::Connection.new(options: options).get(CONTEXT_PATH)
33
32
  document = Oga.parse_xml(response.body)
34
33
  new(document)
35
34
  end
@@ -0,0 +1,18 @@
1
+ require 'faraday'
2
+
3
+ module Iibee
4
+ class Connection
5
+ def initialize(options: {})
6
+ url = "#{options[:scheme]}://#{options[:host]}:#{options[:port]}".chomp(":")
7
+ @conn = Faraday.new(url) do |f|
8
+ f.response :logger
9
+ f.adapter :net_http_persistent
10
+ end
11
+ @conn.basic_auth(options[:user], options[:password]) unless options[:user].nil? or options[:password].nil?
12
+ end
13
+
14
+ def get(url)
15
+ @conn.get(url)
16
+ end
17
+ end
18
+ end
@@ -1,4 +1,3 @@
1
- require 'faraday'
2
1
  require 'oga'
3
2
 
4
3
  module Iibee
@@ -29,16 +28,14 @@ module Iibee
29
28
  end
30
29
 
31
30
  def properties
32
- url = "#{options[:scheme]}://#{options[:host]}:#{options[:port]}".chomp(":")
33
- response = Faraday.get("#{url}/#{self.propertiesUri}")
31
+ response = Iibee::Connection.new(options: options).get("#{self.propertiesUri}")
34
32
  document = Oga.parse_xml(response.body)
35
33
  @properties = Iibee::ExecutionGroup::Properties.new(document)
36
34
  end
37
35
 
38
36
  def self.all(options: {})
39
37
  egs = []
40
- url = "#{options[:scheme]}://#{options[:host]}:#{options[:port]}".chomp(":")
41
- response = Faraday.get("#{url}/#{CONTEXT_PATH}/")
38
+ response = Iibee::Connection.new(options: options).get(CONTEXT_PATH)
42
39
  document = Oga.parse_xml(response.body)
43
40
  document.xpath('executionGroups/executionGroup').each do |eg|
44
41
  egs << new(eg, options)
@@ -52,9 +49,8 @@ module Iibee
52
49
 
53
50
  def self.where(name: nil, options: {})
54
51
  egs = []
55
- url = "#{options[:scheme]}://#{options[:host]}:#{options[:port]}".chomp(":")
56
52
  unless name.nil?
57
- response = Faraday.get("#{url}/#{CONTEXT_PATH}/#{name}")
53
+ response = Iibee::Connection.new(options: options).get("#{CONTEXT_PATH}/#{name}")
58
54
  document = Oga.parse_xml(response.body)
59
55
  document.xpath("//executionGroup[@name='#{name}']").each do |eg|
60
56
  egs << new(eg, options)
data/lib/iibee/service.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'faraday'
2
1
  require 'oga'
3
2
 
4
3
  module Iibee
@@ -33,8 +32,7 @@ module Iibee
33
32
  end
34
33
 
35
34
  def properties
36
- url = "#{options[:scheme]}://#{options[:host]}:#{options[:port]}".chomp(":")
37
- response = Faraday.get("#{url}/#{self.propertiesUri}")
35
+ response = Iibee::Connection.new(options: options).get("#{self.propertiesUri}")
38
36
  document = Oga.parse_xml(response.body)
39
37
  @properties = Iibee::Service::Properties.new(document)
40
38
  end
@@ -45,8 +43,6 @@ module Iibee
45
43
 
46
44
  def self.where(executionGroupName: nil, name: nil, options: {})
47
45
  services = []
48
-
49
- url = "#{options[:scheme]}://#{options[:host]}:#{options[:port]}".chomp(":")
50
46
 
51
47
  unless executionGroupName.nil?
52
48
  service_url = "/#{CONTEXT_PATH}/#{executionGroupName}/?depth=2"
@@ -54,7 +50,7 @@ module Iibee
54
50
  service_url = "/#{CONTEXT_PATH}/?depth=3"
55
51
  end
56
52
 
57
- response = Faraday.get(url+service_url)
53
+ response = Iibee::Connection.new(options: options).get(service_url)
58
54
  document = Oga.parse_xml(response.body)
59
55
 
60
56
  document.xpath("//service[@name='#{name}']").each do |service|
data/lib/iibee/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Iibee
2
- VERSION = "0.1.11"
2
+ VERSION = "0.1.12"
3
3
  end
data/lib/iibee.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "iibee/version"
2
2
  require "iibee/configuration"
3
+ require "iibee/connection"
3
4
  require "iibee/broker"
4
5
  require "iibee/execution_group"
5
6
  require "iibee/service"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iibee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - akil
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-10 00:00:00.000000000 Z
11
+ date: 2015-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: m
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: net-http-persistent
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: faraday
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -143,6 +171,7 @@ files:
143
171
  - lib/iibee/application.rb
144
172
  - lib/iibee/broker.rb
145
173
  - lib/iibee/configuration.rb
174
+ - lib/iibee/connection.rb
146
175
  - lib/iibee/execution_group.rb
147
176
  - lib/iibee/service.rb
148
177
  - lib/iibee/version.rb
@@ -166,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
195
  version: '0'
167
196
  requirements: []
168
197
  rubyforge_project:
169
- rubygems_version: 2.4.6
198
+ rubygems_version: 2.4.7
170
199
  signing_key:
171
200
  specification_version: 4
172
201
  summary: Gem to wrap the IIB 9 REST API.