https://github.com/making3/exreddit
Reddit API Wrapper in Elixir
https://github.com/making3/exreddit
elixir elixir-lang reddit reddit-api-wrapper
Last synced: 8 months ago
JSON representation
Reddit API Wrapper in Elixir
- Host: GitHub
- URL: https://github.com/making3/exreddit
- Owner: making3
- License: mit
- Created: 2017-09-30T22:27:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-11-10T22:50:44.000Z (over 3 years ago)
- Last Synced: 2023-08-01T17:33:24.478Z (almost 3 years ago)
- Topics: elixir, elixir-lang, reddit, reddit-api-wrapper
- Language: Elixir
- Size: 30.3 KB
- Stars: 2
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ExReddit
Exreddit is a Reddit API Wrapper.
## Example
token = ExReddit.OAuth.get_token()
subreddit = "learnprogramming"
options = [limit:1]
{:ok, threads} = ExReddit.Api.get_new_threads(token, subreddit, options)
## Installation
Add the following to Hex:
```elixir
def application do
[
applications: [:exreddit]
]
end
def deps do
[
{:exreddit, git: "https://github.com/making3/exreddit.git", branch: "master"}
]
end
```
### Configuration
config :exreddit,
username: System.get_env("REDDIT_USER"),
password: System.get_env("REDDIT_PASS"),
client_id: System.get_env("REDDIT_CLIENT_ID"),
secret: System.get_env("REDDIT_SECRET"),
api_rate_limit_delay: 1000 # In milliseconds
It is recommended to create the following environment variables for configuring your user:
- `REDDIT_USER`
- `REDDIT_PASS`
- `REDDIT_CLIENT_ID`
- `REDDIT_SECRET`
## Usage
token = ExReddit.OAuth.get_token()
subreddit = "learnprogramming"
options = [limit:1]
{:ok, threads} = ExReddit.Api.get_new_threads(token, subreddit, options)
## Development
### Tests
Use mix test to run tests. Application variables need to be setup in order to run api tests.
mix test
mix test --exclude reddit_api # Exclude api tests
mix test --only subreddit # Only subreddit tests