From 1035640a2bdd5653049ee2fd6bbcaf23c87463ae Mon Sep 17 00:00:00 2001 From: "Kian-Meng, Ang" Date: Tue, 24 Aug 2021 23:12:27 +0800 Subject: [PATCH] Misc doc changes Besides other documentation changes, this commit ensures the generated HTML doc for HexDocs.pm will become the source of truth for this Elixir library and leverage on latest features of ExDoc. --- .formatter.exs | 3 +- .gitignore | 27 ++- CHANGELOG.md | 9 +- README.md | 27 ++- doc/.build | 25 ++- doc/404.html | 81 ++++--- doc/Cloudex.CloudinaryApi.Live.html | 238 --------------------- doc/Cloudex.CloudinaryApi.html | 229 +++++++++++++++----- doc/Cloudex.DeletedImage.html | 96 ++++++--- doc/Cloudex.EnvOptions.html | 163 ++++++++++---- doc/Cloudex.Settings.html | 283 ++++++++++++++++++------- doc/Cloudex.UploadedImage.html | 167 ++++++++------- doc/Cloudex.Url.html | 198 +++++++++-------- doc/Cloudex.html | 266 ++++++++++++++++++----- doc/api-reference.html | 126 ++++++++--- doc/dist/html-d9f58a6320b5bfa6dd77.css | 3 - doc/dist/html-d9f58a6320b5bfa6dd77.js | 89 -------- doc/dist/search_items-23c2256b54.js | 1 - doc/dist/sidebar_items-e72aa6586e.js | 1 - doc/index.html | 7 +- doc/search.html | 79 ++++--- lib/cloudex/settings.ex | 2 +- lib/cloudex/uploaded_image.ex | 2 +- mix.exs | 38 +++- mix.lock | 10 +- 25 files changed, 1281 insertions(+), 889 deletions(-) delete mode 100644 doc/Cloudex.CloudinaryApi.Live.html delete mode 100644 doc/dist/html-d9f58a6320b5bfa6dd77.css delete mode 100644 doc/dist/html-d9f58a6320b5bfa6dd77.js delete mode 100644 doc/dist/search_items-23c2256b54.js delete mode 100644 doc/dist/sidebar_items-e72aa6586e.js diff --git a/.formatter.exs b/.formatter.exs index 2bed17c..d2cda26 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,3 +1,4 @@ +# Used by "mix format" [ - inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"] + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] ] diff --git a/.gitignore b/.gitignore index 72eb5cb..813e9f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,26 @@ -/_build -/cover -/deps +# The directory Mix will write compiled artifacts to. +/_build/ + +# If you run "mix test --cover", coverage assets end up here. +/cover/ + +# The directory Mix downloads your dependencies sources to. +/deps/ + +# Where third-party dependencies like ExDoc output generated docs. +/doc/ + +# Ignore .fetch files in case you like to edit your project deps locally. +/.fetch + +# If the VM crashes, it generates a dump, let's ignore it too. erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). *.ez -/.elixir_ls \ No newline at end of file +# Ignore package tarball (built via "mix hex.build"). +cloudex-*.tar + +# Temporary files, for example, from tests. +/tmp/ diff --git a/CHANGELOG.md b/CHANGELOG.md index c45786a..05bea53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,17 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + # 1.4.1 (2020-03-01) - Thanks @tonnenpinguin for adding options to delete private images like: `Cloudex.delete(public_id, %{resource_type: "image", type: "private"})` # 1.4.0 (2020-02-27) - Thanks @davepersing to Allow S3 paths to be passed to Cloudinary when using a private bucket. - Thanks @saicoder for bumping httpoison and timex - + ## 1.3.0 (2019-06-07) diff --git a/README.md b/README.md index f1f69e0..2474990 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ Cloudex ====== + [![](https://img.shields.io/hexpm/v/cloudex.svg)](https://hex.pm/packages/cloudex) ![](https://img.shields.io/hexpm/dt/cloudex.svg) ![](https://img.shields.io/hexpm/dw/cloudex.svg) ![](https://img.shields.io/coveralls/smeevil/cloudex.svg) [![](https://img.shields.io/github/issues/smeevil/cloudex.svg)](https://github.com/smeevil/cloudex/issues) [![](https://img.shields.io/github/issues-pr/smeevil/cloudex.svg)](https://github.com/smeevil/cloudex/pulls) ![](https://semaphoreci.com/api/v1/smeevil/cloudex/branches/master/shields_badge.svg) Cloudex is an Elixir library that can upload image files or urls to Cloudinary. @@ -9,11 +10,13 @@ There is also a [CLI tool](https://github.com/smeevil/cloudex_cli) available. ```elixir defp deps do - [ {:cloudex, "~> 1.3.0"}, ] + [ + {:cloudex, "~> 1.3.0"}, + ] end ``` -If you are using elixir 1.4, you can skip this step. +If you are using Elixir 1.4 onwards, you can skip this step. The Cloudex app must be started. This can be done by adding :cloudex to the applications list in your mix.exs file. An example: @@ -30,13 +33,13 @@ Cloudex requires the API credentials of your Cloudinary account. You can define either as ENV settings using the keys : ```CLOUDEX_API_KEY``` ```CLOUDEX_SECRET``` and ```CLOUDEX_CLOUD_NAME``` -or in your config.exs using : +or in your config.exs using: ```elixir - config :cloudex, - api_key: "my-api-key", - secret: "my-secret", - cloud_name: "my-cloud-name" +config :cloudex, + api_key: "my-api-key", + secret: "my-secret", + cloud_name: "my-cloud-name" ``` [Jason](http://github.com/michalmuskala/jason) is the default json library in Cloudex. You can configure Cloudex to use another library. For example: @@ -45,11 +48,11 @@ or in your config.exs using : config :cloudex, :json_library, YourLibraryOfChoice ``` - ## Uploading You can upload image files or urls pointing to an image as follows : ### example + For uploading a url : ```elixir iex> Cloudex.upload("http://example.org/test.jpg") @@ -57,11 +60,13 @@ iex> Cloudex.upload("http://example.org/test.jpg") ``` For uploading a file : + ```elixir iex> Cloudex.upload("test/assets/test.jpg") {:ok, %Cloudex.UploadedImage{...}} ``` You can also upload a list of files, urls, or mix by giving upload a list like : + ```elixir iex> Cloudex.upload(["/non/existing/file.jpg", "http://example.org/test.jpg"]) [{:error, "File /non/existing/file.jpg does not exist."}, {:ok, %Cloudex.UploadedImage{...}}] @@ -241,6 +246,8 @@ cl_image_tag(public_id, class: "thumbnail", transforms: %{opacity: "50", quality Documentation can be found at docs/index.html or [online](http://smeevil.github.io/cloudex) -## License +## Copyright and License + +Copyright (C) 2004 Sam Hocevar -The Cloudex Elixir library is released under the DWTFYW license. See the LICENSE file. +The Cloudex Elixir library is released under the DWTFYW license. See the [LICENSE](./LICENSE.md) file. diff --git a/doc/.build b/doc/.build index 939a1d4..5a54965 100644 --- a/doc/.build +++ b/doc/.build @@ -1,19 +1,22 @@ -dist/search_items-23c2256b54.js -dist/html-d9f58a6320b5bfa6dd77.css -dist/html-d9f58a6320b5bfa6dd77.js -dist/html/fonts/icomoon.eot -dist/html/fonts/icomoon.svg -dist/html/fonts/icomoon.ttf -dist/html/fonts/icomoon.woff -dist/sidebar_items-e72aa6586e.js -api-reference.html -search.html 404.html -Cloudex.html Cloudex.CloudinaryApi.html Cloudex.DeletedImage.html Cloudex.EnvOptions.html Cloudex.Settings.html Cloudex.UploadedImage.html Cloudex.Url.html +Cloudex.html +api-reference.html +changelog.html +dist/app-f27ff079945e43879c46.js +dist/elixir-a172fe91e725dcb259e2.css +dist/html/fonts/icomoon.eot +dist/html/fonts/icomoon.svg +dist/html/fonts/icomoon.ttf +dist/html/fonts/icomoon.woff +dist/search_items-61899aea40.js +dist/sidebar_items-f23759e08f.js index.html +license.html +readme.html +search.html diff --git a/doc/404.html b/doc/404.html index bc35c03..8d69c59 100644 --- a/doc/404.html +++ b/doc/404.html @@ -4,17 +4,30 @@ - - - 404 — cloudex v1.3.0 - - + + + + 404 — cloudex v1.4.1 + + + + - - + + + + - + +
- @@ -41,18 +54,20 @@ @@ -64,31 +79,42 @@
- + +
Link to this function -

