Closed meanphil closed 5 years ago
Either:
Async do
connection.accounts.first
ensure
connection.close
end
or:
Cloudflare.connect(key: c[:key], email: c[:email]) do |connection|
connection.accounts.first
end
If you want the result of that block, append .result
, or do everything you want inside the block, i.e.
Cloudflare.connect(key: c[:key], email: c[:email]) do |connection|
account = connection.accounts.first
# do something with account
end
Ah ha - thank you. I guess the README is lagging behind slightly?
Yeah do you have time to submit a PR to update the README?
Sure, but maybe in a few weeks...
Out of interest, why make this change? What was wrong with the simple rest-client before?
In no particular order:
async-rest
. No longer have to dump your own JSON or parse the response.#each
.If you want to use 3.x nothing is stopping you, and if you want to maintain 3.x I will happily help with that.
Am I doing something wrong with this example? Do I need to initialize Async somehow?
Ruby 2.5.3, Rails 5.2.2, Cloudflare 4.0.0, FreeBSD 11
If I try using
rails runner test.rb
, I get a backtrace: