Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 Errors when creating messages #16

Closed
bunswo opened this issue Jan 26, 2012 · 6 comments
Closed

404 Errors when creating messages #16

bunswo opened this issue Jan 26, 2012 · 6 comments

Comments

@bunswo
Copy link

bunswo commented Jan 26, 2012

I'm getting 404 errors when trying to create Basecamp messages using the wrapper.

I can create Projects successfully:

p = Basecamp::Project.new()
p.name = 'My Test Project'
p.save

The project shows up in Basecamp on the web without problem.

And I can grab the new project id:

proj_id = p.id

But when I try to create messages on the project...

m = Basecamp::Message.new(:project_id => proj_id)
m.title = 'Message in a bottle'
m.body = 'Another lonely day, with no one here but me'
m.save

It returns a 404 error after the save method:

ActiveResource::ResourceNotFound: Failed. Response code = 404. Response message = Not Found.
from /Users/benunsworth/.rvm/gems/ruby-1.9.3-p0/gems/activeresource-3.2.0/lib/active_resource/connection.rb:136:in `handle_response' ...

Any idea?

Thanks,
Ben

@anibalcucco
Copy link
Owner

Hey,

I pushed a fix, we were overriding the element_name in Resource ignoring the "special" element name setting necessary in Basecamp::Message to use "post" in the API calls instead of "message".

The problem was only in rails >= 3, that method was ignored in rails < 3.

Can you try the fix by adding the gem like this in your project?

gem "basecamp", :git => "git://github.com/anibalcucco/basecamp-wrapper.git", :ref => "7e67411a847c9bf921e3c8fe489110fbc0dfa53e"

If you confirm it's working, i'll bump the gem version.

Thanks,
Anibal

@bunswo
Copy link
Author

bunswo commented Jan 27, 2012

Hi Anibal --

That worked! I added the gem into my gem file and the message posted to the project.

Yes it was Rails 3.2.0

Thanks so much!

Ben

Ben Unsworth
Globacore Interactive Technologies

On 2012-01-26, at 7:37 PM, Anibal Cucco wrote:

Hey,

I pushed a fix, we were overriding the element_name in Resource ignoring the "special" element name setting necessary in Basecamp::Message to use "post" in the API calls instead of "message".

The problem was only in rails >= 3, that method was ignored in rails < 3.

Can you try the fix by adding the gem like this in your project?

gem "basecamp", :git => "git://github.com/anibalcucco/basecamp-wrapper.git", :ref => "7e67411a847c9bf921e3c8fe489110fbc0dfa53e"

If you confirm it's working, i'll bump the gem version.

Thanks,
Anibal


Reply to this email directly or view it on GitHub:
#16 (comment)

@anibalcucco
Copy link
Owner

Thanks @bunswo. Version bumped to 0.0.9 and published to rubygems.

@bunswo
Copy link
Author

bunswo commented Jan 27, 2012

Awesome - While I have you here and before I go too deep -- does your wrapper allow for adding multiple people to a message?

Ben Unsworth
Globacore Interactive Technologies

On 2012-01-26, at 10:05 PM, Anibal Cucco wrote:

Thanks @bunswo. Version bumped to 0.0.9 and published to rubygems.


Reply to this email directly or view it on GitHub:
#16 (comment)

@anibalcucco
Copy link
Owner

There's currently no way to do that using the REST API because the notify attribute should be outside the post attributes in the request to create the message and i couldn't find a way to make active resource handle that yet:

<request>
  <post>
    <category-id>#{category_id}</category-id>
    <title>#{title}</title>
    <body>#{body}</body>
    <private>1</private> <!-- only for firm employees -->
  </post>
  <notify>#{person_id}</notify>
  <notify>#{person_id}</notify>
...

But you can always use the non REST API for those special cases:

Basecamp.request "/projects/1234/posts", :post => {:title => "Hello", :body => "World"}, :notify => ["person_id_1", "person_id_2"]

Note: I discovered a bug for that type of calls and i pushed a fix. So, if you want to use that, you have to reference this commit on your Gemfile: 43a72a2

@bunswo
Copy link
Author

bunswo commented Jan 28, 2012

Great. Thanks Anibal. That's really helpful.

Sent from my iPhone

On 2012-01-27, at 3:14 PM, "Anibal Cucco" reply@reply.github.com wrote:

There's currently no way to do that using the REST API because the notify attribute should be outside the post attributes in the request to create the message and i couldn't find a way to make active resource handle that yet:

<request>
 <post>
   <category-id>#{category_id}</category-id>
   <title>#{title}</title>
   <body>#{body}</body>
   <private>1</private> <!-- only for firm employees -->
 </post>
 <notify>#{person_id}</notify>
 <notify>#{person_id}</notify>
...

But you can always use the non REST API for those special cases:

Basecamp.request "/projects/1234/posts", :post => {:title => "Hello", :body => "World"}, :notify => ["person_id_1", "person_id_2"]

Note: I discovered a bug for that type of calls and i pushed a fix. So, if you want to use that, you have to reference this commit on your Gemfile: 43a72a2


Reply to this email directly or view it on GitHub:
#16 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants