aweber/AWeber-API-Ruby-Library — Issue #5: Collections.create
Author: kmccammon
Created: 2012-01-03 22:50:20+00:00
State: open

There seems to be an issue with the Collections.create method that is invoked as a result of:
```
@oauth = AWeber::OAuth.new("consumer_key", "consumer_secret")
@oauth.authorize_with_access("token", "secret")
@aweber = AWeber::Base.new(@oauth)
@account = @aweber.account
@account.lists
@account.lists[1].subscribers.create(:name => "User Name", :email => "test@test.com")
```
It throws the following:
```
JSON::ParserError: source did not contain any JSON!
from /Users/keiron/.rvm/gems/ruby-1.9.2-p290@visionary-tennis/gems/json-1.6.4/lib/json/pure/parser.rb:141:in `parse'
from /Users/keiron/.rvm/gems/ruby-1.9.2-p290@visionary-tennis/gems/json-1.6.4/lib/json/common.rb:148:in `parse'
from /Users/keiron/.rvm/gems/ruby-1.9.2-p290@visionary-tennis/gems/aweber-1.3.1/lib/aweber/collection.rb:68:in `create'
from (irb):2
from /Users/keiron/.rvm/gems/ruby-1.9.2-p290@visionary-tennis/gems/railties-3.1.3/lib/rails/commands/console.rb:45:in `start'
from /Users/keiron/.rvm/gems/ruby-1.9.2-p290@visionary-tennis/gems/railties-3.1.3/lib/rails/commands/console.rb:8:in `start'
from /Users/keiron/.rvm/gems/ruby-1.9.2-p290@visionary-tennis/gems/railties-3.1.3/lib/rails/commands.rb:40:in `'
from script/rails:6:in `require'
from script/rails:6:in `

'
```

In the create call it tries to parse the response body:
```
response = JSON.parse(response.body)
```

However, according to the docs: https://labs.aweber.com/docs/reference/1.0#subscribers

In response to the post...
```
On success, the response status will be 201 CREATED with a link to the newly created subscriber appearing in the Location header.
```
Therefore the response body is empty and the JSON.parse fails.

Is this a bug or am I doing something wrong with the API?