restfulie 0.7.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/Gemfile +21 -0
  2. data/README.textile +10 -9
  3. data/Rakefile +12 -5
  4. data/lib/restfulie/client/base.rb +10 -6
  5. data/lib/restfulie/client/http/adapter.rb +48 -33
  6. data/lib/restfulie/client/http/atom_ext.rb +3 -68
  7. data/lib/restfulie/client/http/core_ext/http.rb +19 -0
  8. data/lib/restfulie/client/http/core_ext.rb +6 -0
  9. data/lib/restfulie/client/http/error.rb +3 -6
  10. data/lib/restfulie/client/http/marshal.rb +35 -49
  11. data/lib/restfulie/client/http/xml_ext.rb +7 -0
  12. data/lib/restfulie/client/http.rb +2 -2
  13. data/lib/restfulie/client/mikyung/concatenator.rb +15 -0
  14. data/lib/restfulie/client/mikyung/core.rb +44 -0
  15. data/lib/restfulie/client/mikyung/languages.rb +29 -0
  16. data/lib/restfulie/client/mikyung/rest_process_model.rb +114 -0
  17. data/lib/restfulie/client/mikyung/steady_state_walker.rb +32 -0
  18. data/lib/restfulie/client/mikyung/then_condition.rb +33 -0
  19. data/lib/restfulie/client/mikyung/when_condition.rb +53 -0
  20. data/lib/restfulie/client/mikyung.rb +19 -0
  21. data/lib/restfulie/client.rb +1 -0
  22. data/lib/restfulie/common/converter/atom/builder.rb +109 -0
  23. data/lib/restfulie/common/converter/atom/helpers.rb +9 -0
  24. data/lib/restfulie/common/converter/atom.rb +87 -0
  25. data/lib/restfulie/common/converter/values.rb +29 -0
  26. data/lib/restfulie/common/converter.rb +11 -0
  27. data/lib/restfulie/common/core_ext/proc.rb +48 -0
  28. data/lib/restfulie/common/core_ext.rb +5 -0
  29. data/lib/restfulie/common/errors.rb +6 -0
  30. data/lib/restfulie/common/representation/atom/atom.rng +597 -0
  31. data/lib/restfulie/common/representation/atom/base.rb +375 -0
  32. data/lib/restfulie/common/representation/atom/entry.rb +107 -0
  33. data/lib/restfulie/common/representation/atom/feed.rb +106 -0
  34. data/lib/restfulie/common/representation/atom.rb +43 -33
  35. data/lib/restfulie/common/representation/json.rb +1 -2
  36. data/lib/restfulie/common/representation/xml.rb +209 -23
  37. data/lib/restfulie/common/representation.rb +0 -1
  38. data/lib/restfulie/common.rb +2 -3
  39. data/lib/restfulie/server/action_controller/base.rb +21 -2
  40. data/lib/restfulie/server/action_controller/params_parser.rb +16 -16
  41. data/lib/restfulie/server/action_controller/restful_responder.rb +3 -3
  42. data/lib/restfulie/server/action_controller/routing/patch.rb +6 -0
  43. data/lib/restfulie/server/action_view/helpers.rb +8 -8
  44. data/lib/restfulie/server/action_view/template_handlers/tokamak.rb +3 -2
  45. data/lib/restfulie/server/core_ext/array.rb +13 -12
  46. metadata +51 -34
  47. data/lib/restfulie/client/http/link.rb +0 -39
  48. data/lib/restfulie/client/http/xml.rb +0 -4
  49. data/lib/restfulie/common/builder/builder_base.rb +0 -73
  50. data/lib/restfulie/common/builder/helpers.rb +0 -22
  51. data/lib/restfulie/common/builder/marshalling/atom.rb +0 -197
  52. data/lib/restfulie/common/builder/marshalling/base.rb +0 -12
  53. data/lib/restfulie/common/builder/marshalling/json.rb +0 -2
  54. data/lib/restfulie/common/builder/marshalling/xml.rb +0 -183
  55. data/lib/restfulie/common/builder/marshalling.rb +0 -16
  56. data/lib/restfulie/common/builder/rules/collection_rule.rb +0 -10
  57. data/lib/restfulie/common/builder/rules/custom_attributes.rb +0 -24
  58. data/lib/restfulie/common/builder/rules/link.rb +0 -20
  59. data/lib/restfulie/common/builder/rules/links.rb +0 -9
  60. data/lib/restfulie/common/builder/rules/member_rule.rb +0 -8
  61. data/lib/restfulie/common/builder/rules/namespace.rb +0 -35
  62. data/lib/restfulie/common/builder/rules/rules_base.rb +0 -77
  63. data/lib/restfulie/common/builder.rb +0 -17
  64. data/lib/vendor/atom/configuration.rb +0 -24
  65. data/lib/vendor/atom/pub.rb +0 -250
  66. data/lib/vendor/atom/xml/parser.rb +0 -373
  67. data/lib/vendor/atom.rb +0 -771
@@ -1,19 +1,12 @@
1
+ module Restfulie::Common::Converter
2
+ end
3
+ module Restfulie::Common::Converter::Xml
4
+ end
5
+
1
6
  class Hash
2
7
  def links(*args)
3
8
  links = fetch("link", [])
4
- links = [links] unless links.kind_of? Array
5
- links = [] unless links
6
- links = links.map do |l|
7
- Restfulie::Client::Link.new(l)
8
- end
9
- if args.empty?
10
- links
11
- else
12
- found = links.find do |link|
13
- link.rel == args[0].to_s
14
- end
15
- found
16
- end
9
+ Restfulie::Common::Converter::Xml::Links.new(links)
17
10
  end
18
11
  def method_missing(sym, *args)
19
12
  self[sym.to_s].nil? ? super(sym, args) : self[sym.to_s]
@@ -23,27 +16,220 @@ class Hash
23
16
  end
24
17
  end
25
18
 
26
- module Restfulie::Common::Representation
19
+ class Restfulie::Common::Converter::Xml::Links
27
20
 
28
- # Implements the interface for marshal Xml media type requests (application/xml)
29
- class XmlD
30
- cattr_reader :media_type_name
21
+ def initialize(links)
22
+ links = [links] unless links.kind_of? Array
23
+ links = [] unless links
24
+ @links = links.map do |l|
25
+ link = Restfulie::Common::Converter::Xml::Link.new(l)
26
+ link.instance_eval { self.class.send :include, ::Restfulie::Client::HTTP::LinkRequestBuilder }
27
+ link
28
+ end
29
+ end
30
+
31
+ def method_missing(sym, *args)
32
+ @links.find do |link|
33
+ link.rel == sym.to_s
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ class Restfulie::Common::Converter::Xml::Link
40
+
41
+ def initialize(options = {})
42
+ @options = options
43
+ end
44
+ def href
45
+ @options["href"]
46
+ end
47
+ def rel
48
+ @options["rel"]
49
+ end
50
+ def content_type
51
+ @options["type"]
52
+ end
53
+ def type
54
+ content_type
55
+ end
56
+ end
57
+
58
+ # Implements the interface for marshal Xml media type requests (application/xml)
59
+ module Restfulie::Common::Converter::Xml
60
+
61
+ mattr_reader :media_type_name
31
62
  @@media_type_name = 'application/xml'
32
63
 
33
- cattr_reader :headers
64
+ mattr_reader :headers
34
65
  @@headers = {
35
66
  :post => { 'Content-Type' => media_type_name }
36
67
  }
37
68
 
38
- def unmarshal(string)
39
- Hash.from_xml(string).values.first
69
+ def self.marshal(entity, options = {})
70
+ to_xml(entity, options)
40
71
  end
41
72
 
42
- def marshal(entity, rel)
43
- return entity if entity.kind_of? String
44
- entity.to_xml
73
+ def self.unmarshal(string)
74
+ Hash.from_xml string
45
75
  end
46
76
 
77
+ mattr_reader :recipes
78
+ @@recipes = {}
79
+
80
+ def self.describe_recipe(recipe_name, options={}, &block)
81
+ raise 'Undefined recipe' unless block_given?
82
+ raise 'Undefined recipe_name' unless recipe_name
83
+ @@recipes[recipe_name] = block
84
+ end
85
+
86
+ def self.to_xml(obj, options = {}, &block)
87
+ return obj if obj.kind_of?(String)
88
+
89
+ if block_given?
90
+ recipe = block
91
+ elsif options[:recipe]
92
+ recipe = @@recipes[options[:recipe]]
93
+ else
94
+ return obj.values.first.to_xml(:root => obj.keys.first) if obj.kind_of?(Hash) && obj.size==1
95
+ return obj.to_xml
96
+ end
97
+
98
+ # Create representation and proxy
99
+ builder = Builder.new(obj)
100
+
101
+ # Check recipe arity size before calling it
102
+ recipe.call(*[builder, obj, options][0,recipe.arity])
103
+ builder.doc.to_xml
104
+ end
105
+
106
+ def self.helper
107
+ Restfulie::Common::Converter::Xml::Helpers
108
+ end
109
+
110
+ end
111
+ class Restfulie::Common::Converter::Xml::Builder
112
+ attr_reader :doc
113
+ def initialize(obj, options = {})
114
+ @doc = Nokogiri::XML::Document.new
115
+ @obj = obj
116
+ if options[:root]
117
+ root = options[:root]
118
+ else
119
+ root = root_element_for(obj)
120
+ end
121
+ @parent = @doc.create_element(root)
122
+ @parent.parent = @doc
123
+ end
124
+
125
+ def values(options = nil, &block)
126
+ options.each do |key,value|
127
+ attr = key.to_s
128
+ if attr =~ /^xmlns(:\w+)?$/
129
+ ns = attr.split(":", 2)[1]
130
+ @parent.add_namespace_definition(ns, value)
131
+ end
132
+ end if options
133
+
134
+ yield Restfulie::Common::Converter::Components::Values.new(self)
135
+ end
136
+
137
+ def insert_value(name, prefix, *args, &block)
138
+ node = create_element(name.to_s, prefix, *args)
139
+ node.parent = @parent
140
+
141
+ if block_given?
142
+ @parent = node
143
+ block.call
144
+ @parent = node.parent
145
+ end
146
+ end
147
+
148
+ def link(relationship, uri, options = {})
149
+ options["rel"] = relationship.to_s
150
+ options["href"] = uri
151
+ options["type"] ||= "application/xml"
152
+ insert_value("link", nil, options)
153
+ end
154
+
155
+ def members(a_collection = nil, &block)
156
+ collection = a_collection || @obj
157
+ raise Restfulie::Common::Error::BuilderError("Members method require a collection to execute") unless collection.respond_to?(:each)
158
+ collection.each do |member|
159
+ entry = @doc.create_element(root_element_for(member))
160
+ entry.parent = @parent
161
+ @parent = entry
162
+ block.call(self, member)
163
+ @parent = entry.parent
164
+ end
47
165
  end
166
+
167
+ private
48
168
 
