| blib/lib/Net/Async/WebSearch/Provider/Reddit/OAuth.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % |
| condition | 30 | 60 | 50.0 |
| line | !l | l&&!r | l&&r | condition |
|---|---|---|---|---|
| 30 | 1 | 0 | 1 | defined $self->{'username'} and defined $self->{'password'} |
| 194 | 8 | 0 | 3 | $self->{'_access_token'} and $self->{'_token_expires_at'} |
| 0 | 1 | 2 | $self->{'_access_token'} and $self->{'_token_expires_at'} and time + $self->{'token_margin'} < $self->{'_token_expires_at'} | |
| 243 | 9 | 0 | 0 | defined $sub && length $sub |
| 253 | 9 | 0 | 0 | defined $sub and length $sub |
| line | l | !l | condition |
|---|---|---|---|
| 20 | 10 | 4 | $self->{'grant_type'} ||= "client_credentials" |
| 21 | 0 | 14 | $self->{'token_url'} ||= "https://www.reddit.com/api/v1/access_token" |
| 22 | 0 | 14 | $self->{'authorize_url'} ||= "https://www.reddit.com/api/v1/authorize" |
| 23 | 0 | 14 | $self->{'endpoint'} ||= "https://oauth.reddit.com" |
| 24 | 0 | 14 | $self->{'name'} ||= "reddit-oauth" |
| 25 | 0 | 14 | $self->{'link_base'} ||= "https://www.reddit.com" |
| 26 | 1 | 13 | $self->{'token_margin'} ||= 60 |
| 33 | 1 | 0 | $self->{'device_id'} ||= "DO_NOT_TRACK_THIS_DEVICE" |
| 52 | 0 | 0 | $self->{'expires_in'} // 3600 |
| 112 | 1 | 1 | $scope //= "read" |
| 119 | 0 | 2 | $args{'duration'} // "permanent" |
| 172 | 0 | 0 | $data->{'error'} // "unknown" |
| 176 | 9 | 0 | $data->{'expires_in'} // 3600 |
| 236 | 11 | 0 | $opts ||= {} |
| 237 | 11 | 0 | $opts->{'limit'} || 10 |
| line | l | !l&&r | !l&&!r | condition |
|---|---|---|---|---|
| 52 | 2 | 0 | 0 | $self->{'token_expires_at'} // time + ($self->{'expires_in'} // 3600) |
| 119 | 1 | 1 | 0 | $args{'state'} // _random_state() |
| 130 | 2 | 0 | 0 | $args{'http'} || $self->{'_http_for_auth'} |
| 250 | 0 | 9 | 0 | $opts->{'sort'} // $self->sort |
| 0 | 9 | 0 | $opts->{'time'} // $self->time |