restfulie 0.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/Gemfile +28 -0
  2. data/Gemfile.lock +128 -0
  3. data/LICENSE +17 -0
  4. data/README.textile +138 -0
  5. data/Rakefile +146 -0
  6. data/lib/restfulie/client/base.rb +36 -0
  7. data/lib/restfulie/client/cache/basic.rb +76 -0
  8. data/lib/restfulie/client/cache/fake.rb +15 -0
  9. data/lib/restfulie/client/cache/http_ext.rb +123 -0
  10. data/lib/restfulie/client/cache/restrictions.rb +13 -0
  11. data/lib/restfulie/client/cache.rb +11 -0
  12. data/lib/restfulie/client/configuration.rb +67 -0
  13. data/lib/restfulie/client/dsl.rb +66 -0
  14. data/lib/restfulie/client/entry_point.rb +61 -0
  15. data/lib/restfulie/client/ext/atom_ext.rb +14 -0
  16. data/lib/restfulie/client/ext/http_ext.rb +22 -0
  17. data/lib/restfulie/client/ext/json_ext.rb +16 -0
  18. data/lib/restfulie/client/feature/base.rb +75 -0
  19. data/lib/restfulie/client/feature/base_request.rb +35 -0
  20. data/lib/restfulie/client/feature/cache.rb +16 -0
  21. data/lib/restfulie/client/feature/enhance_response.rb +12 -0
  22. data/lib/restfulie/client/feature/follow_request.rb +41 -0
  23. data/lib/restfulie/client/feature/history.rb +26 -0
  24. data/lib/restfulie/client/feature/history_request.rb +19 -0
  25. data/lib/restfulie/client/feature/open_search/pattern_matcher.rb +25 -0
  26. data/lib/restfulie/client/feature/open_search.rb +21 -0
  27. data/lib/restfulie/client/feature/serialize_body.rb +32 -0
  28. data/lib/restfulie/client/feature/setup_header.rb +22 -0
  29. data/lib/restfulie/client/feature/throw_error.rb +41 -0
  30. data/lib/restfulie/client/feature/verb.rb +119 -0
  31. data/lib/restfulie/client/feature.rb +5 -0
  32. data/lib/restfulie/client/http/cache.rb +28 -0
  33. data/lib/restfulie/client/http/error.rb +77 -0
  34. data/lib/restfulie/client/http/response_holder.rb +29 -0
  35. data/lib/restfulie/client/http.rb +7 -0
  36. data/lib/restfulie/client/master_delegator.rb +31 -0
  37. data/lib/restfulie/client/mikyung/concatenator.rb +18 -0
  38. data/lib/restfulie/client/mikyung/core.rb +70 -0
  39. data/lib/restfulie/client/mikyung/languages/german.rb +24 -0
  40. data/lib/restfulie/client/mikyung/languages/portuguese.rb +23 -0
  41. data/lib/restfulie/client/mikyung/languages.rb +11 -0
  42. data/lib/restfulie/client/mikyung/rest_process_model.rb +191 -0
  43. data/lib/restfulie/client/mikyung/steady_state_walker.rb +38 -0
  44. data/lib/restfulie/client/mikyung/then_condition.rb +39 -0
  45. data/lib/restfulie/client/mikyung/when_condition.rb +57 -0
  46. data/lib/restfulie/client/mikyung.rb +15 -0
  47. data/lib/restfulie/client.rb +26 -0
  48. data/lib/restfulie/common/converter/atom/base.rb +91 -0
  49. data/lib/restfulie/common/converter/atom/builder.rb +111 -0
  50. data/lib/restfulie/common/converter/atom/helpers.rb +17 -0
  51. data/lib/restfulie/common/converter/atom.rb +12 -0
  52. data/lib/restfulie/common/converter/json/base.rb +87 -0
  53. data/lib/restfulie/common/converter/json/builder.rb +102 -0
  54. data/lib/restfulie/common/converter/json/helpers.rb +17 -0
  55. data/lib/restfulie/common/converter/json.rb +12 -0
  56. data/lib/restfulie/common/converter/open_search/descriptor.rb +32 -0
  57. data/lib/restfulie/common/converter/open_search.rb +16 -0
  58. data/lib/restfulie/common/converter/values.rb +33 -0
  59. data/lib/restfulie/common/converter/xml/base.rb +63 -0
  60. data/lib/restfulie/common/converter/xml/builder.rb +113 -0
  61. data/lib/restfulie/common/converter/xml/helpers.rb +17 -0
  62. data/lib/restfulie/common/converter/xml/link.rb +30 -0
  63. data/lib/restfulie/common/converter/xml/links.rb +21 -0
  64. data/lib/restfulie/common/converter/xml.rb +14 -0
  65. data/lib/restfulie/common/converter.rb +43 -0
  66. data/lib/restfulie/common/core_ext/hash.rb +18 -0
  67. data/lib/restfulie/common/core_ext.rb +1 -0
  68. data/lib/restfulie/common/error.rb +19 -0
  69. data/lib/restfulie/common/links.rb +9 -0
  70. data/lib/restfulie/common/logger.rb +19 -0
  71. data/lib/restfulie/common/representation/atom/atom.rng +597 -0
  72. data/lib/restfulie/common/representation/atom/base.rb +142 -0
  73. data/lib/restfulie/common/representation/atom/category.rb +41 -0
  74. data/lib/restfulie/common/representation/atom/entry.rb +59 -0
  75. data/lib/restfulie/common/representation/atom/factory.rb +43 -0
  76. data/lib/restfulie/common/representation/atom/feed.rb +110 -0
  77. data/lib/restfulie/common/representation/atom/link.rb +68 -0
  78. data/lib/restfulie/common/representation/atom/person.rb +48 -0
  79. data/lib/restfulie/common/representation/atom/source.rb +59 -0
  80. data/lib/restfulie/common/representation/atom/tag_collection.rb +38 -0
  81. data/lib/restfulie/common/representation/atom/xml.rb +90 -0
  82. data/lib/restfulie/common/representation/atom.rb +20 -0
  83. data/lib/restfulie/common/representation/generic.rb +22 -0
  84. data/lib/restfulie/common/representation/json/base.rb +27 -0
  85. data/lib/restfulie/common/representation/json/keys_as_methods.rb +74 -0
  86. data/lib/restfulie/common/representation/json/link.rb +29 -0
  87. data/lib/restfulie/common/representation/json/link_collection.rb +23 -0
  88. data/lib/restfulie/common/representation/json.rb +13 -0
  89. data/lib/restfulie/common/representation/links.rb +11 -0
  90. data/lib/restfulie/common/representation.rb +3 -0
  91. data/lib/restfulie/common.rb +18 -0
  92. data/lib/restfulie/server/action_controller/base.rb +48 -0
  93. data/lib/restfulie/server/action_controller/params_parser.rb +100 -0
  94. data/lib/restfulie/server/action_controller/patch.rb +6 -0
  95. data/lib/restfulie/server/action_controller/restful_responder.rb +12 -0
  96. data/lib/restfulie/server/action_controller/trait/cacheable.rb +81 -0
  97. data/lib/restfulie/server/action_controller/trait/created.rb +17 -0
  98. data/lib/restfulie/server/action_controller/trait.rb +9 -0
  99. data/lib/restfulie/server/action_controller.rb +11 -0
  100. data/lib/restfulie/server/action_view/helpers.rb +50 -0
  101. data/lib/restfulie/server/action_view/template_handlers/tokamak.rb +21 -0
  102. data/lib/restfulie/server/action_view/template_handlers.rb +30 -0
  103. data/lib/restfulie/server/action_view.rb +10 -0
  104. data/lib/restfulie/server/configuration.rb +24 -0
  105. data/lib/restfulie/server/controller.rb +74 -0
  106. data/lib/restfulie/server/core_ext/array.rb +61 -0
  107. data/lib/restfulie/server/core_ext.rb +1 -0
  108. data/lib/restfulie/server.rb +25 -0
  109. data/lib/restfulie/version.rb +14 -0
  110. data/lib/restfulie.rb +34 -0
  111. metadata +242 -0
@@ -0,0 +1,102 @@
1
+ module Restfulie
2
+ module Common
3
+ module Converter
4
+ module Json
5
+ class Builder
6
+ def initialize(obj, initial_obj = {})
7
+ @doc = initial_obj
8
+ @obj = obj
9
+ @current = @doc
10
+ end
11
+
12
+ def values(options = nil, &block)
13
+ yield Values.new(self)
14
+ end
15
+
16
+ def members(options = {}, &block)
17
+ collection = options[:collection] || @obj
18
+ raise Error::BuilderError.new("Members method require a collection to execute") unless collection.respond_to?(:each)
19
+ root = options[:root] || Restfulie::Common::Converter.root_element_for(collection)
20
+
21
+ collection.each do |member|
22
+ node = {}
23
+
24
+ parent = @current
25
+ @current = node
26
+ block.call(self, member)
27
+ @current = parent
28
+
29
+ add_to_current(root, node)
30
+ end
31
+ end
32
+
33
+ def link(relationship, uri, options = {})
34
+ options["rel"] = relationship.to_s
35
+ options["href"] = uri
36
+ options["type"] ||= "application/json"
37
+ insert_value("link", nil, options)
38
+ end
39
+
40
+ def insert_value(name, prefix, *args, &block)
41
+ node = create_element(block_given?, *args)
42
+
43
+ if block_given?
44
+ parent = @current
45
+ @current = node
46
+ block.call
47
+ @current = parent
48
+ end
49
+
50
+ add_to_current(name, node)
51
+ end
52
+
53
+ def representation
54
+ Representation::Json.create(@doc).to_json
55
+ end
56
+
57
+ private
58
+
59
+ def create_element(has_block, *args)
60
+ vals = []
61
+ hashes = []
62
+
63
+ args.each do |arg|
64
+ arg.kind_of?(Hash) ? hashes << arg : vals << arg
65
+ end
66
+
67
+ if hashes.empty?
68
+ # only simple values
69
+ unless vals.empty?
70
+ vals = vals.first if vals.size == 1
71
+ node = has_block ? {} : vals
72
+ else
73
+ node = has_block ? {} : nil
74
+ end
75
+ else
76
+ # yes we have hashes
77
+ node = {}
78
+ hashes.each { |hash| node.merge!(hash) }
79
+ unless vals.empty?
80
+ vals = vals.first if vals.size == 1
81
+ node = has_block ? {} : [node, vals]
82
+ end
83
+ node
84
+ end
85
+ end
86
+
87
+ def add_to_current(name, value)
88
+ if @current[name]
89
+ if @current[name].kind_of?(Array)
90
+ @current[name] << value
91
+ else
92
+ @current[name] = [@current[name], value]
93
+ end
94
+ else
95
+ @current[name] = value
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,17 @@
1
+ module Restfulie
2
+ module Common
3
+ module Converter
4
+ module Json
5
+ module Helpers
6
+ def collection(obj, *args, &block)
7
+ Restfulie::Common::Converter::Json.to_json(obj, &block)
8
+ end
9
+
10
+ def member(obj, *args, &block)
11
+ Restfulie::Common::Converter::Json.to_json(obj, &block)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ module Restfulie
2
+ module Common
3
+ module Converter
4
+ module Json
5
+ autoload :Base, 'restfulie/common/converter/json/base'
6
+ autoload :Builder, 'restfulie/common/converter/json/builder'
7
+ autoload :Helpers, 'restfulie/common/converter/json/helpers'
8
+ extend Base::ClassMethods
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,32 @@
1
+ class Restfulie::Common::Converter::OpenSearch::Descriptor
2
+
3
+ def initialize(hash)
4
+ @hash = hash["OpenSearchDescription"]
5
+ end
6
+
7
+ def urls
8
+ uris = @hash["Url"]
9
+ uris.kind_of?(Array) ? uris : [uris]
10
+ end
11
+
12
+ def use(content_type)
13
+ uri = urls.find do |url|
14
+ url["type"]==content_type
15
+ end
16
+ return nil if uri.nil?
17
+
18
+ base_uri, params_pattern = extract_uri(uri)
19
+ Restfulie.at(base_uri).accepts(content_type).open_search.with_pattern(params_pattern)
20
+ end
21
+
22
+ private
23
+ def extract_uri(uri)
24
+ uri = uri["template"]
25
+ interrogation = uri.index("?")
26
+ params = uri[interrogation+1..uri.size]
27
+ base_uri = uri[0..interrogation-1]
28
+ [base_uri, params]
29
+ end
30
+
31
+ end
32
+
@@ -0,0 +1,16 @@
1
+ module Restfulie
2
+ module Common
3
+ class Converter::OpenSearch#:nodoc:
4
+ autoload :Descriptor, 'restfulie/common/converter/open_search/descriptor'
5
+ end
6
+ end
7
+ end
8
+
9
+ class Restfulie::Common::Converter::OpenSearch
10
+
11
+ def self.unmarshal(xml)
12
+ hash = Hash.from_xml(xml)
13
+ descriptor = Descriptor.new(hash)
14
+ end
15
+
16
+ end
@@ -0,0 +1,33 @@
1
+ module Restfulie
2
+ module Common
3
+ module Converter
4
+ # This is a Blank Slate class to support the renderization of the values block for Resource Representation Interfaces
5
+ # Every Media type should implement a Builder with a insert_value method that renders the values block to a specific format
6
+ class Values
7
+ attr_accessor :builder
8
+
9
+ # BlankSlate
10
+ instance_methods.each do |m|
11
+ undef_method m unless m.to_s =~ /\[\]|method_missing|respond_to\?|^__/
12
+ end
13
+
14
+ def initialize(builder)
15
+ @builder = builder
16
+ @current_prefix = nil
17
+ end
18
+
19
+ def [](prefix)
20
+ @current_prefix = prefix
21
+ self
22
+ end
23
+
24
+ def method_missing(symbol, *args, &block)
25
+ name = symbol.to_s
26
+ prefix = @current_prefix
27
+ @current_prefix = nil
28
+ @builder.insert_value(name, prefix, *args, &block)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,63 @@
1
+ require 'active_support/core_ext/hash/conversions'
2
+
3
+ module Restfulie
4
+ module Common
5
+ module Converter
6
+ module Xml
7
+ module Base
8
+ module ClassMethods
9
+ mattr_reader :media_type_name
10
+ @@media_type_name = 'application/xml'
11
+
12
+ mattr_reader :headers
13
+ @@headers = {
14
+ :post => { 'Content-Type' => media_type_name }
15
+ }
16
+
17
+ def marshal(entity, options = {})
18
+ to_xml(entity, options)
19
+ end
20
+
21
+ def unmarshal(string)
22
+ Hash.from_xml string
23
+ end
24
+
25
+ mattr_reader :recipes
26
+ @@recipes = {}
27
+
28
+ def describe_recipe(recipe_name, options={}, &block)
29
+ raise 'Undefined recipe' unless block_given?
30
+ raise 'Undefined recipe_name' unless recipe_name
31
+ @@recipes[recipe_name] = block
32
+ end
33
+
34
+ def to_xml(obj, options = {}, &block)
35
+ return obj if obj.kind_of?(String)
36
+
37
+ if block_given?
38
+ recipe = block
39
+ elsif options[:recipe]
40
+ recipe = @@recipes[options[:recipe]]
41
+ elsif obj.kind_of?(Hash) && obj.size==1
42
+ return obj.values.first.to_xml(:root => obj.keys.first)
43
+ else
44
+ return obj.to_xml
45
+ end
46
+
47
+ # Create representation and proxy
48
+ builder = Builder.new(obj, options)
49
+
50
+ # Check recipe arity size before calling it
51
+ recipe.call(*[builder, obj, options][0,recipe.arity])
52
+ builder.doc.to_xml
53
+ end
54
+
55
+ def helper
56
+ Helpers
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,113 @@
1
+ module Restfulie
2
+ module Common
3
+ module Converter
4
+ module Xml
5
+ # Implements the interface for marshal Xml media type requests (application/xml)
6
+ class Builder
7
+ attr_reader :doc
8
+ def initialize(obj, options = {})
9
+ @doc = Nokogiri::XML::Document.new
10
+ @obj = obj
11
+ root = options[:root] || Restfulie::Common::Converter.root_element_for(obj)
12
+ @parent = @doc.create_element(root)
13
+ @parent.parent = @doc
14
+ end
15
+
16
+ def values(options = {}, &block)
17
+ options.each do |key,value|
18
+ attr = key.to_s
19
+ if attr =~ /^xmlns(:\w+)?$/
20
+ ns = attr.split(":", 2)[1]
21
+ @parent.add_namespace_definition(ns, value)
22
+ end
23
+ end
24
+ yield Values.new(self)
25
+ end
26
+
27
+ def insert_value(name, prefix, *args, &block)
28
+ node = create_element(name.to_s, prefix, *args)
29
+ node.parent = @parent
30
+
31
+ if block_given?
32
+ @parent = node
33
+ block.call
34
+ @parent = node.parent
35
+ end
36
+ end
37
+
38
+ def link(relationship, uri, options = {})
39
+ options["rel"] = relationship.to_s
40
+ options["href"] = uri
41
+ options["type"] ||= "application/xml"
42
+ insert_value("link", nil, options)
43
+ end
44
+
45
+ def members(a_collection = nil, options = {}, &block)
46
+ collection = a_collection || @obj
47
+ raise Error::BuilderError("Members method require a collection to execute") unless collection.respond_to?(:each)
48
+ collection.each do |member|
49
+ root = options[:root] || Restfulie::Common::Converter.root_element_for(member)
50
+ entry = @doc.create_element(root)
51
+ entry.parent = @parent
52
+ @parent = entry
53
+ block.call(self, member)
54
+ @parent = entry.parent
55
+ end
56
+ end
57
+
58
+ private
59
+
60
+ def create_element(node, prefix, *args)
61
+ node = @doc.create_element(node) do |n|
62
+ if prefix
63
+ if namespace = prefix_valid?(prefix)
64
+ # Adding namespace prefix
65
+ n.namespace = namespace
66
+ namespace = nil
67
+ end
68
+ end
69
+
70
+ args.each do |arg|
71
+ case arg
72
+ # Adding XML attributes
73
+ when Hash
74
+ arg.each { |k,v|
75
+ key = k.to_s
76
+ if key =~ /^xmlns(:\w+)?$/
77
+ ns_name = key.split(":", 2)[1]
78
+ n.add_namespace_definition(ns_name, v)
79
+ next
80
+ end
81
+ n[k.to_s] = v.to_s
82
+ }
83
+ # Adding XML node content
84
+ else
85
+ content = if arg.kind_of?(Time) || arg.kind_of?(DateTime)
86
+ arg.xmlschema
87
+ else
88
+ arg
89
+ end
90
+ n.content = content
91
+ end
92
+ end
93
+ end
94
+ end
95
+
96
+ def prefix_valid?(prefix)
97
+ ns = @parent.namespace_definitions.find { |x| x.prefix == prefix.to_s }
98
+
99
+ unless ns
100
+ @parent.ancestors.each do |a|
101
+ next if a == @doc
102
+ ns = a.namespace_definitions.find { |x| x.prefix == prefix.to_s }
103
+ break if ns
104
+ end
105
+ end
106
+
107
+ return ns
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,17 @@
1
+ module Restfulie
2
+ module Common
3
+ module Converter
4
+ module Xml
5
+ module Helpers
6
+ def collection(obj, opts = {}, &block)
7
+ Xml.to_xml(obj, opts, &block)
8
+ end
9
+
10
+ def member(obj, opts = {}, &block)
11
+ Xml.to_xml(obj, opts, &block)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,30 @@
1
+ module Restfulie
2
+ module Common
3
+ module Converter
4
+ module Xml
5
+ class Link
6
+ def initialize(options = {})
7
+ @options = options
8
+ end
9
+ def href
10
+ @options["href"]
11
+ end
12
+ def rel
13
+ @options["rel"]
14
+ end
15
+ def content_type
16
+ @options["type"]
17
+ end
18
+ def type
19
+ content_type
20
+ end
21
+ def follow
22
+ r = Restfulie.at(href)
23
+ r = r.as(content_type) if content_type
24
+ r
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,21 @@
1
+ module Restfulie
2
+ module Common
3
+ module Converter
4
+ module Xml
5
+ class Links
6
+ def initialize(links)
7
+ links = [links] unless links.kind_of? Array
8
+ links = [] unless links
9
+ @links = links.map { |l| Restfulie::Common::Converter::Xml::Link.new(l) }
10
+ end
11
+
12
+ def method_missing(sym, *args)
13
+ @links.find do |link|
14
+ link.rel == sym.to_s
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,14 @@
1
+ module Restfulie
2
+ module Common
3
+ module Converter
4
+ module Xml
5
+ autoload :Base, 'restfulie/common/converter/xml/base'
6
+ autoload :Builder, 'restfulie/common/converter/xml/builder'
7
+ autoload :Helpers, 'restfulie/common/converter/xml/helpers'
8
+ autoload :Links, 'restfulie/common/converter/xml/links'
9
+ autoload :Link, 'restfulie/common/converter/xml/link'
10
+ extend Base::ClassMethods
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,43 @@
1
+ module Restfulie
2
+ module Common
3
+ module Converter
4
+ Dir["#{File.dirname(__FILE__)}/converter/*.rb"].each {|f| autoload File.basename(f)[0..-4].camelize.to_sym, f }
5
+
6
+ # Returns the default root element name for an item or collection
7
+ def self.root_element_for(obj)
8
+ if obj.kind_of?(Hash) && obj.size==1
9
+ obj.keys.first.to_s
10
+ elsif obj.kind_of?(Array) && !obj.empty?
11
+ root_element_for(obj.first).to_s.underscore.pluralize
12
+ else
13
+ obj.class.to_s.underscore
14
+ end
15
+ end
16
+
17
+ def self.register(media_type,representation)
18
+ representations[media_type] = representation
19
+ end
20
+
21
+ def self.content_type_for(media_type)
22
+ return nil unless media_type
23
+ content_type = media_type.split(';')[0] # [/(.*?);/, 1]
24
+ representations[content_type]
25
+ end
26
+
27
+ private
28
+
29
+ def self.representations
30
+ @representations ||= {}
31
+ end
32
+
33
+ register 'application/atom+xml' , ::Restfulie::Common::Converter::Atom
34
+ register 'application/xml' , ::Restfulie::Common::Converter::Xml
35
+ register 'text/xml' , ::Restfulie::Common::Converter::Xml
36
+ register 'application/json' , ::Restfulie::Common::Converter::Json
37
+ register 'application/opensearchdescription+xml' , ::Restfulie::Common::Converter::OpenSearch
38
+
39
+
40
+ end
41
+ end
42
+ end
43
+
@@ -0,0 +1,18 @@
1
+ class Hash
2
+
3
+ def links(*args)
4
+ links = fetch("link", [])
5
+ Restfulie::Common::Converter::Xml::Links.new(links)
6
+ end
7
+
8
+ include Restfulie::Common::Links
9
+
10
+ def method_missing(sym, *args)
11
+ self[sym.to_s].nil? ? super(sym, args) : self[sym.to_s]
12
+ end
13
+
14
+ def respond_to?(sym)
15
+ include?(sym.to_s) || super(sym)
16
+ end
17
+
18
+ end
@@ -0,0 +1 @@
1
+ require 'restfulie/common/core_ext/hash'
@@ -0,0 +1,19 @@
1
+ module Restfulie
2
+ module Common
3
+ module Error
4
+ class RestfulieError < StandardError; end
5
+ class MarshallingError < RestfulieError; end
6
+ class UndefinedMarshallingError < MarshallingError; end
7
+
8
+ # Atom marshallinh error
9
+ class AtomMarshallingError < MarshallingError; end
10
+ class NameSpaceError < AtomMarshallingError; end
11
+
12
+ # Converter
13
+ class ConverterError < RestfulieError; end
14
+
15
+ # builder
16
+ class BuilderError < RestfulieError; end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ module Restfulie
2
+ module Common
3
+ module Links
4
+ def refresh
5
+ links.self.follow.get
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ module Restfulie
2
+ module Common
3
+ class Logger
4
+ # Configure the logger used by Restfulie
5
+ #
6
+ # The logger defaults to ActiveSupport::BufferedLogger.new(STDOUT)
7
+ def self.logger
8
+ @@logger
9
+ end
10
+
11
+ def self.logger=(value)
12
+ @@logger = value
13
+ end
14
+
15
+ @@logger = ActiveSupport::BufferedLogger.new(STDOUT)
16
+ @@logger.level = ::Logger::DEBUG
17
+ end
18
+ end
19
+ end