/asanaficator

An elixir wrapper for Asana

Primary LanguageElixirMIT LicenseMIT

Build Status

Asanaficator

Simple Elixir wrapper for the Asana API. Based on Tentacat.

Documentation can be found here.

Features

  • Users
  • Tasks
    • Projects

Quickstart

Fetching dependencies and running on elixir console:

mix deps.get
iex -S mix

You will see something like this:

Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (0.13.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

Now you can run the examples!

Examples

Every call to Asana need a client.

Getting info from a user using a client

iex> client = Asanaficator.Client.new(%{access_token: "1234567890"})
Asanaficator.Client{auth: %{access_token: "1234567890"}, endpoint: "https://app.asana.com/api/1.0/"}
iex> Asanaficator.Users.me client
%{"data" => %{"email" => "john.doe@example.com", "id" => 123,
    "name" => "John Doe",
    "photo" => %{"image_128x128" => "https://s3.amazonaws.com/profile_photos/123.abc_128x128.png",
      "image_21x21" => "https://s3.amazonaws.com/profile_photos/123.abc_21x21.png",
      "image_27x27" => "https://s3.amazonaws.com/profile_photos/123.abc_27x27.png",
      "image_36x36" => "https://s3.amazonaws.com/profile_photos/123.abc_36x36.png",
      "image_60x60" => "https://s3.amazonaws.com/profile_photos/123.abc_60x60.png"},
    "workspaces" => [%{"id" => 456, "name" => "example.com"},
     %{"id" => 789, "name" => "Personal Projects"}]}}

Getting a task

iex> Asanaficator.Tasks.find(12345, client)
%{"data" => %{"assignee" => nil, "assignee_status" => "upcoming",
    "completed" => false, "completed_at" => nil,
    "created_at" => "2015-06-30T00:40:30.971Z", "due_at" => nil,
    "due_on" => nil,
    "followers" => [%{"id" => 123, "name" => "John Doe"}], "hearted" => false,
    "hearts" => [], "id" => 456,
    "memberships" => [%{"project" => %{"id" => 456,
         "name" => "That Awesome Project"}, "section" => nil}],
    "modified_at" => "2015-06-30T11:11:37.472Z",
    "name" => "This is an example task",
    "notes" => "Some really great descriptive notes",
    "num_hearts" => 0, "parent" => nil,
    "projects" => [%{"id" => 456,
       "name" => "That Awesome Project"}], "tags" => [],
    "workspace" => %{"id" => 456, "name" => "example.com"}}}

Contributing

Start by forking this repo

Then run this command to fetch dependencies and run tests:

MIX_ENV=test mix do deps.get, test

Pull requests are greatly appreciated