Skip to content

Commit

Permalink
Merge pull request #98 from CargoSense/1.2-updates
Browse files Browse the repository at this point in the history
minor tweaks
  • Loading branch information
benwilson512 committed Dec 2, 2015
2 parents e667050 + 259a198 commit f8a3a06
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 25 deletions.
2 changes: 0 additions & 2 deletions lib/ex_aws/dynamo.ex
@@ -1,7 +1,5 @@
defmodule ExAws.Dynamo do
use ExAws.Dynamo.Client

@moduledoc false

def config_root, do: Application.get_all_env(:ex_aws)
end
12 changes: 6 additions & 6 deletions lib/ex_aws/dynamo/encodable.ex
Expand Up @@ -33,14 +33,14 @@ end
defimpl ExAws.Dynamo.Encodable, for: Any do

defmacro __deriving__(module, struct, options) do
ExAws.Dynamo.Encodable.Any.do_deriving(module, struct, options)
deriving(module, struct, options)
end

def do_deriving(module, _struct, options) do
if only = options[:only] do
extractor = quote(do: Map.take(struct, unquote(only)))
def deriving(module, _struct, options) do
extractor = if only = options[:only] do
quote(do: Map.take(struct, unquote(only)))
else
extractor = quote(do: :maps.remove(:__struct__, struct))
quote(do: :maps.remove(:__struct__, struct))
end

quote do
Expand All @@ -58,7 +58,7 @@ end
defimpl ExAws.Dynamo.Encodable, for: Map do

defmacro __deriving__(module, struct, options) do
ExAws.Dynamo.Encodable.Any.do_deriving(module, struct, options)
ExAws.Dynamo.Encodable.Any.deriving(module, struct, options)
end

def encode(map, options) do
Expand Down
3 changes: 0 additions & 3 deletions lib/ex_aws/kinesis.ex
@@ -1,8 +1,5 @@
defmodule ExAws.Kinesis do
use ExAws.Kinesis.Client

@moduledoc false

def config_root, do: Application.get_all_env(:ex_aws)

end
1 change: 0 additions & 1 deletion lib/ex_aws/kinesis/client.ex
Expand Up @@ -66,7 +66,6 @@ defmodule ExAws.Kinesis.Client do
Same as describe_stream/1,2 except the shards key is a stream and will automatically handle pagination
Returns the normally shaped AWS response, except the Shards key is now a stream
"""
@doc "Stream Shards"
defcallback stream_shards(stream_name :: stream_name) :: Enumerable.t
defcallback stream_shards(stream_name :: stream_name, opts :: describe_stream_opts) :: Enumerable.t

Expand Down
2 changes: 0 additions & 2 deletions lib/ex_aws/lambda.ex
@@ -1,7 +1,5 @@
defmodule ExAws.Lambda do
use ExAws.Lambda.Client

@moduledoc false

def config_root, do: Application.get_all_env(:ex_aws)
end
2 changes: 0 additions & 2 deletions lib/ex_aws/s3.ex
@@ -1,7 +1,5 @@
defmodule ExAws.S3 do
use ExAws.S3.Client

@moduledoc false

def config_root, do: Application.get_all_env(:ex_aws)
end
4 changes: 2 additions & 2 deletions mix.exs
Expand Up @@ -3,7 +3,7 @@ defmodule ExAws.Mixfile do

def project do
[app: :ex_aws,
version: "0.4.12",
version: "0.4.13",
elixir: "~> 1.0",
description: "AWS client. Currently supports Dynamo, Kinesis, Lambda, S3, SQS",
name: "ExAws",
Expand All @@ -25,7 +25,7 @@ defmodule ExAws.Mixfile do

defp deps(:test_dev) do
[
{:sweet_xml, "~> 0.4.0", optional: true},
{:sweet_xml, "~> 0.5", optional: true},
{:earmark, "~> 0.1", only: :dev},
{:ex_doc, "~> 0.7", only: :dev},
{:httpoison, "~> 0.7", optional: true},
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Expand Up @@ -9,4 +9,4 @@
"mixunit": {:hex, :mixunit, "0.9.2"},
"poison": {:hex, :poison, "1.2.1"},
"ssl_verify_hostname": {:hex, :ssl_verify_hostname, "1.0.5"},
"sweet_xml": {:hex, :sweet_xml, "0.4.0"}}
"sweet_xml": {:hex, :sweet_xml, "0.5.0"}}
5 changes: 0 additions & 5 deletions test/lib/ex_aws/dynamo/encoder_test.exs
Expand Up @@ -16,11 +16,6 @@ defmodule ExAws.Dynamo.EncoderTest do
assert %{"M" => %{"bar" => %{"M" => %{"baz" => %{"N" => "2"}, "zounds" => %{"S" => "asdf"}}}, "foo" => %{"N" => "1"}}} == result
end

test "Encoder handles hashdicts" do
dict = %{foo: 1, bar: 2} |> Enum.into(HashDict.new)
assert dict |> Encoder.encode == %{"M" => %{"bar" => %{"N" => "2"}, "foo" => %{"N" => "1"}}}
end

test "Encoder can handle floats" do
assert Encoder.encode(0.4) == %{"N" => "0.4"}
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.exs
Expand Up @@ -2,7 +2,7 @@ Code.require_file("default_helper.exs", __DIR__)
Code.require_file("alternate_helper.exs", __DIR__)

defmodule Test.User do
@derive [ExAws.Dynamo.Encodable]
@derive ExAws.Dynamo.Encodable
defstruct [:email, :name, :age, :admin]

defimpl ExAws.Dynamo.Decodable do
Expand Down

0 comments on commit f8a3a06

Please sign in to comment.