Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyabee committed Aug 29, 2016
1 parent f3729b1 commit 60acd89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/cloud_vision.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ defmodule CloudVision do
image_properties: "IMAGE_PROPERTIES", unspecified: "TYPE_UNSPECIFIED"
]

@doc """
Args:
* `img_path` - relative path to the image file from local directory or root of google cloud storage
* `options` - Keyword list of options
Options:
* `:from` - where to find the file. It can be `:storage` or `:local`. Default is `:local`
* `:features` - list of detection features you want to use (`@features`)
"""
def analyze(img_path, opts \\ []) do
case CloudVision.Client.post("/images:annotate", build_params(img_path, opts) |> Poison.encode!) do
{:ok, %HTTPoison.Response{status_code: x, body: body}} when x in 200..299 ->
Expand All @@ -24,7 +33,6 @@ defmodule CloudVision do
%{requests: [%{features: [%{type: "IMAGE_PROPERTIES"}],
image: %{source: %{gcsImageUri: "gs://dummy.appspot.com/cat.jpg"}}}]}
"""

def build_params(img_path, opts), do:
%{requests: [%{image: build_image(img_path, opts[:from]), features: build_features(opts[:features])}]}

Expand Down
2 changes: 2 additions & 0 deletions lib/cloud_vision/client.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
defmodule CloudVision.Client do
@moduledoc false

use HTTPoison.Base
alias Goth.Token

Expand Down

0 comments on commit 60acd89

Please sign in to comment.