Sha256: 7fe67a3d67ee4e8404a34cf1d2250db40c58aaca463137e5532dc6dfc1047e7a

Contents?: true

Size: 398 Bytes

Versions: 4

Compression:

Stored size: 398 Bytes

Contents

module LightspeedRestaurant
  module Operations
    module List
      def list(params = {})
        response = JSON.parse(LightspeedRestaurant.get(resource_path, {}, params))
        instantiate(response['results'])
      end
      alias_method :all, :list

      private

      def instantiate(records)
        records.map do |record|
          new(record)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lightspeed_restaurant-0.1.3 lib/lightspeed_restaurant/operations/list.rb
lightspeed_restaurant-0.1.2 lib/lightspeed_restaurant/operations/list.rb
lightspeed_restaurant-0.1.1 lib/lightspeed_restaurant/operations/list.rb
lightspeed_restaurant-0.1.0 lib/lightspeed_restaurant/operations/list.rb