Module: FastCurl

Defined in:
lib/fast_curl.rb,
lib/fast_curl/version.rb,
ext/fast_curl/fast_curl.c

Defined Under Namespace

Classes: Error, TimeoutError

Constant Summary collapse

DEFAULT_OPTIONS =
{
  connections: 20,
  timeout: 30
}.freeze
METHODS =
%i[get post put delete patch].freeze
BODY_METHODS =
%i[post put patch].freeze
VERSION =
"0.3.1"

Class Method Summary collapse

Class Method Details

.execute(*args) ⇒ Object



1333
1334
1335
1336
1337
# File 'ext/fast_curl/fast_curl.c', line 1333

static VALUE rb_fast_curl_execute(int argc, VALUE *argv, VALUE self) {
    VALUE requests, options;
    rb_scan_args(argc, argv, "1:", &requests, &options);
    return internal_execute(requests, options, -1, 0);
}

.first_execute(*args) ⇒ Object



1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
# File 'ext/fast_curl/fast_curl.c', line 1339

static VALUE rb_fast_curl_first_execute(int argc, VALUE *argv, VALUE self) {
    VALUE requests, options;
    rb_scan_args(argc, argv, "1:", &requests, &options);

    int count = 1;
    if (!NIL_P(options)) {
        Check_Type(options, T_HASH);
        VALUE c = hash_aref_key(options, KEY_COUNT_OPT);
        if (!NIL_P(c))
            count = NUM2INT(c);
    }

    if (count <= 0)
        rb_raise(rb_eArgError, "count must be positive");

    return internal_execute(requests, options, count, 0);
}

.stream_execute(*args) ⇒ Object



1357
1358
1359
1360
1361
1362
1363
1364
1365
# File 'ext/fast_curl/fast_curl.c', line 1357

static VALUE rb_fast_curl_stream_execute(int argc, VALUE *argv, VALUE self) {
    VALUE requests, options;
    rb_scan_args(argc, argv, "1:", &requests, &options);

    if (!rb_block_given_p())
        rb_raise(rb_eArgError, "stream_execute requires a block");

    return internal_execute(requests, options, -1, 1);
}