restfully 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
data/lib/restfully/collection.rb
CHANGED
@@ -70,6 +70,8 @@ module Restfully
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
if element.attributes["href"]
|
73
|
+
h["id"] ||= element.attributes["id"] if element.attributes["id"]
|
74
|
+
h["name"] ||= element.attributes["name"] if element.attributes["name"]
|
73
75
|
h["link"] ||= []
|
74
76
|
h["link"].push({
|
75
77
|
"href" => element.attributes["href"],
|
@@ -191,7 +193,7 @@ module Restfully
|
|
191
193
|
end
|
192
194
|
|
193
195
|
def complete?
|
194
|
-
if property.reject{|k,v| k
|
196
|
+
if property.reject{|k,v| [HIDDEN_TYPE_KEY, "id", "name"].include?(k)}.empty? && links.find(&:self?)
|
195
197
|
false
|
196
198
|
else
|
197
199
|
true
|
data/lib/restfully/resource.rb
CHANGED
@@ -24,7 +24,7 @@ module Restfully
|
|
24
24
|
# resource["uid"]
|
25
25
|
# => "rennes"
|
26
26
|
def [](key)
|
27
|
-
|
27
|
+
if !media_type.property(key) && !collection?
|
28
28
|
expand
|
29
29
|
end
|
30
30
|
media_type.property(key)
|
@@ -195,19 +195,15 @@ module Restfully
|
|
195
195
|
# Build the resource after loading.
|
196
196
|
def build
|
197
197
|
metaclass = class << self; self; end
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
'Accept' => link.type
|
206
|
-
}).load(*args)
|
207
|
-
end
|
208
|
-
|
198
|
+
extend Collection if collection?
|
199
|
+
|
200
|
+
response.links.each do |link|
|
201
|
+
metaclass.send(:define_method, link.id.to_sym) do |*args|
|
202
|
+
session.get(link.href, :head => {
|
203
|
+
'Accept' => link.type
|
204
|
+
}).load(*args)
|
209
205
|
end
|
210
|
-
|
206
|
+
end
|
211
207
|
self
|
212
208
|
end
|
213
209
|
|
data/lib/restfully/session.rb
CHANGED
@@ -43,7 +43,7 @@ module Restfully
|
|
43
43
|
end
|
44
44
|
|
45
45
|
# Read configuration from file:
|
46
|
-
config_file = @config.delete(:configuration_file)
|
46
|
+
config_file = ENV['RESTFULLY_CONFIG'] || @config.delete(:configuration_file)
|
47
47
|
config_file = File.expand_path(config_file) if config_file
|
48
48
|
if config_file && File.file?(config_file) && File.readable?(config_file)
|
49
49
|
@logger.info "Using configuration file located at #{config_file}."
|
data/lib/restfully/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restfully
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 57
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 3
|
10
|
+
version: 0.8.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Cyril Rohr
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-15 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -265,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
265
|
requirements: []
|
266
266
|
|
267
267
|
rubyforge_project:
|
268
|
-
rubygems_version: 1.
|
268
|
+
rubygems_version: 1.6.2
|
269
269
|
signing_key:
|
270
270
|
specification_version: 3
|
271
271
|
summary: Consume RESTful APIs effortlessly
|