169
+ def root_element_for(obj)
170
+ if obj.kind_of?(Hash) && obj.size==1
171
+ obj.keys.first.to_s
172
+ elsif obj.kind_of?(Array) && !obj.empty?
173
+ root_element_for(obj.first).underscore.pluralize
174
+ else
175
+ obj.class.to_s.underscore
176
+ end
177
+ end
178
+
179
+ def create_element(node, prefix, *args)
180
+ node = @doc.create_element(node) do |n|
181
+ if prefix
182
+ if namespace = prefix_valid?(prefix)
183
+ # Adding namespace prefix
184
+ n.namespace = namespace
185
+ namespace = nil
186
+ end
187
+ end
188
+
189
+ args.each do |arg|
190
+ case arg
191
+ # Adding XML attributes
192
+ when Hash
193
+ arg.each { |k,v|
194
+ key = k.to_s
195
+ if key =~ /^xmlns(:\w+)?$/
196
+ ns_name = key.split(":", 2)[1]
197
+ n.add_namespace_definition(ns_name, v)
198
+ next
199
+ end
200
+ n[k.to_s] = v.to_s
201
+ }
202
+ # Adding XML node content
203
+ else
204
+ arg.kind_of?(Time) || arg.kind_of?(DateTime) ? content = arg.xmlschema : content = arg
205
+ n.content = content
206
+ end
207
+ end
208
+ end
209
+ end
210
+
211
+ def prefix_valid?(prefix)
212
+ ns = @parent.namespace_definitions.find { |x| x.prefix == prefix.to_s }
213
+
214
+ unless ns
215
+ @parent.ancestors.each do |a|
216
+ next if a == @doc
217
+ ns = a.namespace_definitions.find { |x| x.prefix == prefix.to_s }
218
+ break if ns
219
+ end
220
+ end
221
+
222
+ return ns
223
+ end
224
+
225
+ end
226
+
227
+ module Restfulie::Common::Converter::Xml::Helpers
228
+ def collection(obj, *args, &block)
229
+ Restfulie::Common::Converter::Xml.to_xml(obj, {}, &block)
230
+ end
231
+
232
+ def member(obj, *args, &block)
233
+ Restfulie::Common::Converter::Xml.to_xml(obj, {}, &block)
234
+ end
49
235
  end
@@ -9,4 +9,3 @@ module Restfulie::Common::Representation; end
9
9
  ).each do |file|
10
10
  require File.join(File.dirname(__FILE__), 'representation', file)
11
11
  end
12
-
@@ -5,8 +5,6 @@ require 'rubygems'
5
5
  require 'active_support'
6
6
  require 'action_controller'
7
7
 
8
- require 'vendor/atom'
9
-
10
8
  module Restfulie
11
9
  module Common; end
12
10
  end
@@ -14,8 +12,9 @@ end
14
12
  %w(
15
13
  errors
16
14
  logger
17
- builder
15
+ core_ext
18
16
  representation
17
+ converter
19
18
  ).each do |file|
20
19
  require "restfulie/common/#{file}"
21
20
  end
@@ -8,8 +8,27 @@ module Restfulie
8
8
  # Sets a default responder for this controller.
9
9
  # Needs to require responder_legacy.rb
10
10
  base.responder = Restfulie::Server::ActionController::RestfulResponder
11
+ base.extend(Restfulie::Server::ActionController::Base::ClassMethods)
11
12
  # Atom representation is added by default
12
- ParamsParser.register('application/atom+xml', Restfulie::Common::Representation::Atom)
13
+ ParamsParser.register('application/atom+xml', Restfulie::Common::Converter::Atom)
14
+ end
15
+
16
+ module ClassMethods
17
+ def call(env)
18
+ if include_restfulie? && env.has_key?("action_controller.restfulie.response")
19
+ if logger && logger.info?
20
+ information = "Status: #{env["action_controller.restfulie.response"][0]} "
21
+ information << ::ActionController::StatusCodes::STATUS_CODES[env["action_controller.restfulie.response"][0]]
22
+ logger.info(information)
23
+ end
24
+ return env["action_controller.restfulie.response"]
25
+ end
26
+ super
27
+ end
28
+
29
+ def include_restfulie?
30
+ defined?(Restfulie::Server::ActionController::Base) && controller_class_name.constantize.include?(Restfulie::Server::ActionController::Base)
31
+ end
13
32
  end
14
33
 
15
34
  protected
@@ -17,7 +36,7 @@ module Restfulie
17
36
  # If your controller inherits from Restfulie::Server::Controller::Base,
