restfulie 0.1.0.beta1 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +87 -99
- data/Rakefile +14 -109
- data/lib/restfulie.rb +183 -23
- metadata +12 -197
- data/Gemfile +0 -28
- data/Gemfile.lock +0 -128
- data/LICENSE +0 -17
- data/lib/restfulie/client.rb +0 -26
- data/lib/restfulie/client/base.rb +0 -36
- data/lib/restfulie/client/cache.rb +0 -11
- data/lib/restfulie/client/cache/basic.rb +0 -76
- data/lib/restfulie/client/cache/fake.rb +0 -15
- data/lib/restfulie/client/cache/http_ext.rb +0 -123
- data/lib/restfulie/client/cache/restrictions.rb +0 -13
- data/lib/restfulie/client/configuration.rb +0 -67
- data/lib/restfulie/client/dsl.rb +0 -66
- data/lib/restfulie/client/entry_point.rb +0 -61
- data/lib/restfulie/client/ext/atom_ext.rb +0 -14
- data/lib/restfulie/client/ext/http_ext.rb +0 -22
- data/lib/restfulie/client/ext/json_ext.rb +0 -16
- data/lib/restfulie/client/feature.rb +0 -5
- data/lib/restfulie/client/feature/base.rb +0 -75
- data/lib/restfulie/client/feature/base_request.rb +0 -35
- data/lib/restfulie/client/feature/cache.rb +0 -16
- data/lib/restfulie/client/feature/enhance_response.rb +0 -12
- data/lib/restfulie/client/feature/follow_request.rb +0 -41
- data/lib/restfulie/client/feature/history.rb +0 -26
- data/lib/restfulie/client/feature/history_request.rb +0 -19
- data/lib/restfulie/client/feature/open_search.rb +0 -21
- data/lib/restfulie/client/feature/open_search/pattern_matcher.rb +0 -25
- data/lib/restfulie/client/feature/serialize_body.rb +0 -32
- data/lib/restfulie/client/feature/setup_header.rb +0 -22
- data/lib/restfulie/client/feature/throw_error.rb +0 -41
- data/lib/restfulie/client/feature/verb.rb +0 -119
- data/lib/restfulie/client/http.rb +0 -7
- data/lib/restfulie/client/http/cache.rb +0 -28
- data/lib/restfulie/client/http/error.rb +0 -77
- data/lib/restfulie/client/http/response_holder.rb +0 -29
- data/lib/restfulie/client/master_delegator.rb +0 -31
- data/lib/restfulie/client/mikyung.rb +0 -15
- data/lib/restfulie/client/mikyung/concatenator.rb +0 -18
- data/lib/restfulie/client/mikyung/core.rb +0 -70
- data/lib/restfulie/client/mikyung/languages.rb +0 -11
- data/lib/restfulie/client/mikyung/languages/german.rb +0 -24
- data/lib/restfulie/client/mikyung/languages/portuguese.rb +0 -23
- data/lib/restfulie/client/mikyung/rest_process_model.rb +0 -191
- data/lib/restfulie/client/mikyung/steady_state_walker.rb +0 -38
- data/lib/restfulie/client/mikyung/then_condition.rb +0 -39
- data/lib/restfulie/client/mikyung/when_condition.rb +0 -57
- data/lib/restfulie/common.rb +0 -18
- data/lib/restfulie/common/converter.rb +0 -43
- data/lib/restfulie/common/converter/atom.rb +0 -12
- data/lib/restfulie/common/converter/atom/base.rb +0 -91
- data/lib/restfulie/common/converter/atom/builder.rb +0 -111
- data/lib/restfulie/common/converter/atom/helpers.rb +0 -17
- data/lib/restfulie/common/converter/json.rb +0 -12
- data/lib/restfulie/common/converter/json/base.rb +0 -87
- data/lib/restfulie/common/converter/json/builder.rb +0 -102
- data/lib/restfulie/common/converter/json/helpers.rb +0 -17
- data/lib/restfulie/common/converter/open_search.rb +0 -16
- data/lib/restfulie/common/converter/open_search/descriptor.rb +0 -32
- data/lib/restfulie/common/converter/values.rb +0 -33
- data/lib/restfulie/common/converter/xml.rb +0 -14
- data/lib/restfulie/common/converter/xml/base.rb +0 -63
- data/lib/restfulie/common/converter/xml/builder.rb +0 -113
- data/lib/restfulie/common/converter/xml/helpers.rb +0 -17
- data/lib/restfulie/common/converter/xml/link.rb +0 -30
- data/lib/restfulie/common/converter/xml/links.rb +0 -21
- data/lib/restfulie/common/core_ext.rb +0 -1
- data/lib/restfulie/common/core_ext/hash.rb +0 -18
- data/lib/restfulie/common/error.rb +0 -19
- data/lib/restfulie/common/links.rb +0 -9
- data/lib/restfulie/common/logger.rb +0 -19
- data/lib/restfulie/common/representation.rb +0 -3
- data/lib/restfulie/common/representation/atom.rb +0 -20
- data/lib/restfulie/common/representation/atom/atom.rng +0 -597
- data/lib/restfulie/common/representation/atom/base.rb +0 -142
- data/lib/restfulie/common/representation/atom/category.rb +0 -41
- data/lib/restfulie/common/representation/atom/entry.rb +0 -59
- data/lib/restfulie/common/representation/atom/factory.rb +0 -43
- data/lib/restfulie/common/representation/atom/feed.rb +0 -110
- data/lib/restfulie/common/representation/atom/link.rb +0 -68
- data/lib/restfulie/common/representation/atom/person.rb +0 -48
- data/lib/restfulie/common/representation/atom/source.rb +0 -59
- data/lib/restfulie/common/representation/atom/tag_collection.rb +0 -38
- data/lib/restfulie/common/representation/atom/xml.rb +0 -90
- data/lib/restfulie/common/representation/generic.rb +0 -22
- data/lib/restfulie/common/representation/json.rb +0 -13
- data/lib/restfulie/common/representation/json/base.rb +0 -27
- data/lib/restfulie/common/representation/json/keys_as_methods.rb +0 -74
- data/lib/restfulie/common/representation/json/link.rb +0 -29
- data/lib/restfulie/common/representation/json/link_collection.rb +0 -23
- data/lib/restfulie/common/representation/links.rb +0 -11
- data/lib/restfulie/server.rb +0 -25
- data/lib/restfulie/server/action_controller.rb +0 -11
- data/lib/restfulie/server/action_controller/base.rb +0 -48
- data/lib/restfulie/server/action_controller/params_parser.rb +0 -100
- data/lib/restfulie/server/action_controller/patch.rb +0 -6
- data/lib/restfulie/server/action_controller/restful_responder.rb +0 -12
- data/lib/restfulie/server/action_controller/trait.rb +0 -9
- data/lib/restfulie/server/action_controller/trait/cacheable.rb +0 -81
- data/lib/restfulie/server/action_controller/trait/created.rb +0 -17
- data/lib/restfulie/server/action_view.rb +0 -10
- data/lib/restfulie/server/action_view/helpers.rb +0 -50
- data/lib/restfulie/server/action_view/template_handlers.rb +0 -30
- data/lib/restfulie/server/action_view/template_handlers/tokamak.rb +0 -21
- data/lib/restfulie/server/configuration.rb +0 -24
- data/lib/restfulie/server/controller.rb +0 -74
- data/lib/restfulie/server/core_ext.rb +0 -1
- data/lib/restfulie/server/core_ext/array.rb +0 -61
- data/lib/restfulie/version.rb +0 -14
@@ -1,36 +0,0 @@
|
|
1
|
-
module Restfulie
|
2
|
-
module Client#:nodoc
|
3
|
-
module Base
|
4
|
-
|
5
|
-
def method_missing(sym, *args, &block)
|
6
|
-
if @base_position.respond_to?(sym)
|
7
|
-
@base_position.send sym, *args, &block
|
8
|
-
else
|
9
|
-
super(sym, *args, &block)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.included(base)#:nodoc
|
14
|
-
base.extend(self)
|
15
|
-
end
|
16
|
-
|
17
|
-
def uses_restfulie(configuration = Configuration.new,&block)
|
18
|
-
EntryPoint.configuration_for(resource_name,configuration,&block)
|
19
|
-
configure
|
20
|
-
end
|
21
|
-
|
22
|
-
def configure
|
23
|
-
configuration = EntryPoint.configuration_of(resource_name)
|
24
|
-
raise "Undefined configuration for #{resource_name}" unless configuration
|
25
|
-
@base_position = Restfulie.at(configuration.entry_point)
|
26
|
-
configuration.representations.each do |representation_name,representation|
|
27
|
-
register_representation(representation_name,representation)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def resource_name
|
32
|
-
@resource_name ||= self.class.to_s.to_sym
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
module Restfulie
|
2
|
-
module Client
|
3
|
-
module Cache
|
4
|
-
autoload :Basic, 'restfulie/client/cache/basic'
|
5
|
-
autoload :Fake, 'restfulie/client/cache/fake'
|
6
|
-
autoload :Restrictions, 'restfulie/client/cache/restrictions'
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
require 'restfulie/client/cache/http_ext'
|
11
|
-
|
@@ -1,76 +0,0 @@
|
|
1
|
-
# Basic cache implementation for restfulie.
|
2
|
-
#
|
3
|
-
# It uses the request headers and uri to store it in memory.
|
4
|
-
# This cache might not be optimal for long running clients, which should use a memcached based one.
|
5
|
-
# Use Restfulie::Client.cache_provider to change the provider
|
6
|
-
module Restfulie::Client::Cache
|
7
|
-
class Basic
|
8
|
-
|
9
|
-
def put(key, req, response)
|
10
|
-
if Restfulie::Client::Cache::Restrictions.may_cache?(response)
|
11
|
-
Restfulie::Common::Logger.logger.debug "caching #{key} #{response}"
|
12
|
-
cache_add(key, req, response)
|
13
|
-
end
|
14
|
-
response
|
15
|
-
end
|
16
|
-
|
17
|
-
def get(key, request)
|
18
|
-
|
19
|
-
# debugger
|
20
|
-
response = cache_get(key, request)
|
21
|
-
return nil if response.nil?
|
22
|
-
|
23
|
-
if response.has_expired_cache?
|
24
|
-
remove(key)
|
25
|
-
else
|
26
|
-
Restfulie::Common::Logger.logger.debug "RETURNING cache #{key}"
|
27
|
-
cache_hit response
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
# removes all elements from the cache
|
33
|
-
def clear
|
34
|
-
cache.clear
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
# allows response enhancement when the cache was hit with it
|
40
|
-
def cache_hit(response)
|
41
|
-
response
|
42
|
-
end
|
43
|
-
|
44
|
-
def cache_add(key, req, response)
|
45
|
-
values = (cache.read(key) || []).dup
|
46
|
-
values << [req, response]
|
47
|
-
cache.write(key, values)
|
48
|
-
end
|
49
|
-
|
50
|
-
def cache_get(key, req)
|
51
|
-
return nil unless cache.exist?(key)
|
52
|
-
found = cache.read(key).find do |cached|
|
53
|
-
old_req = cached.first
|
54
|
-
old_response = cached.last
|
55
|
-
|
56
|
-
headers_match = old_response.vary_headers_for(old_req) == old_response.vary_headers_for(req)
|
57
|
-
if headers_match && old_response.verb == req.verb
|
58
|
-
old_response
|
59
|
-
else
|
60
|
-
false
|
61
|
-
end
|
62
|
-
end
|
63
|
-
found ? found.last : nil
|
64
|
-
end
|
65
|
-
|
66
|
-
def remove(key)
|
67
|
-
cache.delete(key)
|
68
|
-
nil
|
69
|
-
end
|
70
|
-
|
71
|
-
def cache
|
72
|
-
Restfulie::Client.cache_store
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# Fake cache that does not cache anything
|
2
|
-
# Use Restfulie::Client.cache_provider = Restfulie::Client::Cache::Fake.new
|
3
|
-
module Restfulie::Client::Cache
|
4
|
-
class Fake
|
5
|
-
def put(url, req, response)
|
6
|
-
response
|
7
|
-
end
|
8
|
-
|
9
|
-
def get(url, req)
|
10
|
-
end
|
11
|
-
|
12
|
-
def clear
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,123 +0,0 @@
|
|
1
|
-
require 'time'
|
2
|
-
|
3
|
-
# an extesion to http responses
|
4
|
-
module Restfulie::Client::HTTP::ResponseStatus
|
5
|
-
|
6
|
-
attr_accessor :previous
|
7
|
-
|
8
|
-
# determines if this response code was successful (according to http specs: 200~299)
|
9
|
-
def is_successful?
|
10
|
-
code.to_i >= 200 && code.to_i <= 299
|
11
|
-
end
|
12
|
-
|
13
|
-
# determines if this response code was successful (according to http specs: 100~199)
|
14
|
-
def is_informational?
|
15
|
-
code.to_i >= 100 && code.to_i <= 199
|
16
|
-
end
|
17
|
-
|
18
|
-
# determines if this response code was successful (according to http specs: 300~399)
|
19
|
-
def is_redirection?
|
20
|
-
code.to_i >= 300 && code.to_i <= 399
|
21
|
-
end
|
22
|
-
|
23
|
-
# determines if this response code was successful (according to http specs: 400~499)
|
24
|
-
def is_client_error?
|
25
|
-
code.to_i >= 400 && code.to_i <= 499
|
26
|
-
end
|
27
|
-
|
28
|
-
# determines if this response code was successful (according to http specs: 500~599)
|
29
|
-
def is_server_error?
|
30
|
-
code.to_i >= 500 && code.to_i <= 599
|
31
|
-
end
|
32
|
-
|
33
|
-
def etag
|
34
|
-
self['Etag']
|
35
|
-
end
|
36
|
-
|
37
|
-
def last_modified
|
38
|
-
self['Last-Modified']
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
module Restfulie::Client::HTTP::ResponseCacheCheck
|
44
|
-
|
45
|
-
def cache_max_age
|
46
|
-
val = header_value_from('cache-control', /^\s*max-age=(\d+)/)
|
47
|
-
if val
|
48
|
-
val.to_i
|
49
|
-
else
|
50
|
-
0
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def header_value_from(header, expression)
|
55
|
-
h = value_for(headers[header], expression)
|
56
|
-
return nil if h.nil?
|
57
|
-
h.match(expression)[1]
|
58
|
-
end
|
59
|
-
|
60
|
-
def has_expired_cache?
|
61
|
-
return true if headers['date'].nil?
|
62
|
-
max_time = Time.rfc2822(headers['date'][0]) + cache_max_age.seconds
|
63
|
-
Time.now > max_time
|
64
|
-
end
|
65
|
-
|
66
|
-
# checks if the header's max-age is available and no no-store if available.
|
67
|
-
def may_cache?
|
68
|
-
may_cache_method? && may_cache_field?(headers['cache-control'])
|
69
|
-
end
|
70
|
-
|
71
|
-
# Returns whether this cache control field allows caching
|
72
|
-
#
|
73
|
-
# may_cache_field(['max-age=2000', 'no-store']) == false
|
74
|
-
# may_cache_field('max-age=2000,no-store') == false
|
75
|
-
# may_cache_field('max-age=2000') == true
|
76
|
-
def may_cache_field?(field)
|
77
|
-
return false if field.nil?
|
78
|
-
|
79
|
-
if field.kind_of? Array
|
80
|
-
field.each do |f|
|
81
|
-
return false if !may_cache_field?(f)
|
82
|
-
end
|
83
|
-
return true
|
84
|
-
end
|
85
|
-
|
86
|
-
max_age_header = value_for(field, /^max-age=(\d+)/)
|
87
|
-
return false if max_age_header.nil?
|
88
|
-
|
89
|
-
return !value_for(field, /^no-store/)
|
90
|
-
end
|
91
|
-
|
92
|
-
# extracts the header value for an specific expression, which can be located at the start or in the middle
|
93
|
-
# of the expression
|
94
|
-
def value_for(value, expression)
|
95
|
-
value = value[0] if value.kind_of? Array
|
96
|
-
value.split(",").find { |obj| obj.strip =~ expression }
|
97
|
-
end
|
98
|
-
|
99
|
-
# extracts all header values related to the Vary header from this response, in order
|
100
|
-
# to implement Vary support from the HTTP Specification
|
101
|
-
#
|
102
|
-
# example
|
103
|
-
# if the response Vary header is 'Accept','Accept-Language', we have
|
104
|
-
# vary_headers_for({'Accept'=>'application/xml', 'Date' =>'...', 'Accept-Language'=>'de'}) == ['application/xml', 'de']
|
105
|
-
# vary_headers_for({'Date' => '...', 'Accept-Language'=>'de'}) == [nil, 'de']
|
106
|
-
def vary_headers_for(request)
|
107
|
-
return nil if headers['vary'].nil?
|
108
|
-
headers['vary'].split(',').map do |key|
|
109
|
-
request[key.strip]
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
private
|
114
|
-
def may_cache_method?
|
115
|
-
verb == :get || verb == :post
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
class Net::HTTPResponse
|
120
|
-
include Restfulie::Client::HTTP::ResponseStatus
|
121
|
-
include Restfulie::Client::HTTP::ResponseCacheCheck
|
122
|
-
|
123
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
module Restfulie
|
2
|
-
module Client #:nodoc:
|
3
|
-
# Use this class to configure the entry point and other relevant behaviors related to accessing or interacting with resources
|
4
|
-
#
|
5
|
-
# The available options are:
|
6
|
-
#
|
7
|
-
# * <tt>:entry_point</tt> - The URI for an entry point, such as http://resource.entrypoint.com/post
|
8
|
-
# * <tt>:representations</tt> - Representations.
|
9
|
-
#
|
10
|
-
# You can also store any other custom configuration.
|
11
|
-
#
|
12
|
-
# ==== Example
|
13
|
-
#
|
14
|
-
# configuration = Configuration.new
|
15
|
-
# configuration[:entry_point] = 'http://resource.entrypoint.com/post'
|
16
|
-
# configuration[:entry_point] # => 'http://resource.entrypoint.com/post'
|
17
|
-
#
|
18
|
-
# or you can use:
|
19
|
-
#
|
20
|
-
# configuration.entry_point = 'http://resource.entrypoint.com/post'
|
21
|
-
# configuration.entry_point # => 'http://resource.entrypoint.com/post'
|
22
|
-
class Configuration < ::Hash
|
23
|
-
# the current environment
|
24
|
-
attr_reader :environment
|
25
|
-
|
26
|
-
@@default_configuration = {
|
27
|
-
:entry_point => '',
|
28
|
-
:representations => {}
|
29
|
-
}
|
30
|
-
|
31
|
-
def initialize
|
32
|
-
super
|
33
|
-
self.environment = :development
|
34
|
-
end
|
35
|
-
|
36
|
-
# this will store a new configuration (based on the default) for the environment passed by value.
|
37
|
-
def environment=(value)
|
38
|
-
@environment = value
|
39
|
-
unless has_key?(@environment)
|
40
|
-
dee_clone = Marshal::load(Marshal::dump(@@default_configuration))
|
41
|
-
store(@environment,dee_clone)
|
42
|
-
end
|
43
|
-
@environment
|
44
|
-
end
|
45
|
-
|
46
|
-
# access (key) configuration value
|
47
|
-
def [](key)
|
48
|
-
fetch(@environment)[key]
|
49
|
-
end
|
50
|
-
|
51
|
-
# store on (key) configuration the value
|
52
|
-
def []=(key,value)
|
53
|
-
fetch(@environment)[key] = value
|
54
|
-
end
|
55
|
-
|
56
|
-
def method_missing(name, *args, &block)
|
57
|
-
method_name = name.to_s
|
58
|
-
if method_name.last == '='
|
59
|
-
fetch(environment)[method_name.chop.to_sym] = args[0]
|
60
|
-
else
|
61
|
-
value = fetch(environment)[name]
|
62
|
-
value ? value : super
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
data/lib/restfulie/client/dsl.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
module Restfulie::Client
|
2
|
-
class Dsl
|
3
|
-
|
4
|
-
def initialize
|
5
|
-
@requests = []
|
6
|
-
trait :base
|
7
|
-
trait :verb
|
8
|
-
request :base_request
|
9
|
-
request :setup_header
|
10
|
-
request :serialize_body
|
11
|
-
request :enhance_response
|
12
|
-
# request :cache
|
13
|
-
request :follow_request
|
14
|
-
end
|
15
|
-
|
16
|
-
def request(what)
|
17
|
-
req = "Restfulie::Client::Feature::#{what.to_s.classify}".constantize
|
18
|
-
@requests << req
|
19
|
-
self
|
20
|
-
end
|
21
|
-
|
22
|
-
def trait(sym)
|
23
|
-
t = "Restfulie::Client::Feature::#{sym.to_s.classify}".constantize
|
24
|
-
self.extend t
|
25
|
-
self
|
26
|
-
end
|
27
|
-
|
28
|
-
def method_missing(sym, *args)
|
29
|
-
if Restfulie::Client::Feature.const_defined? sym.to_s.classify
|
30
|
-
loaded = true
|
31
|
-
trait sym
|
32
|
-
end
|
33
|
-
if Restfulie::Client::Feature.const_defined? "#{sym.to_s.classify}Request"
|
34
|
-
loaded = true
|
35
|
-
request "#{sym.to_s}Request"
|
36
|
-
end
|
37
|
-
if loaded
|
38
|
-
self
|
39
|
-
else
|
40
|
-
super sym, *args
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def request_flow(env = {})
|
45
|
-
Parser.new(@requests).continue(self, nil, env)
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
class Parser
|
51
|
-
|
52
|
-
def initialize(stack)
|
53
|
-
@stack = stack.dup
|
54
|
-
end
|
55
|
-
|
56
|
-
def continue(request, response, env)
|
57
|
-
current = @stack.pop
|
58
|
-
if current.nil?
|
59
|
-
return response
|
60
|
-
end
|
61
|
-
filter = current.new
|
62
|
-
filter.execute(self, request, response, env)
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
|
2
|
-
module Restfulie
|
3
|
-
module Client#:nodoc
|
4
|
-
|
5
|
-
module HTTP::RecipeModule
|
6
|
-
def recipe(converter_sym, options={}, &block)
|
7
|
-
raise 'Undefined block' unless block_given?
|
8
|
-
converter = "Restfulie::Common::Converter::#{converter_sym.to_s.camelize}".constantize
|
9
|
-
converter.describe_recipe(options[:name], &block)
|
10
|
-
end
|
11
|
-
|
12
|
-
@resources_configurations = {}
|
13
|
-
def configuration_of(resource_name)
|
14
|
-
@resources_configurations[resource_name]
|
15
|
-
end
|
16
|
-
|
17
|
-
def configuration_for(resource_name,configuration = Configuration.new)
|
18
|
-
yield configuration if block_given?
|
19
|
-
@resources_configurations[resource_name] = configuration
|
20
|
-
end
|
21
|
-
|
22
|
-
def retrieve(resource_name)
|
23
|
-
returning Object.new do |resource|
|
24
|
-
resource.extend(Base)
|
25
|
-
resource.configure
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class HTTP::Recipe < MasterDelegator
|
31
|
-
|
32
|
-
def initialize(requester)
|
33
|
-
@requester = requester
|
34
|
-
@resources_configurations = {}
|
35
|
-
end
|
36
|
-
|
37
|
-
include Restfulie::Client::HTTP::RecipeModule
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
class EntryPoint
|
42
|
-
|
43
|
-
@resources_configurations = {}
|
44
|
-
extend Restfulie::Client::HTTP::RecipeModule
|
45
|
-
|
46
|
-
def initialize(requester)
|
47
|
-
@requester = requester
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.at(uri)
|
51
|
-
Restfulie.using {
|
52
|
-
recipe
|
53
|
-
follow_link
|
54
|
-
request_marshaller
|
55
|
-
verb_request
|
56
|
-
}.at(uri)
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|