Sha256: 45ea9a851e58ce4b68900ea0ad20dd075f69b696cf28a7181b6d94c05cbe35ae

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

module MagicWrite
  class Agents
    def initialize(access_token: nil)
      MagicWrite.configuration.access_token = access_token if access_token
    end

    def list(parameters: {})
      MagicWrite::Client.get(path: '/agents', parameters: parameters)
    end

    def create(parameters: {})
      MagicWrite::Client.json_post(path: '/agents', parameters: parameters)
    end

    def retrieve(id:)
      MagicWrite::Client.get(path: "/agents/#{id}")
    end

    def update(id:, parameters: {})
      MagicWrite::Client.json_put(path: "/agents/#{id}", parameters: parameters)
    end

    def delete(id:)
      MagicWrite::Client.delete(path: "/agents/#{id}")
    end

    def public_list(company_id:, parameters: {})
      MagicWrite::Client.get(path: "/agents/#{company_id}", parameters: parameters)
    end

    def public_retrieve(company_id:, agent_id:)
      MagicWrite::Client.get(path: "/agents/#{company_id}/#{agent_id}")
    end

    def public_create(company_id:, agent_id:, parameters: {})
      MagicWrite::Client.json_post(path: "/agents/#{company_id}/#{agent_id}", parameters: parameters)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ruby-magicwrite-0.1.4 lib/magicwrite/agents.rb
ruby-magicwrite-0.1.3 lib/magicwrite/agents.rb
ruby-magicwrite-0.1.2 lib/magicwrite/agents.rb
ruby-magicwrite-0.1.1 lib/magicwrite/agents.rb
ruby-magicwrite-0.1.0 lib/magicwrite/agents.rb