18
37
  # it will have an :atom option, very similar to render :xml
19
38
  def render(options = {}, extra_options = {}, &block)
20
- if atom = options[:atom]
39
+ if options && atom = options[:atom]
21
40
  response.content_type ||= Mime::ATOM
22
41
  render_for_text(atom.respond_to?(:to_atom) ? atom.to_atom.to_xml : atom.to_xml, options[:status])
23
42
  else
@@ -42,21 +42,21 @@ end
42
42
  # extensions are handled by the Rack stack
43
43
  #
44
44
  # TODO Change this when porting this code to Rails 3
45
- #::ActionController::ParamsParser.class_eval do
46
- #def call(env)
47
- #begin
48
- #if params = parse_formatted_parameters(env)
49
- #env["action_controller.request.request_parameters"] = params
50
- #else
51
- #if env["CONTENT_LENGTH"] && (env["CONTENT_LENGTH"] != "0")
52
- #return [415, {'Content-Type' => 'text/html'}, "<html><body><h1>415 Unsupported Media Type</h1></body></html>"]
53
- #end
54
- #end
55
- #rescue
56
- #return [400, {'Content-Type' => 'text/html'}, "<html><body><h1>400 Bad Request</h1></body></html>"]
57
- #end
45
+ ::ActionController::ParamsParser.class_eval do
46
+ def call(env)
47
+ begin
48
+ if params = parse_formatted_parameters(env)
49
+ env["action_controller.request.request_parameters"] = params
50
+ elsif !(env["CONTENT_TYPE"] == "application/x-www-form-urlencoded") #do not override rails default behaviour for this media type, it's dangerous... (o.O)
51
+ if env["CONTENT_LENGTH"] && (env["CONTENT_LENGTH"] != "0")
52
+ env["action_controller.restfulie.response"] = [415, {'Content-Type' => 'text/html'}, ["<html><body><h1>415 Unsupported Media Type</h1></body></html>"]]
53
+ end
54
+ end
55
+ rescue
56
+ env["action_controller.restfulie.response"] = [400, {'Content-Type' => 'text/html'}, ["<html><body><h1>400 Bad Request</h1></body></html>"]]
57
+ end
58
58
 
59
- #@app.call(env)
60
- #end
61
- #end
59
+ @app.call(env)
60
+ end
61
+ end
62
62
 
@@ -29,11 +29,11 @@ module Restfulie::Server::ActionController
29
29
  end
30
30
 
31
31
  def set_public_cache_control!
32
- cache_control = response.headers["Cache-Control"].split(",").map {|k| k.strip }
32
+ cache_control = controller.response.headers["Cache-Control"].split(",").map {|k| k.strip }
33
33
  cache_control.delete("private")
34
34
  cache_control.delete("no-cache")
35
35
  cache_control << "public"
36
- response.headers["Cache-Control"] = cache_control.join(', ')
36
+ controller.response.headers["Cache-Control"] = cache_control.join(', ')
37
37
  end
38
38
  end
39
- end
39
+ end
@@ -0,0 +1,6 @@
1
+ module ActionController::Routing
2
+ HTTP_METHODS = [:get, :head, :post, :put, :delete, :options, :patch]
3
+ end
4
+
5
+ ActionController::Request::HTTP_METHODS << "patch"
6
+ ActionController::Request::HTTP_METHOD_LOOKUP["PATCH"] = :patch
@@ -5,7 +5,7 @@ module Restfulie::Server::ActionView::Helpers
5
5
  #
6
6
  # Passing the current context to partial in template:
7
7
  #
8
- # describe_member(@album) do |member, album|
8
+ # member(@album) do |member, album|
9
9
  # partial('member', binding)
10
10
  # end
11
11
  #
@@ -14,12 +14,12 @@ module Restfulie::Server::ActionView::Helpers
14
14
  # member.links << link(:rel => :artists, :href => album_artists_url(album))
