hyperresource 0.2.4 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hyper_resource.rb +79 -136
- data/lib/hyper_resource/adapter/hal_json.rb +14 -33
- data/lib/hyper_resource/attributes.rb +21 -47
- data/lib/hyper_resource/configuration.rb +159 -0
- data/lib/hyper_resource/exceptions.rb +4 -2
- data/lib/hyper_resource/link.rb +91 -50
- data/lib/hyper_resource/links.rb +42 -36
- data/lib/hyper_resource/modules/config_attributes.rb +293 -0
- data/lib/hyper_resource/modules/data_type.rb +98 -0
- data/lib/hyper_resource/modules/deprecations.rb +56 -0
- data/lib/hyper_resource/modules/http.rb +155 -46
- data/lib/hyper_resource/modules/internal_attributes.rb +7 -18
- data/lib/hyper_resource/objects.rb +10 -29
- data/lib/hyper_resource/version.rb +3 -2
- metadata +24 -6
- data/lib/hyper_resource/response.rb +0 -2
@@ -6,34 +6,8 @@ class HyperResource
|
|
6
6
|
self._resource = resource || HyperResource.new
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
## HyperResource classes. Just subclasses, please!
|
12
|
-
def _hr_create_methods!(opts={}) # @private
|
13
|
-
return if self.class.to_s == 'HyperResource::Objects'
|
14
|
-
return if self._resource.class.to_s == 'HyperResource'
|
15
|
-
return if self.class.send(
|
16
|
-
:class_variable_defined?, :@@_hr_created_objects_methods)
|
17
|
-
|
18
|
-
self.keys.each do |attr|
|
19
|
-
attr_sym = attr.to_sym
|
20
|
-
|
21
|
-
self.class.send(:define_method, attr_sym) do
|
22
|
-
self[attr]
|
23
|
-
end
|
24
|
-
|
25
|
-
## Don't stomp on _resource's methods
|
26
|
-
unless _resource.respond_to?(attr_sym)
|
27
|
-
_resource.class.send(:define_method, attr_sym) do
|
28
|
-
objects.send(attr_sym)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
self.class.send(:class_variable_set, :@@_hr_created_objects_methods, true)
|
34
|
-
end
|
35
|
-
|
36
|
-
def []=(attr, value) # @private
|
9
|
+
# @private
|
10
|
+
def []=(attr, value)
|
37
11
|
super(attr.to_s, value)
|
38
12
|
end
|
39
13
|
|
@@ -51,10 +25,17 @@ class HyperResource
|
|
51
25
|
nil
|
52
26
|
end
|
53
27
|
|
54
|
-
|
28
|
+
# @private
|
29
|
+
def method_missing(method, *args)
|
55
30
|
return self[method] if self[method]
|
56
31
|
raise NoMethodError, "undefined method `#{method}' for #{self.inspect}"
|
57
32
|
end
|
58
33
|
|
34
|
+
# @private
|
35
|
+
def respond_to?(method, *args)
|
36
|
+
method = method.to_s
|
37
|
+
return true if self.has_key?(method)
|
38
|
+
super
|
39
|
+
end
|
59
40
|
end
|
60
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyperresource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Gamache
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uri_template
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fuzzyurl
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.2.2
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.2.2
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,18 +132,21 @@ executables: []
|
|
118
132
|
extensions: []
|
119
133
|
extra_rdoc_files: []
|
120
134
|
files:
|
121
|
-
- lib/hyper_resource
|
135
|
+
- lib/hyper_resource.rb
|
122
136
|
- lib/hyper_resource/adapter.rb
|
137
|
+
- lib/hyper_resource/adapter/hal_json.rb
|
123
138
|
- lib/hyper_resource/attributes.rb
|
139
|
+
- lib/hyper_resource/configuration.rb
|
124
140
|
- lib/hyper_resource/exceptions.rb
|
125
141
|
- lib/hyper_resource/link.rb
|
126
142
|
- lib/hyper_resource/links.rb
|
143
|
+
- lib/hyper_resource/modules/config_attributes.rb
|
144
|
+
- lib/hyper_resource/modules/data_type.rb
|
145
|
+
- lib/hyper_resource/modules/deprecations.rb
|
127
146
|
- lib/hyper_resource/modules/http.rb
|
128
147
|
- lib/hyper_resource/modules/internal_attributes.rb
|
129
148
|
- lib/hyper_resource/objects.rb
|
130
|
-
- lib/hyper_resource/response.rb
|
131
149
|
- lib/hyper_resource/version.rb
|
132
|
-
- lib/hyper_resource.rb
|
133
150
|
- lib/hyperresource.rb
|
134
151
|
homepage: https://github.com/gamache/hyperresource
|
135
152
|
licenses:
|
@@ -151,8 +168,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
168
|
version: '0'
|
152
169
|
requirements: []
|
153
170
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.2.0
|
155
172
|
signing_key:
|
156
173
|
specification_version: 4
|
157
174
|
summary: Extensible hypermedia client for Ruby
|
158
175
|
test_files: []
|
176
|
+
has_rdoc: true
|