diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb17531..388dd6f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog
+
+## v0.4.0
+
+- Bump dependencies and remove many deprecations for elixir 1.5+
+
## v0.3.6
[changes]
diff --git a/README.md b/README.md
index b6b3e13..5481dc9 100644
--- a/README.md
+++ b/README.md
@@ -41,7 +41,7 @@ req = %HTTPipe.Request{
method: :get,
url: "/me/api/application/#{app_id}"
}
-|> MyApp.OvhClient.request!()
+MyApp.OvhClient.request!(req)
```
- `GET /cloud/project/{serviceName}/storage`
@@ -50,7 +50,7 @@ service_name = "service_name"
req = %HTTPipe.Request{
method: :get,
url: "/cloud/project/#{service_name}/storage"
-}s
+}
|> MyApp.OvhClient.request!()
```
@@ -82,7 +82,6 @@ ExOvh.V1.Cloud.get_containers(service_name) |> ExOvh.request!()
- [ ] Tests for OVH portion of library
- [ ] Option to set the application ttl when running ovh mix task.
-- [ ] Add queries for the remainder of the OVH API. (~~Webstorage CDN~~ (now a deprecated service) and Cloud are the only ones covered so far)
- [x] Basic examples to be added to readme of usage of the api.
- [ ] Add macro for building queries.
- [ ] Write the usage guide - more examples of using the API.
diff --git a/config/dev.exs b/config/dev.exs
index ce04a66..11a9d6a 100644
--- a/config/dev.exs
+++ b/config/dev.exs
@@ -15,5 +15,5 @@ config :ex_ovh,
recv_timeout: 180000
]
-#config :httpipe,
-# :adapter, HTTPipe.Adapters.Hackney
+config :httpipe,
+ :adapter, HTTPipe.Adapters.Hackney
diff --git a/docs/getting_started.md b/docs/getting_started.md
index 70d3360..4049dab 100644
--- a/docs/getting_started.md
+++ b/docs/getting_started.md
@@ -10,7 +10,7 @@ then substitute `Awesome` for `MyApp` and `AWESOME_OVH_CLIENT_` for `MY_APP_OVH_
```elixir
defp deps() do
- [{:ex_ovh, ">= 0.3.3"}]
+ [{:ex_ovh, "~> 0.4"}]
end
```
@@ -185,7 +185,10 @@ ExOvh.V1.Cloud.list_services() |> ExOvh.request!()
- `GET /cloud/project/{serviceName}/storage`
```
-ExOvh.V1.Cloud.get_containers(service_name) |> ExOvh.request!()
+resp1 = ExOvh.V1.Cloud.list_services() |> ExOvh.request!() |> Map.get(:response)
+service = Map.get(resp1, :body) |> List.last()
+resp2 = ExOvh.V1.Cloud.get_containers(service) |> ExOvh.request!() |> Map.get(:response)
+containers = Map.get(resp2, :body)
```
diff --git a/lib/ex_ovh/request.ex b/lib/ex_ovh/request.ex
index 31d389b..9f4c095 100644
--- a/lib/ex_ovh/request.ex
+++ b/lib/ex_ovh/request.ex
@@ -34,12 +34,6 @@ defmodule ExOvh.Request do
conn
end
conn =
- unless (:body in Map.get(conn, :completed_transformations, [])) do
- ExOvh.Transformation.Body.apply(conn, "")
- else
- conn
- end
- conn =
unless (:hackney_options in Map.get(conn, :completed_transformations, [])) do
ExOvh.Transformation.HackneyOptions.apply(conn, client)
else
diff --git a/lib/ex_ovh/transformation/auth.ex b/lib/ex_ovh/transformation/auth.ex
index d99df4b..3787c97 100644
--- a/lib/ex_ovh/transformation/auth.ex
+++ b/lib/ex_ovh/transformation/auth.ex
@@ -6,11 +6,11 @@ defmodule ExOvh.Transformation.Auth do
# Public
@spec apply(HTTPipe.Conn.t, atom) :: HTTPipe.Conn.t
- def apply(%HTTPipe.Conn{request: %HTTPipe.Request{method: method, headers: headers, url: url}} = conn, client) do
+ def apply(%HTTPipe.Conn{request: %HTTPipe.Request{method: method, body: body, headers: headers, url: url}} = conn, client) do
trans = Map.get(conn, :completed_transformations, [])
unless (Enum.member?(trans, :url)), do: raise ":url must be added to the transformations before applying the :auth step"
ovh_config = client.ovh_config()
- headers = Map.merge(headers, headers([ovh_config[:application_secret], ovh_config[:application_key], ovh_config[:consumer_key], Atom.to_string(method), url, ""], client))
+ headers = Map.merge(headers, headers([ovh_config[:application_secret], ovh_config[:application_key], ovh_config[:consumer_key], Atom.to_string(method), url, body], client))
request = Map.put(conn.request, :headers, headers)
Map.put(conn, :request, request)
|> Map.put(:completed_transformations, trans ++ [:auth])
diff --git a/lib/mix/tasks/ovh.ex b/lib/mix/tasks/ovh.ex
index 5cd4dbe..ed68498 100644
--- a/lib/mix/tasks/ovh.ex
+++ b/lib/mix/tasks/ovh.ex
@@ -52,8 +52,10 @@ defmodule Mix.Tasks.Ovh do
Mix.Shell.IO.info("")
Mix.Shell.IO.info("The details in the map above will be used to create the ovh application.")
Mix.Shell.IO.info("")
+
if Mix.Shell.IO.yes?("Proceed?") do
- :hackney.start()
+ Application.ensure_all_started(:hackney)
+
opts_map = parse_args(args)
message = get_credentials(opts_map)
@@ -165,17 +167,11 @@ defmodule Mix.Tasks.Ovh do
end)
|> Enum.reduce([], fn({method, concat_paths}, acc) ->
paths = concat_paths
- |> String.lstrip(?[)
- |> String.strip(?]) #rstrip has a bug but fixed in master (01/02/2016)
+ |> String.trim_leading(?[)
+ |> String.trim(?]) #rstrip has a bug but fixed in master (01/02/2016)
|> String.split(",")
- new_rules = Enum.filter_map(paths,
- fn(path) -> path !== "" end,
- fn(path) ->
- %{
- method: String.upcase(method),
- path: path
- }
- end)
+ new_rules = Enum.filter(paths, fn(path) -> path != "" end)
+ |> Enum.map(fn(path) -> %{method: String.upcase(method), path: path} end)
List.insert_at(acc, -1, new_rules)
end)
|> List.flatten()
@@ -352,7 +348,7 @@ defmodule Mix.Tasks.Ovh do
Floki.find(resp_body, "form select")
|> List.flatten()
|> Enum.filter(fn({_type, input, _options}) ->
- :proplists.get_value("name", input) !== "identifiant"
+ :proplists.get_value("name", input) != "identifiant"
end)
if Enum.any?(inputs, fn(input) -> input == [] end), do: raise "Inputs should not be empty"
inputs
diff --git a/mix.exs b/mix.exs
index 549e98c..4bf3dc1 100644
--- a/mix.exs
+++ b/mix.exs
@@ -1,7 +1,7 @@
defmodule ExOvh.Mixfile do
use Mix.Project
- @version "0.3.6"
- @elixir "~> 1.3 or ~> 1.4 or ~> 1.5"
+ @version "0.4.0"
+ @elixir "~> 1.5"
def project do
[
@@ -29,12 +29,12 @@ defmodule ExOvh.Mixfile do
[
{:calendar, "~> 0.17"},
{:poison, "~> 1.5 or ~> 2.0 or ~> 3.0"},
- {:httpipe_adapters_hackney, "~> 0.10"},
- {:floki, "~> 0.17.0"},
+ {:httpipe_adapters_hackney, "~> 0.11"},
+ {:floki, "~> 0.18"},
# dev deps
{:markdown, github: "devinus/markdown", only: :dev},
- {:ex_doc, "~> 0.14", only: :dev}
+ {:ex_doc, "~> 0.18", only: :dev}
]
end
diff --git a/mix.lock b/mix.lock
index dff676a..5fdf36e 100644
--- a/mix.lock
+++ b/mix.lock
@@ -1,17 +1,18 @@
-%{"calendar": {:hex, :calendar, "0.17.2", "d6b7bccc29c72203b076d4e488d967780bf2d123a96fafdbf45746fdc2fa342c", [:mix], [{:tzdata, "~> 0.5.8 or ~> 0.1.201603", [hex: :tzdata, optional: false]}]},
- "certifi": {:hex, :certifi, "1.0.0", "1c787a85b1855ba354f0b8920392c19aa1d06b0ee1362f9141279620a5be2039", [:rebar3], []},
- "earmark": {:hex, :earmark, "1.2.0", "bf1ce17aea43ab62f6943b97bd6e3dc032ce45d4f787504e3adf738e54b42f3a", [:mix], []},
- "ex_doc": {:hex, :ex_doc, "0.15.1", "d5f9d588fd802152516fccfdb96d6073753f77314fcfee892b15b6724ca0d596", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, optional: false]}]},
- "floki": {:hex, :floki, "0.17.0", "ee23700dac178f601ae8cd05f8d8890a3dfd131fba8972dd3676bcedcb14a18d", [:mix], [{:mochiweb, "~> 2.15", [hex: :mochiweb, optional: false]}]},
- "hackney": {:hex, :hackney, "1.7.1", "e238c52c5df3c3b16ce613d3a51c7220a784d734879b1e231c9babd433ac1cb4", [:rebar3], [{:certifi, "1.0.0", [hex: :certifi, optional: false]}, {:idna, "4.0.0", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, optional: false]}]},
+%{"calendar": {:hex, :calendar, "0.17.4", "22c5e8d98a4db9494396e5727108dffb820ee0d18fed4b0aa8ab76e4f5bc32f1", [], [{:tzdata, "~> 0.5.8 or ~> 0.1.201603", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm"},
+ "certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [], [], "hexpm"},
+ "earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [], [], "hexpm"},
+ "ex_doc": {:hex, :ex_doc, "0.18.1", "37c69d2ef62f24928c1f4fdc7c724ea04aecfdf500c4329185f8e3649c915baf", [], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
+ "floki": {:hex, :floki, "0.18.1", "6f903e3074357fe9756079d0f607e430589912f698b5c5e5970af08daba1537c", [], [{:mochiweb, "~> 2.15", [hex: :mochiweb, repo: "hexpm", optional: false]}], "hexpm"},
+ "hackney": {:hex, :hackney, "1.10.1", "c38d0ca52ea80254936a32c45bb7eb414e7a96a521b4ce76d00a69753b157f21", [], [{:certifi, "2.0.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
"hoedown": {:git, "https://github.com/hoedown/hoedown.git", "980b9c549b4348d50b683ecee6abee470b98acda", []},
- "httpipe": {:hex, :httpipe, "0.9.0", "4db66493b0ec2a86d142ea959a62e221d6ddb23ab48a676b691be3a16c38a415", [:mix], []},
- "httpipe_adapters_hackney": {:hex, :httpipe_adapters_hackney, "0.10.0", "53101fe8c2bb0753c7a18b11e495b2c38d1ec90519137a985e0633ae626b7f25", [:mix], [{:hackney, "~> 1.7.0", [hex: :hackney, optional: false]}, {:httpipe, "~> 0.9.0", [hex: :httpipe, optional: false]}]},
- "idna": {:hex, :idna, "4.0.0", "10aaa9f79d0b12cf0def53038547855b91144f1bfcc0ec73494f38bb7b9c4961", [:rebar3], []},
+ "httpipe": {:hex, :httpipe, "0.9.0", "4db66493b0ec2a86d142ea959a62e221d6ddb23ab48a676b691be3a16c38a415", [], [], "hexpm"},
+ "httpipe_adapters_hackney": {:hex, :httpipe_adapters_hackney, "0.11.0", "35c31b96fd6fea117f9ba6ca70467ada111dffb9f2fa7fca0bfc7e12bb166e8e", [], [{:hackney, "~> 1.8 or ~> 1.7 or ~> 1.6", [hex: :hackney, repo: "hexpm", optional: false]}, {:httpipe, "~> 0.9.0", [hex: :httpipe, repo: "hexpm", optional: false]}], "hexpm"},
+ "idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
"markdown": {:git, "https://github.com/devinus/markdown.git", "d065dbcc4e242a85ca2516fdadd0082712871fd8", []},
- "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []},
- "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []},
- "mochiweb": {:hex, :mochiweb, "2.15.0", "e1daac474df07651e5d17cc1e642c4069c7850dc4508d3db7263a0651330aacc", [:rebar3], []},
- "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], []},
- "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], []},
- "tzdata": {:hex, :tzdata, "0.5.12", "1c17b68692c6ba5b6ab15db3d64cc8baa0f182043d5ae9d4b6d35d70af76f67b", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, optional: false]}]}}
+ "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [], [], "hexpm"},
+ "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [], [], "hexpm"},
+ "mochiweb": {:hex, :mochiweb, "2.15.0", "e1daac474df07651e5d17cc1e642c4069c7850dc4508d3db7263a0651330aacc", [], [], "hexpm"},
+ "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [], [], "hexpm"},
+ "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [], [], "hexpm"},
+ "tzdata": {:hex, :tzdata, "0.5.12", "1c17b68692c6ba5b6ab15db3d64cc8baa0f182043d5ae9d4b6d35d70af76f67b", [], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},
+ "unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [], [], "hexpm"}}