Skip to content

Countries

Ilya Krukowski edited this page Apr 10, 2022 · 3 revisions

Countries endpoint, supports pagination.

Fetch countries

Providing pagination data or search params is optional:

countries = client.countries itemsPerPage: 2, name: 'Бе'
countries.first.name # => "Беларусь'

Fetch a single country

Provide country ID:

country = client.country 20
country.name # => Нидерланды

Create country

country = client.create_country name: 'Тестовая страна'
country.name # => 'Тестовая страна'

Update country

Provide country ID and its data:

country = client.update_country 20, name: 'Лирия'
country.name # => 'Лирия'

Alternatively:

country = client.country 20
country.update name: 'Обновлённая страна'

Delete country

Provide country ID:

client.delete_country 1

Please note that the response has status code 204 and does not contain any data.

Alternatively:

country = client.country 20
country.destroy
Clone this wiki locally