Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
craigp committed Mar 4, 2016
1 parent 5425fd7 commit 910b626
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 40 deletions.
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) [year] [fullname]
Copyright (c) 2016 Craig Paterson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -6,7 +6,7 @@ elixir-gmail
[![hex.pm downloads](https://img.shields.io/hexpm/dt/gmail.svg)](https://hex.pm/packages/gmail)
[![Inline docs](http://inch-ci.org/github/craigp/elixir-gmail.svg?branch=master&style=flat)](http://inch-ci.org/github/craigp/elixir-gmail)

A simple Gmail REST API client for Elixir, mostly built as a learning exercise.
A simple Gmail REST API client for Elixir.

You can find the hex package [here](https://hex.pm/packages/gmail), and the docs [here](http://hexdocs.pm/gmail).

Expand All @@ -18,7 +18,7 @@ First, add the client to your `mix.exs` dependencies:

```elixir
def deps do
[{:gmail, "~> 0.0.17"}]
[{:gmail, "~> 0.1"}]
end
```

Expand Down
6 changes: 3 additions & 3 deletions lib/gmail.ex
@@ -1,7 +1,7 @@
defmodule Gmail do

@moduledoc """
A simple Gmail REST API client for Elixir, mostly built as a learning exercise.
A simple Gmail REST API client for Elixir.
You can find the hex package [here](https://hex.pm/packages/gmail), and the docs [here](http://hexdocs.pm/gmail).
Expand All @@ -13,7 +13,7 @@ defmodule Gmail do
```elixir
def deps do
[{:gmail, "~> 0.0.17"}]
[{:gmail, "~> 0.0.17"}]
end
```
Expand All @@ -23,7 +23,7 @@ defmodule Gmail do
```elixir
def application do
[applications: [:logger, :gmail]]
[applications: [:logger, :gmail]]
end
```
Expand Down
2 changes: 1 addition & 1 deletion lib/gmail/oauth2.ex
Expand Up @@ -19,7 +19,7 @@ defmodule Gmail.OAuth2 do

@type t :: %__MODULE__{}

@auth_url "https://accounts.google.com/o/oauth2/auth"
# @auth_url "https://accounts.google.com/o/oauth2/auth"
@token_url "https://accounts.google.com/o/oauth2/token"
@token_headers %{"Content-Type" => "application/x-www-form-urlencoded"}
@scope "https://mail.google.com/"
Expand Down
17 changes: 9 additions & 8 deletions mix.exs
Expand Up @@ -3,12 +3,12 @@ defmodule Gmail.Mixfile do

def project do
[app: :gmail,
version: "0.0.18",
version: "0.1.0",
elixir: "~> 1.2",
deps: deps,
test_coverage: [tool: ExCoveralls],
preferred_cli_env: ["coveralls": :test, "coveralls.detail": :test, "coveralls.post": :test],
description: "A simple Gmail REST API client for Elixir, mostly built as a learning exercise",
description: "A simple Gmail REST API client for Elixir",
package: package]
end

Expand All @@ -20,16 +20,16 @@ defmodule Gmail.Mixfile do
defp deps do
[
{:httpoison, "~> 0.8"},
{:poison, "~> 1.5"},
{:timex, "~> 0.19"},
{:poison, "~> 2.1"},
{:timex, "~> 1.0"},
{:mock, "~> 0.1", only: :test},
{:excoveralls, "~> 0.4", only: :test},
{:excoveralls, "~> 0.5", only: :test},
{:earmark, "~> 0.2", only: :dev},
{:ex_doc, "~> 0.11", only: :dev},
{:dialyxir, "~> 0.3", only: :dev},
{:credo, "~> 0.2", only: :dev},
{:credo, "~> 0.3", only: :dev},
{:bypass, "~> 0.1", only: :test},
{:inch_ex, only: :docs}
{:inch_ex, "~> 0.5", only: :docs}
]
end

Expand All @@ -39,7 +39,8 @@ defmodule Gmail.Mixfile do
files: ["lib", "mix.exs", "README*"],
licenses: ["MIT"],
maintainers: ["Craig Paterson"],
links: %{"Github" => "https://github.com/craigp/elixir-gmail"}]
links: %{"Github" => "https://github.com/craigp/elixir-gmail"}
]
end

end
14 changes: 7 additions & 7 deletions mix.lock
@@ -1,4 +1,4 @@
%{"bunt": {:hex, :bunt, "0.1.4"},
%{"bunt": {:hex, :bunt, "0.1.5"},
"bypass": {:hex, :bypass, "0.5.1"},
"certifi": {:hex, :certifi, "0.3.0"},
"combine": {:hex, :combine, "0.7.0"},
Expand All @@ -8,19 +8,19 @@
"dialyxir": {:hex, :dialyxir, "0.3.3"},
"earmark": {:hex, :earmark, "0.2.1"},
"ex_doc": {:hex, :ex_doc, "0.11.4"},
"excoveralls": {:hex, :excoveralls, "0.4.6"},
"excoveralls": {:hex, :excoveralls, "0.5.1"},
"exjsx": {:hex, :exjsx, "3.2.0"},
"hackney": {:hex, :hackney, "1.4.8"},
"hackney": {:hex, :hackney, "1.4.10"},
"httpoison": {:hex, :httpoison, "0.8.1"},
"idna": {:hex, :idna, "1.0.3"},
"idna": {:hex, :idna, "1.1.0"},
"inch_ex": {:hex, :inch_ex, "0.5.1"},
"jsx": {:hex, :jsx, "2.6.2"},
"meck": {:hex, :meck, "0.8.4"},
"mimerl": {:hex, :mimerl, "1.0.2"},
"mock": {:hex, :mock, "0.1.1"},
"plug": {:hex, :plug, "1.1.1"},
"poison": {:hex, :poison, "1.5.2"},
"plug": {:hex, :plug, "1.1.2"},
"poison": {:hex, :poison, "2.1.0"},
"ranch": {:hex, :ranch, "1.2.1"},
"ssl_verify_hostname": {:hex, :ssl_verify_hostname, "1.0.5"},
"timex": {:hex, :timex, "0.19.5"},
"timex": {:hex, :timex, "1.0.2"},
"tzdata": {:hex, :tzdata, "0.5.6"}}
12 changes: 4 additions & 8 deletions test/gmail/message_test.exs
Expand Up @@ -110,9 +110,8 @@ defmodule Gmail.MessageTest do
bypass: bypass
} do
email = "user@example.com"
email_encoded = "user%40example.com" # for some reason URI.encode/1 doesn't encode the @
Bypass.expect bypass, fn conn ->
assert "/gmail/v1/users/#{email_encoded}/messages/#{message_id}" == conn.request_path
assert "/gmail/v1/users/#{email}/messages/#{message_id}" == conn.request_path
assert "format=full" == conn.query_string
{:ok, json} = Poison.encode(message)
Plug.Conn.resp(conn, 200, json)
Expand All @@ -131,9 +130,8 @@ defmodule Gmail.MessageTest do
message_not_found: message_not_found
} do
email = "user@example.com"
email_encoded = "user%40example.com" # for some reason URI.encode/1 doesn't encode the @
Bypass.expect bypass, fn conn ->
assert "/gmail/v1/users/#{email_encoded}/messages/#{message_id}" == conn.request_path
assert "/gmail/v1/users/#{email}/messages/#{message_id}" == conn.request_path
assert "format=full" == conn.query_string
{:ok, json} = Poison.encode(message_not_found)
Plug.Conn.resp(conn, 200, json)
Expand All @@ -151,9 +149,8 @@ defmodule Gmail.MessageTest do
four_hundred_error: four_hundred_error
} do
email = "user@example.com"
email_encoded = "user%40example.com" # for some reason URI.encode/1 doesn't encode the @
Bypass.expect bypass, fn conn ->
assert "/gmail/v1/users/#{email_encoded}/messages/#{message_id}" == conn.request_path
assert "/gmail/v1/users/#{email}/messages/#{message_id}" == conn.request_path
assert "format=full" == conn.query_string
{:ok, json} = Poison.encode(four_hundred_error)
Plug.Conn.resp(conn, 200, json)
Expand Down Expand Up @@ -192,9 +189,8 @@ defmodule Gmail.MessageTest do
bypass: bypass
} do
email = "user@example.com"
email_encoded = "user%40example.com" # for some reason URI.encode/1 doesn't encode the @
Bypass.expect bypass, fn conn ->
assert "/gmail/v1/users/#{email_encoded}/messages" == conn.request_path
assert "/gmail/v1/users/#{email}/messages" == conn.request_path
assert "q=in:Inbox" == conn.query_string
{:ok, json} = Poison.encode(%{"messages" => [message]})
Plug.Conn.resp(conn, 200, json)
Expand Down
15 changes: 5 additions & 10 deletions test/gmail/thread_test.exs
Expand Up @@ -136,9 +136,8 @@ defmodule Gmail.ThreadTest do
expected_result: expected_result
} do
email = "user@example.com"
email_encoded = "user%40example.com" # for some reason URI.encode/1 doesn't encode the @
Bypass.expect bypass, fn conn ->
assert "/gmail/v1/users/#{email_encoded}/threads/#{thread_id}" == conn.request_path
assert "/gmail/v1/users/#{email}/threads/#{thread_id}" == conn.request_path
assert "format=full" == conn.query_string
assert "GET" == conn.method
assert {"authorization", "Bearer #{access_token}"} in conn.req_headers
Expand Down Expand Up @@ -211,10 +210,9 @@ defmodule Gmail.ThreadTest do
access_token_rec: access_token_rec,
} do
email = "user@example.com"
email_encoded = "user%40example.com" # for some reason URI.encode/1 doesn't encode the @
query = "in:Inbox"
Bypass.expect bypass, fn conn ->
assert "/gmail/v1/users/#{email_encoded}/threads" == conn.request_path
assert "/gmail/v1/users/#{email}/threads" == conn.request_path
assert "q=#{query}" == conn.query_string
{:ok, json} = Poison.encode(search_results)
Plug.Conn.resp(conn, 200, json)
Expand Down Expand Up @@ -255,9 +253,8 @@ defmodule Gmail.ThreadTest do
threads: threads
} do
email = "user@example.com"
email_encoded = "user%40example.com" # for some reason URI.encode/1 doesn't encode the @
Bypass.expect bypass, fn conn ->
assert "/gmail/v1/users/#{email_encoded}/threads" == conn.request_path
assert "/gmail/v1/users/#{email}/threads" == conn.request_path
assert "" == conn.query_string
{:ok, json} = Poison.encode(threads)
Plug.Conn.resp(conn, 200, json)
Expand All @@ -278,10 +275,9 @@ defmodule Gmail.ThreadTest do
next_page_token: next_page_token
} do
email = "user@example.com"
email_encoded = "user%40example.com" # for some reason URI.encode/1 doesn't encode the @
requested_page_token = "435453455"
Bypass.expect bypass, fn conn ->
assert "/gmail/v1/users/#{email_encoded}/threads" == conn.request_path
assert "/gmail/v1/users/#{email}/threads" == conn.request_path
assert "pageToken=#{requested_page_token}" == conn.query_string
{:ok, json} = Poison.encode(threads)
Plug.Conn.resp(conn, 200, json)
Expand All @@ -302,9 +298,8 @@ defmodule Gmail.ThreadTest do
threads: threads
} do
email = "user@example.com"
email_encoded = "user%40example.com" # for some reason URI.encode/1 doesn't encode the @
Bypass.expect bypass, fn conn ->
assert "/gmail/v1/users/#{email_encoded}/threads" == conn.request_path
assert "/gmail/v1/users/#{email}/threads" == conn.request_path
assert "" == conn.query_string
{:ok, json} = Poison.encode(threads)
Plug.Conn.resp(conn, 200, json)
Expand Down

0 comments on commit 910b626

Please sign in to comment.