Sha256: 7246520767c1e0c79a24e7f45d5226bbf095d85c51814359516b8b840f96b663

Contents?: true

Size: 495 Bytes

Versions: 4

Compression:

Stored size: 495 Bytes

Contents

module Reviewed
  module Utils

    def self.included(klass)
      klass.extend(Reviewed::Utils::ClassMethods)
    end

    module ClassMethods

      def object_from_response(method, url, params={})
        response = Reviewed.send(method, url, params)
        self.new(response.body)
      end

      def collection_from_response(method, url, params={})
        response = Reviewed.send(method, url, params)
        Reviewed::Collection.new(self, response, params)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reviewed-0.1.2 lib/reviewed/utils.rb
reviewed-0.1.1 lib/reviewed/utils.rb
reviewed-0.1.0 lib/reviewed/utils.rb
reviewed-0.0.9 lib/reviewed/utils.rb