Sha256: fc01e589b038ec8a8c15b2ed027ccdebf9aedbf68fe9850bf064f9cee039b554

Contents?: true

Size: 591 Bytes

Versions: 1

Compression:

Stored size: 591 Bytes

Contents

module OpenlabRuby
  class Projects
    PROJECTS_PATH = '/projects'
    
    attr_accessor :client

    def initialize(client = nil)
      @client = client || OpenlabRuby::Client.new
    end

    def search(q, opts = {})
      client.get(PROJECTS_PATH, query: { q: q }.merge(opts))
    end

    def create(attributes)
      client.post(PROJECTS_PATH, body: { project: attributes })
    end

    def update(id, attributes)
      client.patch("#{PROJECTS_PATH}/#{id}", body: { project: attributes })
    end

    def destroy(id)
      client.delete("#{PROJECTS_PATH}/#{id}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
openlab_ruby-0.0.1 lib/openlab_ruby/projects.rb