Skip to content

Commit

Permalink
add description
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-chechaev committed May 9, 2016
1 parent c29a22f commit 15e1a35
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/_build
/cover
/deps
/doc
erl_crash.dump
*.ez
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Ipgeobase

**TODO: Add description**
***Find Russian and Ukraine city by IP address. Source http://ipgeobase.ru/***

## Examples

iex> ip = Ipgeobase.find_by_ip("46.188.121.160")
%Ipgeobase{city: "Москва", country: "RU"}
iex> ip.city
"Москва"
iex> ip.country
"RU"

## Installation

Expand Down
17 changes: 17 additions & 0 deletions lib/ipgeobase.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ defmodule Ipgeobase do

def host, do: @initial_state

@moduledoc false

@doc ~S"""
Find Russian and Ukraine city by IP address. Source http://ipgeobase.ru/
## Examples
iex> ip = Ipgeobase.find_by_ip("46.188.121.160")
%Ipgeobase{city: "Москва", country: "RU"}
iex> ip.city
"Москва"
iex> ip.country
"RU"
"""

def find_by_ip(ip) do
query = URI.encode_query(%{ip: ip})
uri_query = URI.to_string(URI.parse(host <> query))
Expand Down
14 changes: 13 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ defmodule Ipgeobase.Mixfile do
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
description: description,
package: package,
deps: deps]
end

Expand All @@ -16,6 +17,16 @@ defmodule Ipgeobase.Mixfile do
Find Russian and Ukraine city by IP address. Source http://ipgeobase.ru/
"""
end

defp package do
[
files: ["lib", "mix.exs", "README.md"],
maintainers: ["Sergey Chechaev"],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/sergey-chechaev/elixir_ipgeobase",
"Docs" => "https://hexdocs.pm/ipgeobase/0.0.1"}
]
end
# Configuration for the OTP application
#
# Type "mix help compile.app" for more information
Expand All @@ -36,7 +47,8 @@ defmodule Ipgeobase.Mixfile do
[
{:httpotion, "~> 2.2.0"},
{:floki, "~> 0.8"},
{:iconv, "~> 1.0"}
{:iconv, "~> 1.0"},
{:ex_doc, "~> 0.11", only: :dev},
]
end
end
3 changes: 2 additions & 1 deletion mix.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%{"floki": {:hex, :floki, "0.8.0"},
%{"ex_doc": {:hex, :ex_doc, "0.11.5"},
"floki": {:hex, :floki, "0.8.0"},
"httpotion": {:hex, :httpotion, "2.2.2"},
"ibrowse": {:hex, :ibrowse, "4.2.2"},
"iconv": {:hex, :iconv, "1.0.0"},
Expand Down

0 comments on commit 15e1a35

Please sign in to comment.