Sha256: 14528b6e2939991139569d962bf89087ed5a65dd2574d8f1aca1f97d497c7333

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 KB

Contents

module Rainforest
  class GeneratorsEndpoint < ApiEndpoint

    def new(id)
      Generator.new({:id => id}, nil, @client)
    end

    def all(params={}, headers={})
      method = ApiMethod.new(:get, "/generators", params, headers, @parent)
      json = @client.execute(method)
      ApiList.new(:Generator, json, method)
    end

    def retrieve(generator_id, params={}, headers={})
      params = ParamsBuilder.merge({
        :generator_id => generator_id,
      }, params)
      method = ApiMethod.new(:get, "/generators/:generator_id", params, headers, @parent)
      json = @client.execute(method)
      Generator.new(json, method)
    end

    def delete(generator_id, params={}, headers={})
      params = ParamsBuilder.merge({
        :generator_id => generator_id,
      }, params)
      method = ApiMethod.new(:delete, "/generators/:generator_id", params, headers, @parent)
      json = @client.execute(method)
      Generator.new(json, method)
    end

    def update(generator_id, params={}, headers={})
      params = ParamsBuilder.merge({
        :generator_id => generator_id,
      }, params)
      method = ApiMethod.new(:put, "/generators/:generator_id", params, headers, @parent)
      json = @client.execute(method)
      Generator.new(json, method)
    end

    def create(params={}, headers={})
      method = ApiMethod.new(:post, "/generators", params, headers, @parent)
      json = @client.execute(method)
      Generator.new(json, method)
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rainforest-2.1.0 lib/rainforest/endpoints/generators_endpoint.rb
rainforest-2.0.2 lib/rainforest/endpoints/generators_endpoint.rb
rainforest-2.0.1 lib/rainforest/endpoints/generators_endpoint.rb
rainforest-2.0.0 lib/rainforest/endpoints/generators_endpoint.rb