delete(item, opts \\ %{}) - +

delete(item, opts \\ %{})

+ + + + View Source + + + +
+ +
+ +

Specs

+
delete(String.t(), map()) ::
-  {:ok, %Cloudex.DeletedImage{public_id: term()}} | {:error, any()}
+ {:ok, %Cloudex.DeletedImage{public_id: term(), response: term()}} + | {:error, any()} +
-
-
+

Deletes an image given a public id

- + +
Link to this function -

delete_prefix(prefix, opts \\ %{}) - +

delete_prefix(prefix, opts \\ %{})

+ + + + View Source + + + +
+ +
+ +

Specs

+
delete_prefix(String.t(), map()) :: {:ok, String.t()} | {:error, any()}
+
-
-
+

Deletes images given their prefix

-
+ +
Link to this function -

json_result_to_struct(result, source) - +

json_result_to_struct(result, source)

+ + + + View Source + + + +
+ +
+ +

Specs

+
json_result_to_struct(map(), String.t()) :: %Cloudex.UploadedImage{
   bytes: term(),
   context: term(),
@@ -198,28 +278,41 @@ 

json_result_to_struct(result, source) version: term(), width: term() }

+
-
-
+

Converts the json result from cloudinary to a %UploadedImage{} struct

- + +
Link to this function -

upload(item, opts \\ %{}) - +

upload(item, opts \\ %{})

+ + + + View Source + + + +
+ +
+ +

Specs

+
upload(String.t() | {:ok, String.t()}, map()) ::
   {:ok, Cloudex.UploadedImage.t()} | {:error, any()}
+
- -
+

Upload either a file or url to cloudinary opts can contain: %{resource_type: "video"} @@ -229,35 +322,59 @@

upload(item, opts \\ %{})

-
+ +
Link to this function -

url(resource_type) -

+

url(resource_type)

+ + + + View Source + + + +
+
+ +
+
-