0

I am having issues using the rt-client gem(link), as it keeps returning a "RT/4.0.8 401 Credentials Required". The REST interface for this site is working, as I have some perl scripts that are currently working with it in a similar fashion.

test.rb

#!/usr/bin/env ruby

require 'rt/client'

rt = RT_Client.new
id = rt.create( :Queue => "General",
                :Subject => "Test",
                :Requestor => "test@example.org",                                                                                                                                                                                                                               
                :Text => "Ignore me" 
              )   

.rtclientrc

server=http://example.org/
user=exampleuser
pass=examplepass
cookies=tmp

Versions

Gem Version: rt-client-0.5.0
RT Version: 4.0.8
Ruby Version: 1.9.3p327

Output

Payload for new ticket:
------xYzZY492386xYzZY
Content-Disposition: form-data; name="content";

Queue: General
Subject: Test
Requestor: test@example.org
Text: Ignore me
id: ticket/new
------xYzZY492386xYzZY--
"RT/4.0.8 401 Credentials required\n"

I am seeing the error when I do a "puts id.inspect" at the bottom of test.rb, as the ticket is not getting created.

Is this perhaps an issue with the handling of cookies? I was trying to avoid writing a custom solution in Net::HTTP if possible, but I will go that route if this continues to be a hassle.

jerius
  • 53
  • 1
  • 6
  • I had no luck using the rt-client gem and ended up writing my own based on httpclient =( – maerics May 14 '13 at 02:58
  • @maerics I found the issue with the gem itself, on line 113 of client.rb. If you look at the cookie that gets generated, it is including a [" at the beginning because of an improper split in the code. I plan on putting a fix up somewhere, as I don't see that the code is hosted on Github or anywhere – jerius May 14 '13 at 14:56

1 Answers1

0

Author of the rt-client ruby gem here.

This was resolved some time ago and I know this is old, but it is ranked highly in a Google search for the gem. If anyone finding this question still has issues with rt-client, the gem is now on github.com. If you wish, please clone it, make your fix and send me a pull request.

https://github.com/uidzip/rt-client

Tom
  • 412
  • 2
  • 9