Readit
Readit is a simple, read-only reddit api client mostly suitable for getting images from a particular subreddit page.
Installation
The package can be installed as:
-
Add readit to your list of dependencies in
mix.exs:
```elixir
def deps do
[{:readit, "~> 0.0.1"}]
end
```- Ensure readit is started before your application:
```elixir
def application do
[applications: [:readit]]
end
```Usage
-
Create a
Substruct
```elixir
sub = Readit.sub("aww")
#=> %Readit.Sub{name: "/r/aww"}
```-
Use
Readit.Subto query the sub
```elixir
post = sub |> Readit.Sub.hot |> hd
#=> %{...}
```-
A post is just a
Map, but theReadit.Postmodule provides some convenience functions for querying them.
```elixir
post.title
#=> "One of them left his parking brake engaged"
post.ups
#=> 5475
Readit.Post.nsfw?(post)
#=> false
Readit.Post.image?(post)
#=> true
Readit.Post.image(post)
#=> http://i.imgur.com/rh8Y5PS.gif
```See the docs for more info.