15
15
  #
16
16
  # Or passing local variables assing
17
- #
18
- # descirbe_collection(@albums) do |collection|
19
- # collection.describe_members do |member, album|
20
- # partial('member', :locals => {:member => member, :album => album})
21
- # end
22
- # end
17
+ #
18
+ # collection(@albums) do |collection|
19
+ # collection.members do |member, album|
20
+ # partial("member", :locals => {:member => member, :album => album})
21
+ # end
22
+ # end
23
23
  #
24
24
  def partial(partial_path, caller_binding = nil)
25
25
  template = _pick_partial_template(partial_path)
@@ -27,7 +27,7 @@ module Restfulie::Server::ActionView::Helpers
27
27
  # Create a context to assing variables
28
28
  if caller_binding.kind_of?(Hash)
29
29
  Proc.new do
30
- extend Restfulie::Common::Builder::Helpers
30
+ extend @restfulie_type_helpers
31
31
  context = eval("(class << self; self; end)", binding)
32
32
 
33
33
  unless caller_binding[:locals].nil?
@@ -4,11 +4,12 @@ module Restfulie::Server::ActionView::TemplateHandlers
4
4
  include ActionView::TemplateHandlers::Compilable
5
5
 
6
6
  def compile(template)
7
- "extend Restfulie::Common::Builder::Helpers; " +
7
+ "@restfulie_type_helpers = Restfulie::Client::HTTP::RequestMarshaller.content_type_for(self.response.content_type).helper; " +
8
+ "extend @restfulie_type_helpers; " +
8
9
  "extend Restfulie::Server::ActionView::Helpers; " +
9
10
  "code_block = lambda { #{template.source} };" +
10
11
  "builder = code_block.call; " +
11
- "builder.send \"to_\#{self.response.content_type}\" "
12
+ "builder.to_s"
12
13
  end
13
14
  end
14
15
  end
@@ -9,20 +9,21 @@ class Array
9
9
  options[:skip_attributes] = true
10
10
  end
11
11
 
12
- Atom::Feed.new do |feed|
13
- # TODO: Define better feed attributes
14
- # Array#to_s can return a very long string
15
- feed.title = "Collection of #{map {|i| i.class.name }.uniq.to_sentence}"
16
- # TODO: this id does not comply with Rest standards yet
17
- feed.id = hash
18
- feed.updated = updated_at
12
+ feed = Restfulie::Common::Representation::Atom::Feed.new
13
+ # TODO: Define better feed attributes
14
+ # Array#to_s can return a very long string
15
+ feed.title = "Collection of #{map {|i| i.class.name }.uniq.to_sentence}"
16
+ feed.updated = updated_at
17
+ # TODO: this id does not comply with Rest standards yet
18
+ feed.id = hash
19
19
 
20
- each do |element|
21
- feed.entries << element.to_atom(options)
22
- end
23
-
24
- yield feed if block_given?
20
+ each do |element|
21
+ feed.entries << element.to_atom(options)
25
22
  end
23
+
24
+ yield feed if block_given?
25
+
26
+ feed
26
27
  end
27
28
 
28
29
  # Return max update date for items in collection, for it uses the updated_at of items.
metadata CHANGED
@@ -4,23 +4,37 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 7
8
- - 2
9
- version: 0.7.2
7
+ - 8
8
+ - 0
9
+ version: 0.8.0
10
10
  platform: ruby
11
11
  authors:
12
- - Guilherme Silveira, Caue Guerra
12
+ - "Guilherme Silveira, Caue Guerra, Luis Cipriani, \xC3\x89verton Ribeiro, George Guimar\xC3\xA3es, Paulo Ahagon"
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-19 00:00:00 -03:00
17
+ date: 2010-05-27 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: actionpack
21
+ name: nokogiri
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 4
30
+ - 2
31
+ version: 1.4.2
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: actionpack
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
24
38
  requirements:
