Permalink
Browse files

Merge branch 'nbudin'

  • Loading branch information...
2 parents 548938b + 7342653 commit 82b51a919b3ef6ed62c54fec61b5e32b2e4d0c8e @norman committed Oct 19, 2009
Showing with 14 additions and 9 deletions.
  1. +5 −0 History.txt
  2. +1 −1 disqus.gemspec
  3. +8 −8 lib/disqus/api.rb
View
@@ -1,3 +1,8 @@
+== 1.0.2 2009-10-05
+ 2 bug fixes:
+ * The Disqus::API.post method now returns the response body rather than the response object (Nat Budin)
+ * Disqus::API.create_post now complies with DISQUS's API requirements (Nat Budin)
+
== 1.0.1 2009-01-19
2 minor enhancements:
* Improve docs (Quin Hoxie)
View
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = "disqus"
- s.version = "1.0.1"
+ s.version = "1.0.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Norman Clarke", "Matthew Van Horn"]
s.date = %q{2009-01-19}
View
@@ -64,17 +64,17 @@ class << self
# * <tt>:ip_address</tt> - the author's IP address
def create_post(opts = {})
opts[:api_key] ||= Disqus::defaults[:api_key]
- JSON.parse(post('create_post',
+ post_data = {
:forum_api_key => opts[:forum_api_key],
:thread_id => opts[:thread_id],
:message => opts[:message],
:author_name => opts[:author_name],
- :author_email => opts[:author_email],
- :parent_post => opts[:parent_post],
- :created_at => opts[:created_at], #UTC timestring, format: %Y-%m-%dT%H:%M
- :author_url => opts[:author_url],
- :ip_address => opts[:ip_address])
- )
+ :author_email => opts[:author_email]
+ }
+ [:parent_post, :created_at, :author_url, :ip_address].each do |key|
+ post_data[key] = opts[key] if opts[key]
+ end
+ JSON.parse(post('create_post/', post_data))
end
# Returns an array of hashes representing all forums the user owns. The
@@ -244,7 +244,7 @@ def post(*args)
url = ROOT + '/' + args.shift
post_params = {}
args.shift.each { |k, v| post_params[k.to_s]=v.to_s }
- Net::HTTP.post_form(URI.parse(url),post_params)
+ Net::HTTP.post_form(URI.parse(url),post_params).body
end
def make_url(*args)

0 comments on commit 82b51a9

Please sign in to comment.