Skip to contents

RIDL Resource

RIDL Resource

Details

RIDLResource, it contains all the logic for creating, checking, and updating resources

Super class

ridl::RIDLObject -> RIDLResource

Public fields

data

placeholder for Resource field element

Methods

Inherited methods


Method new()

Create a new RIDLResource object

Usage

RIDLResource$new(initial_data = NULL, configuration = NULL)

Arguments

initial_data

list with required field to create a resource

configuration

a RIDLConfig object

Returns

A RIDLResource object


Method download()

Download a RIDL resource

Usage

RIDLResource$download(
  folder = NULL,
  filename = NULL,
  quiet = TRUE,
  force = FALSE
)

Arguments

folder

a character, folder to save the dataset

filename

a character, filename of the dataset

quiet

a logical value, silent download if TRUE

force

a logical value, force download

Returns

a character, the file path


Method download_folder()

Get the download folder for the latest downloaded resource

Usage

RIDLResource$download_folder()

Returns

a character, folder with the latest downloaded resource


Method read()

Read a resource object directly into memory

Usage

RIDLResource$read(
  sheet = NULL,
  format = NULL,
  download_folder = NULL,
  force_download = FALSE,
  quiet_download = TRUE,
  ...
)

Arguments

sheet

a character value, only for resource in Excel format

format

character, specify file format in case the automatic reader doesn't work as expected

download_folder

a character value, folder to save the downloaded resource

force_download

a logical value, if TRUE force download

quiet_download

a logical value, if TRUE silent download

...

other parameters

Returns

A tibble


Method excel_sheets()

Get the list of sheets name of resource

Usage

RIDLResource$excel_sheets(
  format = NULL,
  download_folder = NULL,
  quiet_download = TRUE,
  force_download = FALSE
)

Arguments

format

character, specify file format in case the automatic reader doesn't work as expected

download_folder

a character value, folder to save the downloaded resource

quiet_download

a logical value, if TRUE silent download

force_download

a logical value, if TRUE force download

Returns

the names of the sheets of XLS(X) resources


Method ridl_dataset()

Get the resource dataset.

Usage

RIDLResource$ridl_dataset()

Returns

a RIDLDataset, the dataset containing the resource


Method file_format()

Get the file format

Usage

RIDLResource$file_format()

Returns

a character, the file format of the resource


Method check_required_field()

Check dataset required field

Usage

RIDLResource$check_required_field(check_dataset_id = FALSE)

Arguments

check_dataset_id

logical whether to check or not dataset id

Returns

a logical value, TRUE if the the resource is not missing a required field and throws an error otherwise


Method get_file_to_upload()

Get the file that will be or has been uploaded if any

Usage

RIDLResource$get_file_to_upload()

Returns

the file to upload


Method set_file_to_upload()

Set the file that will be uploaded

Usage

RIDLResource$set_file_to_upload(file_to_upload)

Arguments

file_to_upload

character the path to the file to upload


Method check_resource_type()

Check if the resource has an url or a file to upload but not both

Usage

RIDLResource$check_resource_type()

Returns

a logical value, TRUE if the the resource don't mix 'url' and and 'file_to_upload'


Method get_fields()

Get resource fields

Usage

RIDLResource$get_fields()

Returns

list of fields for a resource


Method get_required_fields()

Get resource required fields

Usage

RIDLResource$get_required_fields()

Returns

list of required fields for a resource


Method check_required_fields()

Check resource required field

Usage

RIDLResource$check_required_fields()

Returns

a logical value, TRUE if the the resource is not missing a required field and throws an error otherwise


Method as_list()

Get resource field into list

Usage

RIDLResource$as_list()

Returns

a list with resource field


Method ridl_browse()

Browse the resource page on RIDL

Usage

RIDLResource$ridl_browse()


Method print()

Print a Resource object

Usage

RIDLResource$print()


Method clone()

The objects of this class are cloneable with this method.

Usage

RIDLResource$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.