Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Introduce some low level Atom feed stuff. Include ibrowse.

  • Loading branch information...
commit 4e8790d47deed894ad39604c68090bf671d0ab0e 1 parent 0257514
@jlouis authored
View
5 Makefile
@@ -7,4 +7,7 @@ dialyzer:
rebar analyze
clean:
- rebar clean
+ rebar clean
+
+run:
+ erl -pz ./ebin ./deps/ibrowse/ebin
View
1  ebin/webstuff.app
@@ -8,4 +8,5 @@
{env,[]},
{modules,
[odata,odata_app,odata_sup,
+ atom,
uri,iri]}]}.
View
11 include/uri.hrl
@@ -0,0 +1,11 @@
+%% URI structures
+-record(hier,
+ {authority :: string() | none,
+ path :: string() | none}).
+
+-record(uri,
+ {scheme :: atom(),
+ hier :: #hier{},
+ q :: [{string(), string()}],
+ fragment :: string() | none}).
+
View
4 rebar.config
@@ -1,4 +1,6 @@
{erl_opts, [debug_info]}.
{xref_checks, [undefined_function_calls]}.
-
+{deps,
+ [{ibrowse, ".*",
+ {git, "git://github.com/halzy/ibrowse.git", "master"}}]}.
View
29 src/atom.erl
@@ -0,0 +1,29 @@
+%%%-------------------------------------------------------------------
+%%% File : atom.erl
+%%% Author : Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
+%%% Description :
+%%%
+%%% Created : 18 Oct 2010 by Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
+%%%-------------------------------------------------------------------
+-module(atom).
+-include("uri.hrl").
+%% API
+-export([get_feed/1]).
+
+%%====================================================================
+%% API
+%%====================================================================
+-spec get_feed(string() | #uri{}) -> term().
+get_feed(Uri) when is_record(Uri, uri) ->
+ get_feed(uri:to_string(Uri));
+get_feed(Uri) when is_list(Uri) ->
+ ibrowse:send_req(Uri, [], get).
+
+%%--------------------------------------------------------------------
+%% Function:
+%% Description:
+%%--------------------------------------------------------------------
+
+%%====================================================================
+%% Internal functions
+%%====================================================================
View
13 src/uri.erl
@@ -6,21 +6,14 @@
%%% Created : 14 Oct 2010 by Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
%%%-------------------------------------------------------------------
-module(uri).
+
+-include("uri.hrl").
+
%% API
-export([mk/2, mk/3, mk/4,
mk_hier/2,
to_iolist/1, to_string/1]).
--record(hier,
- {authority :: string() | none,
- path :: string() | none}).
-
--record(uri,
- {scheme :: atom(),
- hier :: #hier{},
- q :: [{string(), string()}],
- fragment :: string() | none}).
-
%%====================================================================
%% API
%%====================================================================
Please sign in to comment.
Something went wrong with that request. Please try again.