restfulie 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,30 +11,34 @@ module Hashi
11
11
 
12
12
  class CustomHash
13
13
 
14
- attr_reader :hash
15
-
16
- def initialize(h = {})
17
- @hash = h
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, @hash[name.chop])
23
+ parse(name, @internal_hash[name.chop])
24
24
  elsif name[-1,1] == "="
25
- @hash[name.chop] = args[0]
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 @hash.has_key?(name) && @hash[name].nil?
28
- parse(name, transform(@hash[name]))
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.respond_to?(symbol) || @hash.key?(symbol.to_s)
37
+ super(symbol) || @internal_hash.key?(symbol.to_s)
34
38
  end
35
39
 
36
40
  def [](x)
37
- transform(@hash[x])
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, val)
47
- raise Hashi::UndefinedMethod.new("undefined method '#{name}'") if val.nil?
48
- val
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(h)
54
- CustomHash.new(h)
57
+ def self.from_hash(hash)
58
+ CustomHash.new(hash)
55
59
  end
56
60
 
57
- def self.to_object(h)
58
- CustomHash.new(h)
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.5.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-06 00:00:00 -02:00
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