public
Description: OneBody is free, open-source, web-based social networking and online directory software for churches.
Homepage: http://beonebody.com
Clone URL: git://github.com/seven1m/onebody.git
onebody / app / views / administration / api_keys / show.html.erb
100644 47 lines (35 sloc) 1.37 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<h1>API</h1>
 
<% if @key %>
 
  <p>Your API login details:</p>
  <table>
    <tr>
      <th style="text-align:right;">Username:</th>
      <td><%=h @logged_in.email %></td>
    </tr>
    <tr>
      <th style="text-align:right;">Key:</th>
      <td><code id="key" style="display:none;"><%=h @key %></code><%= link_to_function 'display', "Element.show('key');Element.hide('key_link');", :id => 'key_link' %></td>
    <tr/>
  </table>
  
  <p><%= link_to 'Generate', administration_api_key_path, :method => 'post', :confirm => 'Are you sure you want to invalidate this key and create a new one?' %>
  a new API key or <%= link_to 'disable', administration_api_key_path, :method => 'delete', :confirm => 'Are you sure?' %> your key.</p>
  
  <h2>Help</h2>
  
  <p>
    To use the REST API with Ruby, you might do this:
  </p>
  
  <pre>
    require 'rubygems'
    require 'activeresource'
    
    class Person < ActiveResource::Base
      self.site = 'https://beonebody.com/api/<%=h Site.current.host %>/'
      self.user = 'user@example.com'
      self.password = 'api-key-goes-here'
    end
    
    Person.find(1)
    # => &lt;Person ...&gt;
  </pre>
 
<% else %>
 
  <p>You do not yet have an API key.
  <%= link_to 'Enable', administration_api_key_path, :method => 'post', :confirm => 'Are you sure you want to enable your API key?' %>
  your API key now.</p>
 
<% end %>