25
39
  - - ">="
26
40
  - !ruby/object:Gem::Version
@@ -30,11 +44,11 @@ dependencies:
30
44
  - 2
31
45
  version: 2.3.2
32
46
  type: :runtime
33
- version_requirements: *id001
47
+ version_requirements: *id002
34
48
  - !ruby/object:Gem::Dependency
35
49
  name: activesupport
36
50
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
51
+ requirement: &id003 !ruby/object:Gem::Requirement
38
52
  requirements:
39
53
  - - ">="
40
54
  - !ruby/object:Gem::Version
@@ -44,11 +58,11 @@ dependencies:
44
58
  - 2
45
59
  version: 2.3.2
46
60
  type: :runtime
47
- version_requirements: *id002
61
+ version_requirements: *id003
48
62
  - !ruby/object:Gem::Dependency
49
63
  name: responders_backport
50
64
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
65
+ requirement: &id004 !ruby/object:Gem::Requirement
52
66
  requirements:
53
67
  - - ~>
54
68
  - !ruby/object:Gem::Version
@@ -58,11 +72,11 @@ dependencies:
58
72
  - 0
59
73
  version: 0.1.0
60
74
  type: :runtime
61
- version_requirements: *id003
75
+ version_requirements: *id004
62
76
  - !ruby/object:Gem::Dependency
63
77
  name: json_pure
64
78
  prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
79
+ requirement: &id005 !ruby/object:Gem::Requirement
66
80
  requirements:
67
81
  - - ">="
68
82
  - !ruby/object:Gem::Version
@@ -72,7 +86,7 @@ dependencies:
72
86
  - 4
73
87
  version: 1.2.4
74
88
  type: :runtime
75
- version_requirements: *id004
89
+ version_requirements: *id005
76
90
  description:
77
91
  email: guilherme.silveira@caelum.com.br
78
92
  executables: []
@@ -87,29 +101,33 @@ files:
87
101
  - lib/restfulie/client/http/adapter.rb
88
102
  - lib/restfulie/client/http/atom_ext.rb
89
103
  - lib/restfulie/client/http/cache.rb
104
+ - lib/restfulie/client/http/core_ext/http.rb
105
+ - lib/restfulie/client/http/core_ext.rb
90
106
  - lib/restfulie/client/http/error.rb
91
- - lib/restfulie/client/http/link.rb
92
107
  - lib/restfulie/client/http/marshal.rb
93
- - lib/restfulie/client/http/xml.rb
108
+ - lib/restfulie/client/http/xml_ext.rb
94
109
  - lib/restfulie/client/http.rb
110
+ - lib/restfulie/client/mikyung/concatenator.rb
111
+ - lib/restfulie/client/mikyung/core.rb
112
+ - lib/restfulie/client/mikyung/languages.rb
113
+ - lib/restfulie/client/mikyung/rest_process_model.rb
114
+ - lib/restfulie/client/mikyung/steady_state_walker.rb
115
+ - lib/restfulie/client/mikyung/then_condition.rb
116
+ - lib/restfulie/client/mikyung/when_condition.rb
117
+ - lib/restfulie/client/mikyung.rb
95
118
  - lib/restfulie/client.rb
96
- - lib/restfulie/common/builder/builder_base.rb
97
- - lib/restfulie/common/builder/helpers.rb
98
- - lib/restfulie/common/builder/marshalling/atom.rb
99
- - lib/restfulie/common/builder/marshalling/base.rb
100
- - lib/restfulie/common/builder/marshalling/json.rb
101
- - lib/restfulie/common/builder/marshalling/xml.rb
102
- - lib/restfulie/common/builder/marshalling.rb
103
- - lib/restfulie/common/builder/rules/collection_rule.rb
104
- - lib/restfulie/common/builder/rules/custom_attributes.rb
105
- - lib/restfulie/common/builder/rules/link.rb
106
- - lib/restfulie/common/builder/rules/links.rb
107
- - lib/restfulie/common/builder/rules/member_rule.rb
108
- - lib/restfulie/common/builder/rules/namespace.rb
109
- - lib/restfulie/common/builder/rules/rules_base.rb
110
- - lib/restfulie/common/builder.rb
119
+ - lib/restfulie/common/converter/atom/builder.rb
120
+ - lib/restfulie/common/converter/atom/helpers.rb
121
+ - lib/restfulie/common/converter/atom.rb
122
+ - lib/restfulie/common/converter/values.rb
123
+ - lib/restfulie/common/converter.rb
124
+ - lib/restfulie/common/core_ext/proc.rb
125
+ - lib/restfulie/common/core_ext.rb
111
126
  - lib/restfulie/common/errors.rb
112
127
  - lib/restfulie/common/logger.rb
128
+ - lib/restfulie/common/representation/atom/base.rb
129
+ - lib/restfulie/common/representation/atom/entry.rb
130
+ - lib/restfulie/common/representation/atom/feed.rb
113
131
  - lib/restfulie/common/representation/atom.rb
114
132
  - lib/restfulie/common/representation/generic.rb
115
133
  - lib/restfulie/common/representation/json.rb
@@ -119,6 +137,7 @@ files:
119
137
  - lib/restfulie/server/action_controller/base.rb
120
138
  - lib/restfulie/server/action_controller/params_parser.rb
121
139
  - lib/restfulie/server/action_controller/restful_responder.rb
140
+ - lib/restfulie/server/action_controller/routing/patch.rb
122
141
  - lib/restfulie/server/action_controller/routing/restful_route.rb
123
142
  - lib/restfulie/server/action_controller/routing.rb
124
143
  - lib/restfulie/server/action_controller.rb
@@ -132,13 +151,11 @@ files:
132
151
  - lib/restfulie/server/restfulie_controller.rb
133
152
  - lib/restfulie/server.rb
134
153
  - lib/restfulie.rb
135
- - lib/vendor/atom/configuration.rb
136
- - lib/vendor/atom/pub.rb
137
- - lib/vendor/atom/xml/parser.rb
138
- - lib/vendor/atom.rb
154
+ - Gemfile
139
155
  - LICENSE
140
156
  - Rakefile
141
157
  - README.textile
158
+ - lib/restfulie/common/representation/atom/atom.rng
142
159
  has_rdoc: true
143
160
  homepage: http://restfulie.caelumobjects.com
144
161
  licenses: []
@@ -1,39 +0,0 @@
1
- module Restfulie::Client
2
-
3
- # Offer easy access to link relationships, such as <tt>post.next</tt> for
4
- # <tt>&lt;link rel="next" href="http://resource.entrypoint.com/post/12" type="application/atom+xml" /&gt;</tt> relationships.
5
- module LinkShortcut
6
- def method_missing(method_sym,*args)#:nodoc:
7
- selected_links = links.select{ |l| l.rel == method_sym.to_s }
8
- super if selected_links.empty?
9
- link = (selected_links.size == 1) ? selected_links.first : selected_links
10
-
11
- return link unless link.instance_variable_defined?(:@type)
12
- link.accepts(link.type)
13
-
14
- representation = Restfulie::Client::HTTP::RequestMarshaller.content_type_for(link.type)
15
- return representation.prepare_link_for(link) if representation
16
- link
17
-
18
- end
19
- end
20
-
21
- class Link
22
-
23
- include Restfulie::Client::HTTP::LinkRequestBuilder
24
-
25
- def initialize(options = {})
26
- @options = options
27
- end
28
- def href
29
- @options["href"]
30
- end
31
- def rel
32
- @options["rel"]
33
- end
34
- def content_type
35
- @options["type"]
36
- end
37
- end
38
-
39
- end
@@ -1,4 +0,0 @@
1
- ::Hash.instance_eval {
2
- include Restfulie::Client::LinkShortcut
3
- }
4
-