lib/frenetic/concerns/member_rest_methods.rb in frenetic-1.0.0.alpha.1 vs lib/frenetic/concerns/member_rest_methods.rb in frenetic-1.0.0
- old
+ new
@@ -3,23 +3,20 @@
class Frenetic
module MemberRestMethods
extend ActiveSupport::Concern
module ClassMethods
- def find( params )
- params = { id:params } unless params.is_a? Hash
+ def find(params)
+ params = { id:params } unless params.is_a?(Hash)
return as_mock(params) if test_mode?
- if response = api.get( member_url(params) ) and response.success?
- new response.body
- end
+ response = api.get(member_url(params))
+ new(response.body) if response.success?
end
def all
return [] if test_mode?
-
- if response = api.get( collection_url ) and response.success?
- Frenetic::ResourceCollection.new self, response.body
- end
+ response = api.get(collection_url)
+ Frenetic::ResourceCollection.new(self, response.body) if response.success?
end
end
end
-end
\ No newline at end of file
+end