class Rainforest::SitesEndpoint

Public Instance Methods

all(params={}, headers={}) click to toggle source
# File lib/rainforest/endpoints/sites_endpoint.rb, line 8
def all(params={}, headers={})
  method = ApiMethod.new(:get, "/sites", params, headers, @parent)
  json = @client.execute(method)
  ApiList.new(:Site, json, method)
end
create(params={}, headers={}) click to toggle source
# File lib/rainforest/endpoints/sites_endpoint.rb, line 32
def create(params={}, headers={})
  method = ApiMethod.new(:post, "/sites", params, headers, @parent)
  json = @client.execute(method)
  Site.new(json, method)
end
delete(site_id, params={}, headers={}) click to toggle source
# File lib/rainforest/endpoints/sites_endpoint.rb, line 14
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
new(id) click to toggle source
# File lib/rainforest/endpoints/sites_endpoint.rb, line 4
def new(id)
  Site.new({:id => id}, nil, @client)
end
update(site_id, params={}, headers={}) click to toggle source
# File lib/rainforest/endpoints/sites_endpoint.rb, line 23
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