Просмотр исходного кода

Merge branch 'master' of git://github.com/voxoz/avz

Maxim Sokhatsky 11 лет назад
Родитель
Сommit
e354c6553d
4 измененных файлов с 15 добавлено и 4 удалено
  1. 6 0
      README.md
  2. 1 1
      src/github.erl
  3. 2 1
      src/google.erl
  4. 6 2
      src/twitter.erl

+ 6 - 0
README.md

@@ -22,6 +22,12 @@ API
     api_event/3          % Page Event for JavaScript based login methods
     callback/0           % Callback part of HTTP redirect based login methods
     registration_data/3  % Process Parameters
+    
+Usage
+-----
+
+Pretty short example is given at http://maxim.livejournal.com/421845.html (Russain) along
+with discussion how to design pages with N2O. Example of Login also could be found in [http://github.com/5HT/skyline](http://github.com/5HT/skyline) project.
 
 Credits
 -------

+ 1 - 1
src/github.erl

@@ -12,7 +12,7 @@
 -define(AUTHORIZE_URI, ?OAUTH_URI ++ "/authorize").
 -define(ACCESS_TOKEN_URI, ?OAUTH_URI ++ "/access_token").
 -define(API_URI, "https://api.github.com").
--define(REQ_HEADER, [{"User-Agent", "Erlang Paas"}]).
+-define(REQ_HEADER, [{"User-Agent", "Erlang PaaS"}]).
 
 user(Props) -> api_call("/user", Props).
 

+ 2 - 1
src/google.erl

@@ -17,7 +17,8 @@ registration_data(Props, google, Ori)->
     FamilyName = proplists:get_value(<<"familyName">>, Name#struct.lst),
     Image = proplists:get_value(<<"image">>, Props),
     {Id, Ori#user{ display_name = proplists:get_value(<<"displayName">>, Props),
-                   avatar = lists:nth(1,string:tokens(binary_to_list(proplists:get_value(<<"url">>, Image#struct.lst)), "?")),
+                   avatar = lists:nth(1,string:tokens(
+                       binary_to_list(proplists:get_value(<<"url">>, Image#struct.lst)), "?")),
                    email = email_prop(Props,google),
                    name = GivenName,
                    surname = FamilyName,

+ 6 - 2
src/twitter.erl

@@ -86,9 +86,13 @@ authorize_url(RequestToken)->
 
 show(Props)->
   URI = "https://api.twitter.com/1.1/users/show.json",
-  {ok, Response} = oauth:get(URI, [{"user_id", proplists:get_value("user_id", Props)}, {"include_entities", false}], ?CONSUMER, oauth:token(Props), oauth:token_secret(Props)),
+  {ok, Response} = oauth:get(URI, [{"user_id", proplists:get_value("user_id", Props)},
+                                   {"include_entities", false}],
+                            ?CONSUMER, oauth:token(Props), oauth:token_secret(Props)),
   case Response of
-    {HttpResponse, _, Body} -> case HttpResponse of {"HTTP/1.1", 200, "OK"} ->  n2o_json:decode(Body); _-> error end;
+    {HttpResponse, _, Body} -> case HttpResponse of
+                                    {"HTTP/1.1", 200, "OK"} ->  n2o_json:decode(Body);
+                                    _-> error end;
     _ -> error
   end.