Sha256: b9c8b4897efcf5b0582c992706d8931677e51b165059c3eb39bbda4546dd28db

Contents?: true

Size: 504 Bytes

Versions: 2

Compression:

Stored size: 504 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

2 entries across 2 versions & 1 rubygems

Version Path
presta_shop-0.1.1 lib/presta_shop/requestor.rb
presta_shop-0.1.0 lib/presta_shop/requestor.rb