A minimalistic Skroutz API client, for Elixir
To install the package:
- Add skroutz to your list of dependencies in
mix.exs
:
def deps do
[{:skroutz, "~> version_here"}]
end
- Ensure skroutz is started before your application:
def application do
[applications: [:skroutz]]
end
# With OAuth2.0 credentials
{:ok, skroutz} = Skroutz.new(%{client_id: "id", client_secret: "secret"})
# With OAuth2.0 credentials, for the Alve flavor
{:ok, alve} = Skroutz.new(%{client_id: "id",
client_secret: "secret",
flavor: :alve})
# With existing Oauth2.0 access token
{:ok, skroutz} = Skroutz.new("a valid access token")
{:ok, skroutz} = Skroutz.new("a valid token")
skroutz |> Skroutz.Search.search("nexus 6")
Reminder: You can use Module.module_info(:exports) to get a list of functions available on a module. Then you can use
h
insideiex
to print documentation.
h Skroutz.Category.find
# Prints documentation for the function
{:ok, skroutz} = Skroutz.new("a valid token")
# Get a specific category
skroutz |> Skroutz.Category.find(40)
The project has been tested to work with elixir version 1.2.
It may inadvertently work (or seem to work) with other versions, however compatibility and support are not guaranteed.
mix test
iex -S mix
In order for the client to make requests against our API, a valid set of OAuth2.0 credentials provided by us has to be used.
To get yours send an email at [[email protected]](mailto: [email protected]).
Copyright (c) 2016 Dimitris Zorbas, MIT Licence. See LICENSE.txt for further details.