Sha256: 366e63a67f6a854ea56459633ff6a764e9232c4b1f88fc474d86b65bcff2f231

Contents?: true

Size: 1.48 KB

Versions: 4

Compression:

Stored size: 1.48 KB

Contents

module Rainforest
  class EnvironmentsEndpoint < ApiEndpoint

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

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

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

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

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

    def create(params={}, headers={})
      method = ApiMethod.new(:post, "/environments", params, headers, @parent)
      json = @client.execute(method)
      Environment.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/environments_endpoint.rb
rainforest-2.0.2 lib/rainforest/endpoints/environments_endpoint.rb
rainforest-2.0.1 lib/rainforest/endpoints/environments_endpoint.rb
rainforest-2.0.0 lib/rainforest/endpoints/environments_endpoint.rb