Skip to content

piacerex/drivex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drivex

Drivex is a Google Drive API Elixir wrapper library. Here is an example:

iex> GoogleDrive.list()
%{"files" => [%{"id" => "1tDgypK1qrcg0oule4Cxxxxxxxy0L7CwN82G0JxC8",
     "kind" => "drive#file",
     "mimeType" => "application/vnd.google-apps.spreadsheet", "name" => "spreadsheet1"},
   %{"id" => "0B8yV3717Z-lxxxxxxxxxDaVE", "kind" => "drive#file",
     "mimeType" => "application/vnd.google-apps.folder", "name" => "folder1"},
...

iex> 

See the online documentation.

Installation

  1. Add to your mix.exs file:
def deps do
  [
    { :drivex, "~> 0.0.2" }
  ]
end
  1. Create or select a project at Google Drive API enabler wizard. Click Continue. Click Go to credentials.

  2. Select Other non-UI, Click Application data, Click No, I have not used., Click Required credentials.

  3. Input Service account name, Select Porject - Owner. Click next, Start download JSON automatically. Rename it to client_secret.json and move to config folder.

  4. Click Manage service accounts, Edit service account, Click Enable G Suite domain wide delegation.

  5. Browse Google Drive and set Collaboration Settings to any folder on add service account id(like [email protected]).

  6. Add to your config.exs file:

config :goth, 
  json: "./config/client_secret.json" |> File.read!
  1. Input following, It's success when listed Google Drive folders & files.
mix desp.get
iex -S mix
iex> GoogleDrive.list()
%{"files" => [%{"id" => "1tDgypK1qrcg0oule4Cxxxxxxxy0L7CwN82G0JxC8",
  "kind" => "drive#file",
  "mimeType" => "application/vnd.google-apps.spreadsheet", "name" => "spreadsheet1"},
%{"id" => "0B8yV3717Z-lxxxxxxxxxDaVE", "kind" => "drive#file",
  "mimeType" => "application/vnd.google-apps.folder", "name" => "folder1"},
...

License

This project is licensed under the terms of the Apache 2.0 license, see LICENSE.

About

Google Drive API Elixir wrapper library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages