occi-core 4.2.17 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -3
- data/Gemfile +1 -1
- data/README.md +14 -57
- data/lib/occi/core/attributes.rb +39 -14
- data/lib/occi/core/resource.rb +1 -2
- data/lib/occi/parser/text.rb +3 -5
- data/lib/occi/version.rb +1 -1
- data/lib/occi-core.rb +5 -4
- data/occi-core.gemspec +8 -8
- data/spec/occi/core/attributes_spec.rb +42 -4
- data/spec/occi/core/resource_spec.rb +13 -3
- data/spec/occi/parser/json_samples/test.json +18 -2
- data/spec/spec_helper.rb +0 -11
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c980a6949dc159435afb04d6ab6a22be6e7b3033
|
4
|
+
data.tar.gz: 534e9217f9cec71358dd203e9d4feedc756f08a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d80e1f03092cc570fc2c8bd9cdec5a69f708cb15d3a6c9465e3b285b5afceb7edca1d0f107fd789e59c4d023396a91df4d9200a20b8db733425c44dcc015c6bf
|
7
|
+
data.tar.gz: a4a9a6aa3d4f91fbe21cd397e12f596fdb337409899616ce1635383778844e914e614906e70918a7f2fafb4476f761ab4261d0fb5353af2338eef21f600abe5b
|
data/.travis.yml
CHANGED
@@ -3,7 +3,7 @@ language: ruby
|
|
3
3
|
rvm:
|
4
4
|
- 1.9.3
|
5
5
|
- 2.0.0
|
6
|
-
- 2.1
|
6
|
+
- 2.1
|
7
7
|
- ruby-head
|
8
8
|
- jruby-19mode
|
9
9
|
- jruby-head
|
@@ -26,9 +26,9 @@ matrix:
|
|
26
26
|
jdk: openjdk7
|
27
27
|
- rvm: 2.0.0
|
28
28
|
jdk: oraclejdk7
|
29
|
-
- rvm: 2.1
|
29
|
+
- rvm: 2.1
|
30
30
|
jdk: openjdk7
|
31
|
-
- rvm: 2.1
|
31
|
+
- rvm: 2.1
|
32
32
|
jdk: oraclejdk7
|
33
33
|
- rvm: ruby-head
|
34
34
|
jdk: openjdk7
|
@@ -42,3 +42,4 @@ branches:
|
|
42
42
|
- 4.0.x
|
43
43
|
- 4.1.x
|
44
44
|
- 4.2.x
|
45
|
+
- 4.3.x
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
rOCCI-core - A Ruby OCCI Framework
|
2
2
|
=================================
|
3
3
|
|
4
|
-
[![Build Status](https://secure.travis-ci.org/
|
5
|
-
[![Dependency Status](https://gemnasium.com/
|
4
|
+
[![Build Status](https://secure.travis-ci.org/EGI-FCTF/rOCCI-core.png)](http://travis-ci.org/EGI-FCTF/rOCCI-core)
|
5
|
+
[![Dependency Status](https://gemnasium.com/EGI-FCTF/rOCCI-core.png)](https://gemnasium.com/EGI-FCTF/rOCCI-core)
|
6
6
|
[![Gem Version](https://fury-badge.herokuapp.com/rb/occi-core.png)](https://badge.fury.io/rb/occi-core)
|
7
|
-
[![Code Climate](https://codeclimate.com/github/
|
7
|
+
[![Code Climate](https://codeclimate.com/github/EGI-FCTF/rOCCI-core.png)](https://codeclimate.com/github/EGI-FCTF/rOCCI-core)
|
8
8
|
|
9
9
|
Requirements
|
10
10
|
------------
|
@@ -12,7 +12,6 @@ Requirements
|
|
12
12
|
### Ruby
|
13
13
|
* Ruby 1.9.3 is required
|
14
14
|
* RubyGems have to be installed
|
15
|
-
* Rake has to be installed (e.g., `gem install rake`)
|
16
15
|
|
17
16
|
### Examples
|
18
17
|
#### For distros based on Debian:
|
@@ -42,12 +41,10 @@ Installation
|
|
42
41
|
|
43
42
|
To install the most recent stable version
|
44
43
|
|
45
|
-
gem install rake
|
46
44
|
gem install occi-core
|
47
45
|
|
48
46
|
To install the most recent beta version
|
49
47
|
|
50
|
-
gem install rake
|
51
48
|
gem install occi-core --pre
|
52
49
|
|
53
50
|
### From source (dev)
|
@@ -58,11 +55,11 @@ To install the most recent beta version
|
|
58
55
|
|
59
56
|
To build and install the bleeding edge version from master
|
60
57
|
|
61
|
-
git clone git://github.com/
|
58
|
+
git clone git://github.com/EGI-FCTF/rOCCI-core.git
|
62
59
|
cd rOCCI-core
|
63
60
|
gem install bundler
|
64
61
|
bundle install
|
65
|
-
bundle exec rake
|
62
|
+
bundle exec rake spec
|
66
63
|
rake install
|
67
64
|
|
68
65
|
### RVM
|
@@ -85,56 +82,16 @@ ruby -v
|
|
85
82
|
|
86
83
|
Usage
|
87
84
|
-----
|
88
|
-
Detailed documentation is available in our [Wiki](https://github.com/
|
89
|
-
|
90
|
-
### Logging
|
91
|
-
|
92
|
-
The OCCI gem includes its own logging mechanism using a message queue. By default, no one is listening to that queue.
|
93
|
-
A new OCCI Logger can be initialized by specifying the log destination (either a filename or an IO object like
|
94
|
-
STDOUT) and the log level.
|
95
|
-
|
96
|
-
logger = Occi::Log.new STDOUT
|
97
|
-
logger.level = Occi::Log::INFO
|
98
|
-
|
99
|
-
You can create multiple Loggers to receive the log output.
|
100
|
-
|
101
|
-
You can always, even if there is no logger defined, log output using the class methods of OCCI::Log e.g.
|
102
|
-
|
103
|
-
Occi::Log.info("Test message")
|
104
|
-
|
105
|
-
### Registering categories in the OCCI Model
|
106
|
-
|
107
|
-
Before the parser may be used, the available categories have to be registered in the OCCI Model.
|
108
|
-
|
109
|
-
For categories already specified by the OCCI WG a method exists in the OCCI Model class to register them:
|
110
|
-
|
111
|
-
model = Occi::Model.new
|
112
|
-
model.register_infrastructure
|
113
|
-
|
114
|
-
Further categories can either be registered from files which include OCCI collections in JSON format or or from parsed
|
115
|
-
JSON objects (e.g. from the query interface of an OCCI service endpoint).
|
116
|
-
|
117
|
-
### Parsing OCCI messages
|
118
|
-
|
119
|
-
The OCCI gem includes a Parser to easily parse OCCI messages. With a given media type (e.g. json,
|
120
|
-
xml or plain text) the parser analyses the content of the message body and, if supplied,
|
121
|
-
the message header. As the text/plain and text/occi media type do not clearly distinguish between a message with a
|
122
|
-
category and a message with an entity which has a kind, it has to be specified if the message contains a category
|
123
|
-
(e.g. for user defined mixins)
|
124
|
-
|
125
|
-
OCCI messages can be parsed to an OCCI collection for example like
|
126
|
-
|
127
|
-
media_type = 'text/plain'
|
128
|
-
body = %Q|Category: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind"|
|
129
|
-
collection=Occi::Parser.parse(media_type, body)
|
130
|
-
|
131
|
-
### Using the OCCI model
|
132
|
-
|
133
|
-
The occi-core gem includes all OCCI Core classes necessary to handly arbitrary OCCI objects.
|
85
|
+
Detailed documentation is available in our [Wiki](https://github.com/EGI-FCTF/rOCCI-core/wiki).
|
134
86
|
|
135
87
|
Changelog
|
136
88
|
---------
|
137
89
|
|
90
|
+
### Version 4.3
|
91
|
+
* Internal updates and bug fixes
|
92
|
+
* Updated JSON rendering
|
93
|
+
* Updated dependencies
|
94
|
+
|
138
95
|
### Version 4.2
|
139
96
|
* Internal changes and bug fixes
|
140
97
|
* Extended test coverage
|
@@ -211,7 +168,7 @@ Development
|
|
211
168
|
|
212
169
|
Checkout latest version from git:
|
213
170
|
|
214
|
-
git clone git://github.com/
|
171
|
+
git clone git://github.com/EGI-FCTF/rOCCI-core.git
|
215
172
|
|
216
173
|
Change to rOCCI-core folder
|
217
174
|
|
@@ -223,11 +180,11 @@ Install dependencies
|
|
223
180
|
|
224
181
|
### Code Documentation
|
225
182
|
|
226
|
-
[Code Documentation for rOCCI by YARD](http://rubydoc.info/github/
|
183
|
+
[Code Documentation for rOCCI by YARD](http://rubydoc.info/github/EGI-FCTF/rOCCI-core/)
|
227
184
|
|
228
185
|
### Continuous integration
|
229
186
|
|
230
|
-
[Continuous integration for rOCCI by Travis-CI](http://travis-ci.org/
|
187
|
+
[Continuous integration for rOCCI by Travis-CI](http://travis-ci.org/EGI-FCTF/rOCCI-core/)
|
231
188
|
|
232
189
|
### Contribute
|
233
190
|
|
data/lib/occi/core/attributes.rb
CHANGED
@@ -47,15 +47,16 @@ module Occi
|
|
47
47
|
|
48
48
|
def remove(attributes)
|
49
49
|
attributes.keys.each do |key|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
next unless self.keys.include?(key)
|
51
|
+
|
52
|
+
case self[key]
|
53
|
+
when Occi::Core::Attributes
|
54
|
+
self[key].remove attributes[key]
|
55
|
+
else
|
56
|
+
self.delete(key)
|
57
57
|
end
|
58
58
|
end
|
59
|
+
|
59
60
|
self
|
60
61
|
end
|
61
62
|
|
@@ -69,6 +70,7 @@ module Occi
|
|
69
70
|
attributes[key] = nil
|
70
71
|
end
|
71
72
|
end
|
73
|
+
|
72
74
|
attributes.converted = true
|
73
75
|
attributes
|
74
76
|
end
|
@@ -88,6 +90,7 @@ module Occi
|
|
88
90
|
hash[key] = self[key]
|
89
91
|
end
|
90
92
|
end
|
93
|
+
|
91
94
|
hash
|
92
95
|
end
|
93
96
|
|
@@ -243,6 +246,7 @@ module Occi
|
|
243
246
|
def validate_and_assign(key, value, property_key)
|
244
247
|
raise Occi::Errors::AttributeNameInvalidError,
|
245
248
|
"Attribute names (as in \"#{key}\") must not begin with underscores" if key =~ /^_/
|
249
|
+
|
246
250
|
case value
|
247
251
|
when Occi::Core::Attributes
|
248
252
|
add_to_hashie(key, value)
|
@@ -254,19 +258,19 @@ module Occi
|
|
254
258
|
add_to_hashie(key, properties.clone)
|
255
259
|
add_to_hashie(property_key, properties.clone)
|
256
260
|
when Occi::Core::Entity
|
257
|
-
match_type(value, self[property_key]
|
261
|
+
match_type(value, 'string', self[property_key]) if self[property_key]
|
258
262
|
add_to_hashie(key, value)
|
259
263
|
when Occi::Core::Category
|
260
|
-
match_type(value, self[property_key]
|
264
|
+
match_type(value, 'string', self[property_key]) if self[property_key]
|
261
265
|
add_to_hashie(key, value)
|
262
266
|
when String
|
263
|
-
|
267
|
+
value = interpret_string(value, self[property_key]) if self[property_key]
|
264
268
|
add_to_hashie(key, value)
|
265
269
|
when Numeric
|
266
|
-
match_type(value, self[property_key]
|
270
|
+
match_type(value, 'number', self[property_key]) if self[property_key]
|
267
271
|
add_to_hashie(key, value)
|
268
272
|
when FalseClass, TrueClass
|
269
|
-
match_type(value, self[property_key]
|
273
|
+
match_type(value, 'boolean', self[property_key]) if self[property_key]
|
270
274
|
add_to_hashie(key, value)
|
271
275
|
when NilClass
|
272
276
|
add_to_hashie(key, value)
|
@@ -280,10 +284,31 @@ module Occi
|
|
280
284
|
Hashie::Mash.instance_method(:[]=).bind(self).call(*args)
|
281
285
|
end
|
282
286
|
|
283
|
-
def
|
287
|
+
def interpret_string(value, property)
|
288
|
+
if property.type == 'number' && (/^[.0-9]+$/ =~ value)
|
289
|
+
value = (/^[0-9]+$/ =~ value) ? value.to_i : value.to_f
|
290
|
+
match_type(value, 'number', property)
|
291
|
+
elsif property.type == 'boolean'
|
292
|
+
value = if value.casecmp("yes") == 0 || value.casecmp("true") == 0
|
293
|
+
true
|
294
|
+
elsif value.casecmp("no") == 0 || value.casecmp("false") == 0
|
295
|
+
false
|
296
|
+
else
|
297
|
+
value
|
298
|
+
end
|
299
|
+
|
300
|
+
match_type(value, 'boolean', property)
|
301
|
+
else
|
302
|
+
match_type(value, 'string', property)
|
303
|
+
end
|
304
|
+
|
305
|
+
value
|
306
|
+
end
|
307
|
+
|
308
|
+
def match_type(value, value_type, property)
|
284
309
|
raise Occi::Errors::AttributeTypeError,
|
285
310
|
"Value #{value} derived from #{value.class} assigned " \
|
286
|
-
"but attribute of type #{property.type} required" unless property.type ==
|
311
|
+
"but attribute of type #{property.type} required" unless property.type == value_type
|
287
312
|
match_pattern(property.pattern, value)
|
288
313
|
end
|
289
314
|
|
data/lib/occi/core/resource.rb
CHANGED
@@ -73,8 +73,7 @@ module Occi
|
|
73
73
|
# @return [Hashie::Mash] link as Hashie::Mash to be parsed into a JSON object
|
74
74
|
def as_json(options={})
|
75
75
|
resource = super
|
76
|
-
|
77
|
-
resource.links = link_strings unless link_strings.empty?
|
76
|
+
resource.links = @links.as_json if @links.any?
|
78
77
|
resource
|
79
78
|
end
|
80
79
|
|
data/lib/occi/parser/text.rb
CHANGED
@@ -117,15 +117,13 @@ module Occi
|
|
117
117
|
|
118
118
|
attributes = Occi::Core::Attributes.new
|
119
119
|
if match[:attributes]
|
120
|
-
|
121
|
-
matched_attributes.split.each do |attribute|
|
122
|
-
attribute.gsub! /\{(immutable|required)_(required|immutable)\}/, '{\1 \2}'
|
120
|
+
match[:attributes].split.each do |attribute|
|
123
121
|
property_string = attribute[/#{REGEXP_ATTRIBUTE_DEF}/, -2]
|
124
122
|
properties = Occi::Core::Properties.new
|
125
123
|
|
126
124
|
if property_string
|
127
|
-
properties.required = property_string.include?('required')
|
128
|
-
properties.mutable = !property_string.include?('immutable')
|
125
|
+
properties.required = property_string.include?('{required}')
|
126
|
+
properties.mutable = !property_string.include?('{immutable}')
|
129
127
|
end
|
130
128
|
|
131
129
|
name = attribute[/#{REGEXP_ATTRIBUTE_DEF}/, 1]
|
data/lib/occi/version.rb
CHANGED
data/lib/occi-core.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'uri'
|
5
|
-
require 'hashie/mash'
|
6
|
-
|
3
|
+
require 'active_support'
|
7
4
|
require 'active_support/core_ext'
|
8
5
|
require 'active_support/json'
|
9
6
|
require 'active_support/inflector'
|
10
7
|
require 'active_support/notifications'
|
11
8
|
|
9
|
+
require 'set'
|
10
|
+
require 'uri'
|
11
|
+
require 'hashie/mash'
|
12
|
+
|
12
13
|
require 'logger'
|
13
14
|
require 'uuidtools'
|
14
15
|
require 'rubygems/package'
|
data/occi-core.gemspec
CHANGED
@@ -8,21 +8,21 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.name = 'occi-core'
|
9
9
|
gem.version = Occi::VERSION
|
10
10
|
gem.authors = ['Florian Feldhaus','Piotr Kasprzak', 'Boris Parak']
|
11
|
-
gem.email = ['florian.feldhaus@gmail.com', 'piotr.kasprzak@gwdg.de', '
|
11
|
+
gem.email = ['florian.feldhaus@gmail.com', 'piotr.kasprzak@gwdg.de', 'parak@cesnet.cz']
|
12
12
|
gem.description = %q{OCCI is a collection of classes to simplify the implementation of the Open Cloud Computing API in Ruby}
|
13
13
|
gem.summary = %q{OCCI toolkit}
|
14
|
-
gem.homepage = 'https://github.com/
|
14
|
+
gem.homepage = 'https://github.com/EGI-FCTF/rOCCI-core'
|
15
15
|
gem.license = 'Apache License, Version 2.0'
|
16
16
|
|
17
17
|
gem.files = `git ls-files`.split("\n")
|
18
18
|
gem.test_files = `git ls-files -- {test,spec}/*`.split("\n")
|
19
19
|
gem.require_paths = ['lib']
|
20
20
|
|
21
|
-
gem.add_dependency 'json'
|
22
|
-
gem.add_dependency 'hashie'
|
23
|
-
gem.add_dependency 'uuidtools', '>=2.1.3'
|
24
|
-
gem.add_dependency 'activesupport', '
|
25
|
-
gem.add_dependency 'settingslogic'
|
21
|
+
gem.add_dependency 'json', '>= 1.8.1'
|
22
|
+
gem.add_dependency 'hashie', '>= 3.3.1'
|
23
|
+
gem.add_dependency 'uuidtools', '>= 2.1.3'
|
24
|
+
gem.add_dependency 'activesupport', '>= 4.0.0'
|
25
|
+
gem.add_dependency 'settingslogic', '>= 2.0.9'
|
26
26
|
|
27
|
-
gem.required_ruby_version
|
27
|
+
gem.required_ruby_version = '>= 1.9.3'
|
28
28
|
end
|
@@ -546,10 +546,18 @@ module Occi
|
|
546
546
|
|
547
547
|
|
548
548
|
context '.validate_and_assign' do
|
549
|
-
let(:attrs){
|
549
|
+
let(:attrs){
|
550
|
+
attrs = Occi::Core::Attributes.new
|
551
|
+
attrs['entity'] = {:type => 'string'}
|
552
|
+
attrs['category'] = {:type => 'string'}
|
553
|
+
attrs['numeric'] = {:type => 'number'}
|
554
|
+
attrs['tr'] = {:type => 'boolean'}
|
555
|
+
attrs['fal'] = {:type => 'boolean'}
|
556
|
+
attrs.convert
|
557
|
+
attrs}
|
550
558
|
|
551
559
|
it 'correctly accepts Occi::Core::Attributes' do
|
552
|
-
inattrs =
|
560
|
+
inattrs = attrs
|
553
561
|
inattrs['numbertype'] = { :type => 'number', :default => 42, :mutable => true, :pattern => '^[0-9]+' }
|
554
562
|
inattrs.convert
|
555
563
|
inattrs['numbertype'] = 13
|
@@ -559,9 +567,9 @@ module Occi
|
|
559
567
|
end
|
560
568
|
|
561
569
|
it 'correctly accepts Occi::Core::Properties' do
|
570
|
+
expected = attrs
|
562
571
|
attrs['properties'] = Occi::Core::Properties.new
|
563
572
|
|
564
|
-
expected = Occi::Core::Attributes.new
|
565
573
|
expected['properties'] = { :type => 'string', :pattern => '.*', :mutable => false, :required => false }
|
566
574
|
expected.convert
|
567
575
|
|
@@ -569,9 +577,9 @@ module Occi
|
|
569
577
|
end
|
570
578
|
|
571
579
|
it 'correctly accepts Hash' do
|
580
|
+
expected = attrs
|
572
581
|
attrs['hash'] = { :type => 'string', :pattern => '.*', :mutable => false, :required => false }
|
573
582
|
|
574
|
-
expected = Occi::Core::Attributes.new
|
575
583
|
expected['hash'] = { :type => 'string', :pattern => '.*', :mutable => false, :required => false }
|
576
584
|
expected.convert
|
577
585
|
|
@@ -602,16 +610,46 @@ module Occi
|
|
602
610
|
expect(attrs['numeric']).to eql 16
|
603
611
|
end
|
604
612
|
|
613
|
+
it 'correctly accepts Numeric given as string' do
|
614
|
+
attrs['numeric'] = '16'
|
615
|
+
expect(attrs['numeric']).to eql 16
|
616
|
+
end
|
617
|
+
|
618
|
+
it 'correctly accepts floating point given as string' do
|
619
|
+
attrs['numeric'] = '16.4'
|
620
|
+
expect(attrs['numeric']).to eql 16.4
|
621
|
+
end
|
622
|
+
|
623
|
+
it 'correctly refuses empty Numeric value' do
|
624
|
+
expect{ attrs['numeric'] = '' }.to raise_exception(Occi::Errors::AttributeTypeError)
|
625
|
+
end
|
626
|
+
|
627
|
+
it 'correctly refuses malformed Numeric value' do
|
628
|
+
expect{ attrs['numeric'] = '1.b' }.to raise_exception(Occi::Errors::AttributeTypeError)
|
629
|
+
expect{ attrs['numeric'] = '.b' }.to raise_exception(Occi::Errors::AttributeTypeError)
|
630
|
+
expect{ attrs['numeric'] = 'b.1' }.to raise_exception(Occi::Errors::AttributeTypeError)
|
631
|
+
end
|
632
|
+
|
605
633
|
it 'correctly accepts TrueClass' do
|
606
634
|
attrs['tr'] = true
|
607
635
|
expect(attrs['tr']).to eql true
|
608
636
|
end
|
609
637
|
|
638
|
+
it 'correctly accepts TrueClass given as string' do
|
639
|
+
attrs['tr'] = 'true'
|
640
|
+
expect(attrs['tr']).to eql true
|
641
|
+
end
|
642
|
+
|
610
643
|
it 'correctly accepts FalseClass' do
|
611
644
|
attrs['fal'] = false
|
612
645
|
expect(attrs['fal']).to eql false
|
613
646
|
end
|
614
647
|
|
648
|
+
it 'correctly accepts FalseClass given as string' do
|
649
|
+
attrs['fal'] = 'false'
|
650
|
+
expect(attrs['fal']).to eql false
|
651
|
+
end
|
652
|
+
|
615
653
|
it 'correctly responds to NilClass' do
|
616
654
|
attrs['nil'] = nil
|
617
655
|
expect(attrs['nil']).to eql nil
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module Occi
|
2
2
|
module Core
|
3
3
|
describe Resource do
|
4
|
-
let(:resource){ resource = Occi::Core::Resource.new
|
4
|
+
let(:resource){ resource = Occi::Core::Resource.new
|
5
5
|
resource.link target
|
6
6
|
resource.attributes.occi!.core!.summary = "Resource Summary"
|
7
7
|
resource }
|
8
8
|
let(:target){ target = Occi::Core::Resource.new }
|
9
|
-
|
9
|
+
|
10
10
|
context '#link' do
|
11
11
|
it "creates the appropriate No. of links" do
|
12
12
|
expect(resource.links.count).to eq 1
|
@@ -17,7 +17,17 @@ module Occi
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'sets the right target' do
|
20
|
-
expect(resource.links.first.target).to
|
20
|
+
expect(resource.links.first.target).to eq target.to_s
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'sets the right source' do
|
24
|
+
expect(resource.links.first.source).to eq resource.to_s
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context '#as_json' do
|
29
|
+
it 'renders to JSON with full links' do
|
30
|
+
expect(resource.as_json.links.first).to be_kind_of Hashie::Mash
|
21
31
|
end
|
22
32
|
end
|
23
33
|
|
@@ -5,6 +5,7 @@
|
|
5
5
|
"attributes":{
|
6
6
|
"occi":{
|
7
7
|
"core":{
|
8
|
+
"id": "34c88188-d31a-11e1-a11a-a4b197fffef4",
|
8
9
|
"summary":""
|
9
10
|
},
|
10
11
|
"compute":{
|
@@ -13,7 +14,21 @@
|
|
13
14
|
}
|
14
15
|
}
|
15
16
|
},
|
16
|
-
"links":[
|
17
|
+
"links":[
|
18
|
+
{
|
19
|
+
"kind":"http://schemas.ogf.org/occi/infrastructure#storagelink",
|
20
|
+
"attributes":{
|
21
|
+
"occi":{
|
22
|
+
"core":{
|
23
|
+
"id":"urn:uuid:34cbb948-d31a-11e1-a11a-a4b197fffef3",
|
24
|
+
"title":"Harddisk 1",
|
25
|
+
"source": "/compute/34c88188-d31a-11e1-a11a-a4b197fffef4",
|
26
|
+
"target":"/storage/34c88188-d31a-11e1-a11a-a4b197fffef3"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
]
|
17
32
|
}
|
18
33
|
],
|
19
34
|
"links":[
|
@@ -24,10 +39,11 @@
|
|
24
39
|
"core":{
|
25
40
|
"id":"urn:uuid:34cbb948-d31a-11e1-a11a-a4b197fffef3",
|
26
41
|
"title":"Harddisk 1",
|
42
|
+
"source": "/compute/34c88188-d31a-11e1-a11a-a4b197fffef4",
|
27
43
|
"target":"/storage/34c88188-d31a-11e1-a11a-a4b197fffef3"
|
28
44
|
}
|
29
45
|
}
|
30
46
|
}
|
31
47
|
}
|
32
48
|
]
|
33
|
-
}
|
49
|
+
}
|
data/spec/spec_helper.rb
CHANGED
@@ -13,17 +13,6 @@ require 'json_spec'
|
|
13
13
|
|
14
14
|
Dir["#{File.dirname(__FILE__)}/helpers/*.rb"].each {|file| require file }
|
15
15
|
|
16
|
-
# simplify the usage of VCR; this will allow us to use
|
17
|
-
#
|
18
|
-
# it "does something", :vcr do
|
19
|
-
# ...
|
20
|
-
# end
|
21
|
-
#
|
22
|
-
# instead of
|
23
|
-
#
|
24
|
-
# it "does something else", :vcr => true do
|
25
|
-
# ...
|
26
|
-
# end
|
27
16
|
RSpec.configure do |c|
|
28
17
|
c.include JsonSpec::Helpers
|
29
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: occi-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Feldhaus
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-10-
|
13
|
+
date: 2014-10-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -18,28 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 1.8.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version:
|
28
|
+
version: 1.8.1
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: hashie
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
35
|
+
version: 3.3.1
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 3.3.1
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: uuidtools
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
name: activesupport
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - "
|
61
|
+
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: 4.0.0
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- - "
|
68
|
+
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: 4.0.0
|
71
71
|
- !ruby/object:Gem::Dependency
|
@@ -74,20 +74,20 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 2.0.9
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
84
|
+
version: 2.0.9
|
85
85
|
description: OCCI is a collection of classes to simplify the implementation of the
|
86
86
|
Open Cloud Computing API in Ruby
|
87
87
|
email:
|
88
88
|
- florian.feldhaus@gmail.com
|
89
89
|
- piotr.kasprzak@gwdg.de
|
90
|
-
-
|
90
|
+
- parak@cesnet.cz
|
91
91
|
executables: []
|
92
92
|
extensions: []
|
93
93
|
extra_rdoc_files: []
|
@@ -227,7 +227,7 @@ files:
|
|
227
227
|
- spec/occi/parser/text_spec.rb
|
228
228
|
- spec/occi/parser_spec.rb
|
229
229
|
- spec/spec_helper.rb
|
230
|
-
homepage: https://github.com/
|
230
|
+
homepage: https://github.com/EGI-FCTF/rOCCI-core
|
231
231
|
licenses:
|
232
232
|
- Apache License, Version 2.0
|
233
233
|
metadata: {}
|