Sha256: 17d05c63cf7b3216da3ffe6d24eef109b423161fee84111dd2d4d31c43e36f56

Contents?: true

Size: 1007 Bytes

Versions: 5

Compression:

Stored size: 1007 Bytes

Contents

# encoding: utf-8

module Nimbu
  module Endpoints
    class Products < Endpoint
      def list(*args)
        arguments(args)

        response = get_request("/products", arguments.params)
        return response unless block_given?
        response.each { |el| yield el }
      end
      alias :all :list

      def get(*args)
        arguments(args, :required => [:product_id])

        get_request("/products/#{product_id}", arguments.params)
      end
      alias :find :get

      def create(*args)
        arguments(args)

        post_request("/products", arguments.params)
      end

      def update(*args)
        arguments(args, :required => [:product_id])

        patch_request("/products/#{product_id}", arguments.params)
      end
      alias :edit :update

      def delete(*args)
        arguments(args, :required => [:product_id])

        delete_request("/products/#{product_id}", arguments.params)
      end
      alias :remove :delete

    end # Products
  end # Endpoints
end # Nimbu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nimbu-api-0.3.0 lib/nimbu-api/endpoints/products.rb
nimbu-api-0.2.1 lib/nimbu-api/endpoints/products.rb
nimbu-api-0.2 lib/nimbu-api/endpoints/products.rb
nimbu-api-0.2.beta.3 lib/nimbu-api/endpoints/products.rb
nimbu-api-0.2.beta.2 lib/nimbu-api/endpoints/products.rb