Skip to content

Commit

Permalink
async response now returns hash
Browse files Browse the repository at this point in the history
  • Loading branch information
sosedoff committed Aug 30, 2011
1 parent 2db3669 commit c36cc2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/clouddns/async_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ def initialize(client, data={})
end
end

# Returns a hash representation of response
def to_hash
{:job_id => @job_id, :callback_url => @callback_url}
end

# Get the asynchronous response content
#
def content
Expand Down
8 changes: 8 additions & 0 deletions spec/async_response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@
resp = CloudDns::AsyncResponse.new(@client, '5fa38d01-1805-4f4f-a41a-56a3859f7ea0')
resp.content.should be_a Hash
end

it 'returns a hash' do
resp = CloudDns::AsyncResponse.new(@client, '5fa38d01-1805-4f4f-a41a-56a3859f7ea0')
h = resp.to_hash
h.should be_a Hash
h.key?(:job_id).should be_true
h.key?(:callback_url).should be_true
end
end

0 comments on commit c36cc2f

Please sign in to comment.