restfulie 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/lib/restfulie/client/atom_media_type.rb +19 -2
- data/lib/restfulie/client/base.rb +36 -31
- data/lib/restfulie/client/cache.rb +103 -0
- data/lib/restfulie/client/entry_point.rb +19 -2
- data/lib/restfulie/client/extensions/http.rb +116 -0
- data/lib/restfulie/client/helper.rb +17 -0
- data/lib/restfulie/client/instance.rb +138 -114
- data/lib/restfulie/client/request_execution.rb +255 -65
- data/lib/restfulie/client/state.rb +18 -1
- data/lib/restfulie/client.rb +29 -4
- data/lib/restfulie/logger.rb +13 -0
- data/lib/restfulie/media_type.rb +25 -6
- data/lib/restfulie/media_type_control.rb +40 -1
- data/lib/restfulie/media_type_defaults.rb +19 -2
- data/lib/restfulie/server/atom_media_type.rb +18 -5
- data/lib/restfulie/server/base.rb +18 -1
- data/lib/restfulie/server/controller.rb +73 -20
- data/lib/restfulie/server/instance.rb +96 -44
- data/lib/restfulie/server/marshalling.rb +16 -0
- data/lib/restfulie/server/opensearch/description.rb +54 -0
- data/lib/restfulie/server/opensearch.rb +18 -0
- data/lib/restfulie/server/restfulie_controller.rb +44 -1
- data/lib/restfulie/server/transition.rb +32 -1
- data/lib/restfulie/unmarshalling.rb +84 -42
- data/lib/restfulie.rb +27 -2
- data/lib/vendor/jeokkarak/hashi.rb +23 -19
- data/lib/vendor/jeokkarak/jeokkarak.rb +16 -0
- metadata +18 -4
@@ -11,30 +11,34 @@ module Hashi
|
|
11
11
|
|
12
12
|
class CustomHash
|
13
13
|
|
14
|
-
attr_reader :
|
15
|
-
|
16
|
-
def initialize(
|
17
|
-
@
|
14
|
+
attr_reader :internal_hash
|
15
|
+
|
16
|
+
def initialize(hash = {})
|
17
|
+
@internal_hash = hash
|
18
18
|
end
|
19
19
|
|
20
|
-
def method_missing(name, *args)
|
20
|
+
def method_missing(name, *args, &block)
|
21
21
|
name = name.to_s if name.kind_of? Symbol
|
22
22
|
if name[-1,1] == "?"
|
23
|
-
parse(name, @
|
23
|
+
parse(name, @internal_hash[name.chop])
|
24
24
|
elsif name[-1,1] == "="
|
25
|
-
@
|
25
|
+
@internal_hash[name.chop] = args[0]
|
26
|
+
elsif @internal_hash.kind_of?(Array) && name == "each"
|
27
|
+
@internal_hash.each do |k| block.call(transform(k)) end
|
28
|
+
elsif name.respond_to? name
|
29
|
+
@internal_hash.send(name, *args, &block)
|
26
30
|
else
|
27
|
-
return nil if @
|
28
|
-
parse(name, transform(@
|
31
|
+
return nil if @internal_hash.has_key?(name) && @internal_hash[name].nil?
|
32
|
+
parse(name, transform(@internal_hash[name]))
|
29
33
|
end
|
30
34
|
end
|
31
35
|
|
32
36
|
def respond_to?(symbol)
|
33
|
-
super
|
37
|
+
super(symbol) || @internal_hash.key?(symbol.to_s)
|
34
38
|
end
|
35
39
|
|
36
40
|
def [](x)
|
37
|
-
transform(@
|
41
|
+
transform(@internal_hash[x])
|
38
42
|
end
|
39
43
|
|
40
44
|
private
|
@@ -43,19 +47,19 @@ module Hashi
|
|
43
47
|
value
|
44
48
|
end
|
45
49
|
|
46
|
-
def parse(name,
|
47
|
-
raise Hashi::UndefinedMethod.new("undefined method '#{name}'") if
|
48
|
-
|
50
|
+
def parse(name, value)
|
51
|
+
raise Hashi::UndefinedMethod.new("undefined method '#{name}'") if value.nil?
|
52
|
+
value
|
49
53
|
end
|
50
54
|
|
51
55
|
end
|
52
56
|
|
53
|
-
def self.from_hash(
|
54
|
-
CustomHash.new(
|
57
|
+
def self.from_hash(hash)
|
58
|
+
CustomHash.new(hash)
|
55
59
|
end
|
56
60
|
|
57
|
-
def self.to_object(
|
58
|
-
CustomHash.new(
|
61
|
+
def self.to_object(hash)
|
62
|
+
CustomHash.new(hash)
|
59
63
|
end
|
60
64
|
|
61
|
-
end
|
65
|
+
end
|
@@ -1,3 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2009 Caelum - www.caelum.com.br/opensource
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
1
17
|
require 'vendor/jeokkarak/hashi'
|
2
18
|
|
3
19
|
module Jeokkarak
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restfulie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Silveira, Caue Guerra
|
@@ -9,10 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-26 00:00:00 -02:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ratom
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.6.3
|
24
|
+
version:
|
16
25
|
description:
|
17
26
|
email: guilherme.silveira@caelum.com.br
|
18
27
|
executables: []
|
@@ -24,12 +33,15 @@ extra_rdoc_files: []
|
|
24
33
|
files:
|
25
34
|
- lib/restfulie/client/atom_media_type.rb
|
26
35
|
- lib/restfulie/client/base.rb
|
36
|
+
- lib/restfulie/client/cache.rb
|
27
37
|
- lib/restfulie/client/entry_point.rb
|
38
|
+
- lib/restfulie/client/extensions/http.rb
|
28
39
|
- lib/restfulie/client/helper.rb
|
29
40
|
- lib/restfulie/client/instance.rb
|
30
41
|
- lib/restfulie/client/request_execution.rb
|
31
42
|
- lib/restfulie/client/state.rb
|
32
43
|
- lib/restfulie/client.rb
|
44
|
+
- lib/restfulie/logger.rb
|
33
45
|
- lib/restfulie/media_type.rb
|
34
46
|
- lib/restfulie/media_type_control.rb
|
35
47
|
- lib/restfulie/media_type_defaults.rb
|
@@ -38,6 +50,8 @@ files:
|
|
38
50
|
- lib/restfulie/server/controller.rb
|
39
51
|
- lib/restfulie/server/instance.rb
|
40
52
|
- lib/restfulie/server/marshalling.rb
|
53
|
+
- lib/restfulie/server/opensearch/description.rb
|
54
|
+
- lib/restfulie/server/opensearch.rb
|
41
55
|
- lib/restfulie/server/restfulie_controller.rb
|
42
56
|
- lib/restfulie/server/transition.rb
|
43
57
|
- lib/restfulie/unmarshalling.rb
|