Sha256: 4e24dafee3f08d9d9afdc624df0186b5ae50b2b1545cf6152e4ae2f7e2819ce2

Contents?: true

Size: 607 Bytes

Versions: 2

Compression:

Stored size: 607 Bytes

Contents

require 'active_support/concern'

class Frenetic
  module MemberRestMethods
    extend ActiveSupport::Concern

    module ClassMethods
      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
      end

      def all
        return [] if test_mode?

        if response = api.get( collection_url ) and response.success?
          Frenetic::ResourceCollection.new self, response.body
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
frenetic-0.0.20.alpha.6 lib/frenetic/concerns/member_rest_methods.rb
frenetic-0.0.20.alpha.5 lib/frenetic/concerns/member_rest_methods.rb