almodovar 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/almodovar.rb +2 -1
  2. data/lib/to_xml.rb +22 -0
  3. metadata +4 -3
@@ -1,6 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/../vendor/resourceful-0.5.3-patched/lib/resourceful'
2
2
  require 'nokogiri'
3
3
  require 'active_support'
4
+ require 'to_xml'
4
5
  require 'uri'
5
6
 
6
7
  module Almodovar
@@ -106,7 +107,7 @@ module Almodovar
106
107
  end
107
108
 
108
109
  def create(attrs = {})
109
- response = http.resource(@url).post(attrs.to_xml(:root => object_type), :content_type => "application/xml")
110
+ response = http.resource(@url).post(attrs.to_xml(:root => object_type, :convert_links => true), :content_type => "application/xml")
110
111
  Resource.new(nil, @auth, Nokogiri.parse(response.body).root)
111
112
  end
112
113
 
@@ -0,0 +1,22 @@
1
+ module Almodovar
2
+
3
+ module ToXml
4
+
5
+ def to_xml_with_links(options = {})
6
+ if options[:convert_links] && options[:builder]
7
+ options[:builder].tag!(:link, :rel => options[:root]) do
8
+ to_xml_without_links(options)
9
+ end
10
+ else
11
+ to_xml_without_links(options)
12
+ end
13
+ end
14
+
15
+ end
16
+
17
+ end
18
+
19
+ class Array
20
+ include Almodovar::ToXml
21
+ alias_method_chain :to_xml, :links
22
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - BeBanjo S.L.
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-17 00:00:00 +02:00
17
+ date: 2010-05-18 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -119,6 +119,7 @@ files:
119
119
  - vendor/resourceful-0.5.3-patched/spec/spec.opts
120
120
  - vendor/resourceful-0.5.3-patched/spec/spec_helper.rb
121
121
  - lib/almodovar.rb
122
+ - lib/to_xml.rb
122
123
  - README.rdoc
123
124
  has_rdoc: true
124
125
  homepage: http://wiki.github.com/bebanjo/almodovar/