Created
July 18, 2011 18:47
-
-
Save gregorym/1090307 to your computer and use it in GitHub Desktop.
Basecamp Api not working
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Basecamp::Message.prefix = "/projects/:project_id/" | |
# Basecamp::Base.establish_connection!( my info the connecy) | |
m = Basecamp::Message.new(:project_id => 7584268) | |
m.title = "greg" | |
m.body = "plop" | |
m.author_id = 7714821 | |
m.private = false | |
m.notify = ["7714823"] | |
print m.encode | |
m.save | |
<?xml version="1.0" encoding="UTF-8"?> | |
<post> | |
<notify type="array"> | |
<notify>7714823</notify> | |
</notify> | |
<body>plop</body> | |
<title>greg</title> | |
<private type="boolean">false</private> | |
<author-id type="integer">7714821</author-id> | |
</post> | |
<notify type="integer">7714823</notify> | |
ActiveResource::ServerError: Failed. Response code = 500. Response message = Internal Server Error. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Basecamp | |
class Message < Base | |
self.element_name = "post" | |
def encode(options={}) | |
if known_attributes.include?('notify') | |
encoded = send("to_#{self.class.format.extension}", options) | |
notifies = notify.inject("") { |acc, n| acc += %(<notify>#{n}</notify>\n) } | |
"<request>" + encoded + notifies + "</request>" | |
else | |
super | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Basecamp::Message.prefix = "/projects/:project_id/" | |
# Basecamp::Base.establish_connection!( my info the connecy) | |
m = Basecamp::Message.new(:project_id => 7584268) | |
m.title = "greg" | |
m.body = "plop" | |
m.author_id = 7714821 | |
m.private = false | |
#m.notify = ["7714823"] | |
print m.encode | |
m.save | |
<?xml version="1.0" encoding="UTF-8"?> | |
<post> | |
<notify type="array"> | |
<notify>7714823</notify> | |
</notify> | |
<body>plop</body> | |
<title>greg</title> | |
<private type="boolean">false</private> | |
<author-id type="integer">7714821</author-id> | |
</post> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment