Code Monkey home page Code Monkey logo

Comments (7)

ioquatix avatar ioquatix commented on May 19, 2024

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

from cloudflare.

ioquatix avatar ioquatix commented on May 19, 2024

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

from cloudflare.

meanphil avatar meanphil commented on May 19, 2024

Ah ha - thank you. I guess the README is lagging behind slightly?

from cloudflare.

ioquatix avatar ioquatix commented on May 19, 2024

Yeah do you have time to submit a PR to update the README?

from cloudflare.

meanphil avatar meanphil commented on May 19, 2024

Sure, but maybe in a few weeks...

from cloudflare.

scottrobertson avatar scottrobertson commented on May 19, 2024

Out of interest, why make this change? What was wrong with the simple rest-client before?

from cloudflare.

ioquatix avatar ioquatix commented on May 19, 2024

In no particular order:

  • Better performance through persistent HTTP/2 connections.
  • Significantly simplified interface through use of async-rest. No longer have to dump your own JSON or parse the response.
  • More straight forward implementation.
  • Better on-demand pagination transparently handled under #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.

from cloudflare.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.