Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Bounceapp/elixir-calendarific
An Elixir wrapper for the holiday API Calendarific
https://github.com/Bounceapp/elixir-calendarific
Last synced: 8 days ago
JSON representation
An Elixir wrapper for the holiday API Calendarific
- Host: GitHub
- URL: https://github.com/Bounceapp/elixir-calendarific
- Owner: Bounceapp
- License: mit
- Created: 2021-03-15T17:44:22.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-01T17:20:42.000Z (7 months ago)
- Last Synced: 2024-04-22T13:33:22.941Z (7 months ago)
- Language: Elixir
- Homepage:
- Size: 22.5 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-elixir - calendarific - Calendarific is a wrapper for the holiday API Calendarific. (Date and Time)
- awesome-elixir - calendarific - Calendarific is a wrapper for the holiday API Calendarific. (Date and Time)
README
# Calendarific for Elixir [![Hex pm](https://img.shields.io/hexpm/v/calendarific.svg?style=flat)](https://hex.pm/packages/calendarific) [![hex.pm downloads](https://img.shields.io/hexpm/dt/calendarific.svg?style=flat)](https://hex.pm/packages/calendarific)
An Elixir wrapper for the holiday API Calendarific (https://calendarific.com/)
# Installation
This package can be installed by adding `calendarific` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:calendarific, "~> 0.1.4"}
]
end
```# Configuration
To make calls to Calendarific, it is necessary to configure your Calendarific API Key on your `config.exs` file:
```elixir
config :calendarific, api_key: System.get_env("CALENDARIFIC_API_KEY")
# OR
config :calendarific, api_key: "YOUR API KEY"
```# Examples
## Holidays
To fetch holidays for a given country and year, you can use the `holidays/2` method:
```elixir
iex> Calendarific.holidays(country: "US", year: 2021)
[
%Calendarific.Types.Holiday{
country: %Calendarific.Types.Country{id: "us", name: "United States"},
date: %Calendarific.Types.Date{
datetime: %Calendarific.Types.DateTime{day: 1, month: 1, year: 2021},
iso: "2021-01-01"
},
description: "New Year's Day is the first day of the Gregorian calendar, which is widely used in many countries such as the USA.",
locations: "All",
name: "New Year's Day",
states: "All",
type: ["National holiday"]
},
...
]
```# Documentation
The docs can be found at [https://hexdocs.pm/calendarific](https://hexdocs.pm/calendarific).
# License
More info at [LICENSE](LICENSE).