Sha256: e83e90193020a2e7709bbe47cc6e958925f0f0204be74d7c0ab008942f47f75f

Contents?: true

Size: 692 Bytes

Versions: 2

Compression:

Stored size: 692 Bytes

Contents

module Wing
  module Actions
    module Stores
      def list_stores(options = { page: 1, limit: 20, createdBefore: nil, createdAfter: nil })
        get("/store", query: prepare_query(options)).parsed_response
      end

      def create_store(data, options = {})
        post("/store", data, options).parsed_response
      end

      private

      def prepare_query(options = { page: 1, limit: 20, createdBefore: nil, createdAfter: nil })
        {
          page: options[:page],
          limit: options[:limit],
          createdBefore: options[:createdBefore],
          createdAfter: options[:createdAfter],
        }.delete_if { |key, value| value.nil? }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wing.rb-0.1.2 lib/wing/actions/stores.rb
wing.rb-0.1.1 lib/wing/actions/stores.rb