docs/lib/omniauth/strategies/dailycred.html in dailycred-0.1.30 vs docs/lib/omniauth/strategies/dailycred.html in dailycred-0.1.31

- old
+ new

@@ -11,19 +11,23 @@ <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="../../dailycred.html">dailycred.rb</a> + <a class="source" href="../../dailycred/acts_as_dailycred.html">acts_as_dailycred.rb</a> + <a class="source" href="../../dailycred/client.html">client.rb</a> + <a class="source" href="../../dailycred/engine.html">engine.rb</a> + <a class="source" href="../../dailycred/helper.html">helper.rb</a> + <a class="source" href="../../dailycred/middleware.html">middleware.rb</a> + <a class="source" href="../../dailycred/tests_helper.html">tests_helper.rb</a> + <a class="source" href="../../dailycred/user.html">user.rb</a> <a class="source" href="../../generators/dailycred_generator.html">dailycred_generator.rb</a> <a class="source" href="../../generators/templates/migration_create_user.html">migration_create_user.rb</a> <a class="source" href="../../generators/templates/omniauth.html">omniauth.rb</a> <a class="source" href="../../generators/templates/sessions_controller.html">sessions_controller.rb</a> <a class="source" href="../../generators/templates/user.html">user.rb</a> - <a class="source" href="../../middleware/middleware.html">middleware.rb</a> - <a class="source" href="../../omniauth-dailycred/version.html">version.rb</a> <a class="source" href="dailycred.html">dailycred.rb</a> - <a class="source" href="../../user/user.html">user.rb</a> </div> </div> </div> <table cellspacing=0 cellpadding=0> <thead> @@ -69,11 +73,11 @@ <p>default options</p> </td> <td class=code> <div class='highlight'><pre> <span class="n">option</span> <span class="ss">:client_options</span><span class="p">,</span> <span class="p">{</span> <span class="ss">:site</span> <span class="o">=&gt;</span> <span class="s2">&quot;https://www.dailycred.com&quot;</span><span class="p">,</span> - <span class="ss">:authorize_url</span> <span class="o">=&gt;</span> <span class="s1">&#39;/connect&#39;</span><span class="p">,</span> + <span class="ss">:authorize_url</span> <span class="o">=&gt;</span> <span class="s1">&#39;/oauth/authorize&#39;</span><span class="p">,</span> <span class="ss">:token_url</span> <span class="o">=&gt;</span> <span class="s1">&#39;/oauth/access_token&#39;</span> <span class="p">}</span></pre></div> </td> </tr> <tr id='section-4'> @@ -122,10 +126,11 @@ </div> <p>this step allows auth_params to be added to the url</p> </td> <td class=code> <div class='highlight'><pre> <span class="k">def</span> <span class="nf">request_phase</span> + <span class="nb">p</span> <span class="n">session</span><span class="o">[</span><span class="s1">&#39;omniauth.state&#39;</span><span class="o">]</span> <span class="no">OmniAuth</span><span class="o">::</span><span class="no">Strategies</span><span class="o">::</span><span class="no">Dailycred</span><span class="o">::</span><span class="no">AUTH_PARAMS</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">param</span><span class="o">|</span> <span class="n">val</span> <span class="o">=</span> <span class="n">session</span><span class="o">[</span><span class="s1">&#39;omniauth.params&#39;</span><span class="o">][</span><span class="n">param</span><span class="o">]</span> <span class="k">if</span> <span class="n">val</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="n">val</span><span class="o">.</span><span class="n">empty?</span> <span class="n">options</span><span class="o">[</span><span class="ss">:authorize_params</span><span class="o">]</span> <span class="o">||=</span> <span class="p">{}</span> <span class="n">options</span><span class="o">[</span><span class="ss">:authorize_params</span><span class="o">].</span><span class="n">merge!</span><span class="p">(</span><span class="n">param</span> <span class="o">=&gt;</span> <span class="n">val</span><span class="p">)</span> @@ -145,11 +150,11 @@ <p>This is the phase where the gem calls me.json, which returns information about the user</p> </td> <td class=code> <div class='highlight'><pre> <span class="k">def</span> <span class="nf">user</span> <span class="k">return</span> <span class="vi">@duser</span> <span class="k">if</span> <span class="o">!</span><span class="vi">@duser</span><span class="o">.</span><span class="n">nil?</span> - <span class="n">connection</span> <span class="o">=</span> <span class="no">Faraday</span><span class="o">::</span><span class="no">Connection</span><span class="o">.</span><span class="n">new</span> <span class="n">options</span><span class="o">.</span><span class="n">client_options</span><span class="o">[</span><span class="ss">:site</span><span class="o">]</span><span class="p">,</span> <span class="n">options</span><span class="o">.</span><span class="n">client_options</span><span class="o">[</span><span class="ss">:ssl</span><span class="o">]</span> + <span class="n">connection</span> <span class="o">=</span> <span class="no">Faraday</span><span class="o">::</span><span class="no">Connection</span><span class="o">.</span><span class="n">new</span> <span class="n">options</span><span class="o">.</span><span class="n">client_options</span><span class="o">[</span><span class="ss">:site</span><span class="o">]</span><span class="p">,</span> <span class="ss">:ssl</span> <span class="o">=&gt;</span> <span class="n">options</span><span class="o">.</span><span class="n">client_options</span><span class="o">[</span><span class="ss">:ssl</span><span class="o">]</span> <span class="n">response</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;/graph/me.json?access_token=</span><span class="si">#{</span><span class="n">access_token</span><span class="o">.</span><span class="n">token</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span> <span class="n">json</span> <span class="o">=</span> <span class="no">JSON</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">body</span><span class="p">)</span></pre></div> </td> </tr> <tr id='section-8'> @@ -164,13 +169,13 @@ <span class="vi">@duser</span><span class="o">[</span><span class="s1">&#39;provider&#39;</span><span class="o">]</span> <span class="o">=</span> <span class="s1">&#39;dailycred&#39;</span> <span class="vi">@duser</span><span class="o">[</span><span class="s1">&#39;uid&#39;</span><span class="o">]</span> <span class="o">=</span> <span class="n">json</span><span class="o">[</span><span class="s1">&#39;id&#39;</span><span class="o">]</span> <span class="o">||</span> <span class="n">json</span><span class="o">[</span><span class="s1">&#39;user_id&#39;</span><span class="o">]</span> <span class="no">OmniAuth</span><span class="o">::</span><span class="no">Strategies</span><span class="o">::</span><span class="no">Dailycred</span><span class="o">::</span><span class="no">ATTRIBUTES</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="kp">attr</span><span class="o">|</span> <span class="vi">@duser</span><span class="o">[</span><span class="kp">attr</span><span class="o">]</span> <span class="o">=</span> <span class="n">json</span><span class="o">[</span><span class="kp">attr</span><span class="o">]</span> <span class="k">end</span> - <span class="k">if</span> <span class="o">!</span><span class="n">json</span><span class="o">[</span><span class="s2">&quot;FACEBOOK&quot;</span><span class="o">].</span><span class="n">nil?</span> - <span class="vi">@duser</span><span class="o">[</span><span class="s1">&#39;facebook&#39;</span><span class="o">]</span> <span class="o">=</span> <span class="n">json</span><span class="o">[</span><span class="s2">&quot;FACEBOOK&quot;</span><span class="o">][</span><span class="s2">&quot;members&quot;</span><span class="o">]</span> - <span class="vi">@duser</span><span class="o">[</span><span class="s1">&#39;facebook&#39;</span><span class="o">][</span><span class="s1">&#39;access_token&#39;</span><span class="o">]</span> <span class="o">=</span> <span class="n">json</span><span class="o">[</span><span class="s2">&quot;FACEBOOK&quot;</span><span class="o">][</span><span class="s1">&#39;access_token&#39;</span><span class="o">]</span> - <span class="k">end</span></pre></div> + <span class="n">json</span><span class="o">[</span><span class="s2">&quot;identities&quot;</span><span class="o">].</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="o">|</span> + <span class="vi">@duser</span><span class="o">[</span><span class="n">k</span><span class="o">]</span> <span class="o">=</span> <span class="n">v</span> + <span class="vi">@duser</span><span class="o">[</span><span class="n">k</span><span class="o">][</span><span class="ss">:access_token</span><span class="o">]</span> <span class="o">=</span> <span class="n">json</span><span class="o">[</span><span class="s2">&quot;access_tokens&quot;</span><span class="o">][</span><span class="n">k</span><span class="o">]</span> + <span class="k">end</span> <span class="k">if</span> <span class="o">!</span><span class="n">json</span><span class="o">[</span><span class="s2">&quot;identities&quot;</span><span class="o">].</span><span class="n">nil?</span></pre></div> </td> </tr> <tr id='section-9'> <td class=docs> <div class="pilwrap">