Skip to content

Commit

Permalink
update to use Mapail 1.0 and make new release
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenmoloney committed Apr 17, 2017
1 parent 2adfcbf commit a88a52c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

[non-breaking changes]
- remove `test.exs`
- update `mapail` dependency to `1.0` - `Mapail` api changed.


## v0.3.1
Expand Down
52 changes: 38 additions & 14 deletions lib/openstex/keystone/v2/helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -132,48 +132,72 @@ defmodule Openstex.Keystone.V2.Helpers do
defmodule Identity.Token.Tenant do
@moduledoc :false
defstruct [:description, :enabled, :id, :name]
def build(map), do: Mapail.map_to_struct!(map, __MODULE__, [rest: :merge])
def build(map) do
opts = [rest: :merge, transformations: [:snake_case]]
Mapail.map_to_struct!(map, __MODULE__, opts)
end
end
defmodule Identity.Token do
@moduledoc :false
defstruct [:audit_ids, :issued_at, :expires, :id, tenant: %Identity.Token.Tenant{}]
def build(map), do: Mapail.map_to_struct!(map, __MODULE__, [rest: :merge])
def build(map) do
opts = [rest: :merge, transformations: [:snake_case]]
Mapail.map_to_struct!(map, __MODULE__, opts)
end
end
defmodule Identity.Service do
@moduledoc :false
defstruct [endpoints: [], endpoints_links: [], type: "", name: ""]
def build(map), do: Mapail.map_to_struct!(map, __MODULE__, [rest: :merge])
def build(map) do
opts = [rest: :merge, transformations: [:snake_case]]
Mapail.map_to_struct!(map, __MODULE__, opts)
end
end
defmodule Identity.Endpoint do
@moduledoc :false
defstruct [:admin_url, :region, :internal_url, :id, :public_url]
def build(map), do: Mapail.map_to_struct!(map, __MODULE__, [rest: :merge])
def build(map) do
opts = [rest: :merge, transformations: [:snake_case]]
Mapail.map_to_struct!(map, __MODULE__, opts)
end
end
defmodule Identity.User do
@moduledoc :false
defstruct [:username, :roles_links, :id, :roles, :name]
def build(map), do: Mapail.map_to_struct!(map, __MODULE__, [rest: :merge])
def build(map) do
opts = [rest: :merge, transformations: [:snake_case]]
Mapail.map_to_struct!(map, __MODULE__, opts)
end
end
defmodule Identity.Metadata do
@moduledoc :false
defstruct [:metadata, :is_admin, :roles]
def build(map), do: Mapail.map_to_struct!(map, __MODULE__, [rest: :merge])
def build(map) do
opts = [rest: :merge, transformations: [:snake_case]]
Mapail.map_to_struct!(map, __MODULE__, opts)
end
end
defmodule Identity.Trust do
@moduledoc :false
defstruct [:trust, :id, :trustee_user_id, :trustor_user_id, :impersonation]
def build(map), do: Mapail.map_to_struct!(map, __MODULE__, [rest: :merge])
def build(map) do
opts = [rest: :merge, transformations: [:snake_case]]
Mapail.map_to_struct!(map, __MODULE__, opts)
end
end
defmodule Identity do
@moduledoc :false
defstruct [
token: %Identity.Token{},
service_catalog: [],
user: %Identity.User{},
metadata: %Identity.Metadata{},
trust: %Identity.Trust{}
]
def build(map), do: Mapail.map_to_struct!(map, __MODULE__, [rest: :merge])
token: %Identity.Token{},
service_catalog: [],
user: %Identity.User{},
metadata: %Identity.Metadata{},
trust: %Identity.Trust{}
]
def build(map) do
opts = [rest: :merge, transformations: [:snake_case]]
Mapail.map_to_struct!(map, __MODULE__, opts)
end
end


Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Openstex.Mixfile do
use Mix.Project
@version "0.3.1"
@version "0.3.2"
@elixir "~> 1.4 or ~> 1.5"

def project do
Expand Down Expand Up @@ -31,7 +31,7 @@ defmodule Openstex.Mixfile do
[
# deps
{:poison, "~> 1.5 or ~> 2.0 or ~> 3.0"},
{:mapail, "~> 0.2"},
{:mapail, "~> 1.0"},
{:httpipe, "~> 0.9"},

# dev deps
Expand Down

0 comments on commit a88a52c

Please sign in to comment.