Sha256: a2eb826045be7f51429aa1c8470ba5a94a2d6937b94ca5488f306d51e3c4986e

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

module Rainforest
  class SitesEndpoint < ApiEndpoint

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

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

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

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

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