<<

NAME

Koha::ERM::EUsage::UsageDataProvider - Koha ErmUsageDataProvider Object class

API

Class Methods

counter_files

Getter/setter for counter_files for this usage data provider

enqueue_counter_file_processing_job

Enqueues a background job to process a COUNTER file that has been uploaded

enqueue_sushi_harvest_jobs

Enqueues one harvest background job for each report type in this usage data provider

harvest_sushi

    $ud_provider->harvest_sushi(
        {
            begin_date  => $args->{begin_date},
            end_date    => $args->{end_date},
            report_type => $args->{report_type}
        }
    );

Runs this usage data provider's SUSHI harvester Builds the URL query and requests the COUNTER 5 SUSHI service

COUNTER SUSHI api spec: https://app.swaggerhub.com/apis/COUNTER/counter-sushi_5_0_api/5.0.2

begin_date

Begin date of the SUSHI harvest

end_date

End date of the SUSHI harvest

report_type

Report type to run this harvest on

set_background_job_callbacks

    $self->set_background_job_callbacks($background_job_callbacks);

Sets the background job callbacks

background_job_callbacks

Background job callbacks

test_connection

Tests the connection of the harvester to the SUSHI service and returns any alerts of planned SUSHI outages

erm_usage_titles

Method to embed erm_usage_titles to titles for report formatting

erm_usage_muses

Method to embed erm_usage_muses to titles for report formatting

erm_usage_platforms

Method to embed erm_usage_platforms to platforms for report formatting

erm_usage_items

Method to embed erm_usage_items to items for report formatting

erm_usage_databases

Method to embed erm_usage_databases to databases for report formatting

Internal methods

_build_url_query

Build the URL query params for COUNTER 5 SUSHI request

_validate_url

Checks whether the url ends in a trailing "/" and adds one if not

my $url = $self->_validate_url($url, 'harvest')

$caller is either the harvest_sushi function ("harvest") or the test_connection function ("status")

_check_trailing_character

Checks whether a url string ends in a "/" before we concatenate further params to the end of the url

sushi_code_is_error

    my $is_error = $self->sushi_code_is_error($code);

Determines if a given SUSHI response code is considered an error. Codes greater than 1000 are generally errors unless they are in the list of known warning codes, in which case they are treated as non-errors. Docs at: https://cop5.projectcounter.org/en/5.0.2/appendices/f-handling-errors-and-exceptions.html

_sushi_errors

Checks and handles possible errors in the SUSHI response Additionally, adds background job report message(s) if that is the case

_counter_file_size_too_large

Checks whether a counter file size exceeds the size allowed by the database or not Additionally, adds a background job report message if that is the case

_handle_sushi_response

Creates and sends the request based on a provided url Also handles any redirects

_type

<<