Sha256: 8cc1ac9d971e543a963b08a2aa9d92b710a167dea5350a9c0128c817a8cd26db

Contents?: true

Size: 503 Bytes

Versions: 1

Compression:

Stored size: 503 Bytes

Contents

module PrestaShop
  class Requestor
    include ActiveModel::Model
    attr_accessor :api, :resource_name, :schema
    alias_method :synopsis, :schema

    def find(id, *args)
      get(id, *args)
    end

    def list(*args)
      get(*args)
    end

    def blank(*args)
      get(:blank, *args)
    end

    def search(args)
      get(args.collect{ |k,v| ["filter[#{k}]", v] }.to_h.merge({date: 1}))
    end

    private

    def get(*args)
      api.get(self.resource_name, *args)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
presta_shop-0.1.2 lib/presta_shop/requestor.rb