lib/api_client/resource/scope.rb in api_client-0.1.2 vs lib/api_client/resource/scope.rb in api_client-0.1.3
- old
+ new
@@ -14,23 +14,23 @@
def append_format(path)
format ? [path, format].join('.') : path
end
def find(id)
- path = [@path, id].join('/')
- path = append_format(path)
- raw = get(path)
+ path = [@path, id].join('/')
+ path = append_format(path)
+ response = get(path)
scoped(self) do
- @scopeable.build(raw)
+ raw? ? response : @scopeable.build(response)
end
end
def find_all(params = {})
- path = append_format(@path)
- raw = get(path, params)
+ path = append_format(@path)
+ response = get(path, params)
scoped(self) do
- @scopeable.build(raw)
+ raw? ? response : @scopeable.build(response)
end
end
def create(params = {})
path = append_format(@path)
@@ -39,11 +39,11 @@
else
params
end
response = post(path, hash)
scoped(self) do
- @scopeable.build(response)
+ raw? ? response : @scopeable.build(response)
end
end
def update(id, params = {})
path = [@path, id].join('/')
@@ -53,10 +53,10 @@
else
params
end
response = put(path, hash)
scoped(self) do
- @scopeable.build(response)
+ raw? ? response : @scopeable.build(response)
end
end
def destroy(id)
path = [@path, id].join('/')