Sha256: ec979be623225eb314e4aa38f88d3704d02b9784a70c2b3813c88910c7175f49

Contents?: true

Size: 530 Bytes

Versions: 1

Compression:

Stored size: 530 Bytes

Contents

module Loquor
  module Representation
    module ClassMethods
      [:find, :where, :create].each do |proxy|
        define_method proxy do |*args|
          new.send proxy, *args
        end
      end
    end

    module InstanceMethods
      def find(id)
        ApiCall::Show.new(self.class.path, id).execute
      end

      def where(*args)
        ApiCall::Index.new(self.class.path).where(*args)
      end

      def create(payload)
        ApiCall::Create.new(self.class.path, payload).execute
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
loquor-0.0.2 lib/loquor/representation.rb