restfully 0.8.4 → 0.8.5

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.
@@ -134,6 +134,8 @@ module Restfully
134
134
 
135
135
  def dump_object(object, parent)
136
136
  case object
137
+ when XML::Node
138
+ parent << object
137
139
  when Restfully::Resource
138
140
  dump_object({"href" => object.uri.to_s}, parent)
139
141
  when Hash
@@ -1,3 +1,3 @@
1
1
  module Restfully
2
- VERSION = "0.8.4"
2
+ VERSION = "0.8.5"
3
3
  end
@@ -157,6 +157,15 @@ describe Restfully::MediaType::ApplicationVndBonfireXml do
157
157
  serialized.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<compute xmlns=\"http://api.bonfire-project.eu/doc/schemas/occi\">\n <startup href=\"file:///path/to/startup-script/sh\"/>\n <name>Compute name</name>\n <instance_type>small</instance_type>\n <link id=\"0\" href=\"/locations/fr-inria\" rel=\"location\" type=\"application/vnd.bonfire+xml\"/>\n <link id=\"1\" href=\"/locations/uk-epcc/computes/1\" rel=\"self\"/>\n <context>\n <bonfire_credentials>crohr:p4ssw0rd</bonfire_credentials>\n <monitoring_ip>123.123.123.2</monitoring_ip>\n </context>\n <nic id=\"0\">\n <device>eth0</device>\n <mac>AA:AA:AA:AA</mac>\n <network href=\"/locations/fr-inria/networks/1\"/>\n <ip>123.123.123.123</ip>\n </nic>\n <nic id=\"1\">\n <device>eth1</device>\n <mac>BB:BB:BB:BB</mac>\n <network href=\"/locations/fr-inria/networks/2\"/>\n <ip>123.123.124.2</ip>\n </nic>\n <description>Compute description</description>\n <disk id=\"0\">\n <type>OS</type>\n <storage href=\"/locations/fr-inria/storages/1\"/>\n <target>sda</target>\n </disk>\n <disk id=\"1\">\n <type>CDROM</type>\n <storage href=\"/locations/fr-inria/storages/2\"/>\n <target>sdc</target>\n </disk>\n <state>ACTIVE</state>\n</compute>\n"
158
158
  end
159
159
 
160
+ it "should correctly deal with XML::Node elements" do
161
+ serialized = Restfully::MediaType::ApplicationVndBonfireXml.serialize({
162
+ :context => {
163
+ 'metrics' => XML::Node.new_cdata('<metric>hello,world</metric>')
164
+ }
165
+ }, :serialization => {"__type__" => "compute"})
166
+ serialized.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<compute xmlns=\"http://api.bonfire-project.eu/doc/schemas/occi\">\n <context>\n <metrics><![CDATA[<metric>hello,world</metric>]]></metrics>\n </context>\n</compute>\n"
167
+ end
168
+
160
169
  it "should correctly deal with SAVE_AS elements" do
161
170
  serialized = Restfully::MediaType::ApplicationVndBonfireXml.serialize(
162
171
  {
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restfully
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 4
10
- version: 0.8.4
9
+ - 5
10
+ version: 0.8.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cyril Rohr
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-15 00:00:00 +02:00
18
+ date: 2011-06-17 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency