Sha256: 279e79f3529f25f6c1be4c424c0bff4f352e29bffab486f8fe8ced5bc54934f1

Contents?: true

Size: 813 Bytes

Versions: 2

Compression:

Stored size: 813 Bytes

Contents

module Datacentred
  module Request
    class Projects < Base

      def self.create(payload={})
        post('projects', payload.to_json)['project']
      end

      def self.list
        get('projects')['projects']
      end

      def self.show(id)
        get("projects/#{id}")['project']
      end

      def self.update(id, payload={})
        put("projects/#{id}", payload.to_json)['project']
      end

      def self.destroy(id)
        delete("projects/#{id}")
      end

      def self.list_users(id)
        get("projects/#{id}/users")['users']
      end

      def self.add_user(project_id, user_id)
        put("projects/#{project_id}/users/#{user_id}")
      end

      def self.remove_user(project_id, user_id)
        delete("projects/#{project_id}/users/#{user_id}")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datacentred-0.1.1pre lib/datacentred/request/projects.rb
datacentred-0.1.0pre lib/datacentred/request/projects.rb