Sha256: e5b24d41d5d94f6c3934c40c5964ccbe3c9f7061bf2905cd6d0e9040688e8764

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

module Rainforest
  class SchedulesEndpoint < ApiEndpoint

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

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

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

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

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

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