webee 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/test.rb +4 -7
- data/lib/webee.rb +8 -8
- metadata +4 -4
data/examples/test.rb
CHANGED
@@ -3,13 +3,10 @@ require 'webee'
|
|
3
3
|
require 'md5'
|
4
4
|
require 'active_support'
|
5
5
|
|
6
|
-
WeBee::Api.user = ENV['user'] || '
|
7
|
-
WeBee::Api.password = ENV['pass'] || '
|
8
|
-
WeBee::Api.url = '
|
6
|
+
WeBee::Api.user = ENV['user'] || 'xfernandez'
|
7
|
+
WeBee::Api.password = ENV['pass'] || 'xfernandez'
|
8
|
+
WeBee::Api.url = 'https://demonstration.abiquo.com/api'
|
9
9
|
|
10
10
|
include WeBee
|
11
11
|
|
12
|
-
|
13
|
-
dc.find_vms_by_name('1dee').each do |vm|
|
14
|
-
puts vm.raw
|
15
|
-
end
|
12
|
+
puts Enterprise.all.first.users
|
data/lib/webee.rb
CHANGED
@@ -29,7 +29,7 @@ end
|
|
29
29
|
|
30
30
|
module WeBee
|
31
31
|
|
32
|
-
VERSION = '0.3.
|
32
|
+
VERSION = '0.3.6'
|
33
33
|
|
34
34
|
module RestResource
|
35
35
|
|
@@ -87,7 +87,7 @@ module WeBee
|
|
87
87
|
port ||= 80
|
88
88
|
uri = URI.parse(url)
|
89
89
|
@host = uri.host
|
90
|
-
"
|
90
|
+
"#{uri.scheme}://#{user}:#{password}@#{uri.host}:#{uri.port}#{uri.path}"
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -126,7 +126,7 @@ module WeBee
|
|
126
126
|
enterprise_id = enterprise
|
127
127
|
end
|
128
128
|
items = []
|
129
|
-
doc = Nokogiri.parse(RestClient.get(Api.url + "/admin/enterprises/#{enterprise_id}/appslib/ovfpackages", :
|
129
|
+
doc = Nokogiri.parse(RestClient.get(Api.url + "/admin/enterprises/#{enterprise_id}/appslib/ovfpackages", :accept => :xml))
|
130
130
|
doc.search('//ovfPackage').each do |node|
|
131
131
|
items << OVFPackage.parse(node.to_s)
|
132
132
|
end
|
@@ -134,7 +134,7 @@ module WeBee
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def self.find(enterprise_id = 1, package_id = 1)
|
137
|
-
doc = Nokogiri.parse(RestClient.get(Api.url + "/admin/enterprises/#{enterprise_id}/appslib/ovfpackages/#{package_id}"))
|
137
|
+
doc = Nokogiri.parse(RestClient.get(Api.url + "/admin/enterprises/#{enterprise_id}/appslib/ovfpackages/#{package_id}", :accept => :xml))
|
138
138
|
OVFPackage.parse(doc.root.to_s)
|
139
139
|
end
|
140
140
|
end
|
@@ -755,7 +755,7 @@ module WeBee
|
|
755
755
|
|
756
756
|
def limits
|
757
757
|
items = []
|
758
|
-
doc = Nokogiri.parse(RestClient.get(Api.url + "/admin/enterprises/#{resource_id}/limits"))
|
758
|
+
doc = Nokogiri.parse(RestClient.get(Api.url + "/admin/enterprises/#{resource_id}/limits", :accept => :xml))
|
759
759
|
doc.search('//limit').each do |node|
|
760
760
|
items << DatacenterLimit.parse(node.to_s)
|
761
761
|
end
|
@@ -802,7 +802,7 @@ module WeBee
|
|
802
802
|
|
803
803
|
def users
|
804
804
|
col = []
|
805
|
-
doc = Nokogiri.parse(RestClient.get(Api.url + "/admin/enterprises/#{resource_id}/users"))
|
805
|
+
doc = Nokogiri.parse(RestClient.get(Api.url + "/admin/enterprises/#{resource_id}/users", :accept => :xml))
|
806
806
|
doc.search('//user').each do |node|
|
807
807
|
user = User.parse(node.to_s)
|
808
808
|
col << user
|
@@ -896,7 +896,7 @@ module WeBee
|
|
896
896
|
else
|
897
897
|
enterprise_id = enterprise
|
898
898
|
end
|
899
|
-
User.parse(RestClient.get(Api.url + "/admin/enterprises/#{enterprise_id}/users/#{user_id}"))
|
899
|
+
User.parse(RestClient.get(Api.url + "/admin/enterprises/#{enterprise_id}/users/#{user_id}", :accept => :xml))
|
900
900
|
end
|
901
901
|
|
902
902
|
def self.all(enterprise = nil)
|
@@ -909,7 +909,7 @@ module WeBee
|
|
909
909
|
enterprise_id = '_'
|
910
910
|
end
|
911
911
|
u = []
|
912
|
-
doc = Nokogiri.parse(RestClient.get(Api.url + "/admin/enterprises/#{enterprise_id}/users"))
|
912
|
+
doc = Nokogiri.parse(RestClient.get(Api.url + "/admin/enterprises/#{enterprise_id}/users", :accept => :xml))
|
913
913
|
doc.search('//user').each do |node|
|
914
914
|
user = User.parse(node.to_s)
|
915
915
|
u << user
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 6
|
10
|
+
version: 0.3.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sergio Rubio
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-09-
|
18
|
+
date: 2011-09-16 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: sax-machine
|