apphunk 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,159 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <title>Apphunk::Config</title>
7
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
- <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
9
- <link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
10
- <script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
11
- <script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
12
- <script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
13
- </head>
14
-
15
- <body>
16
- <div class="banner">
17
- <h1>
18
- <span class="type">Module</span>
19
- Apphunk::Config
20
-
21
- </h1>
22
- <ul class="files">
23
-
24
- <li><a href="../../files/lib/apphunk/config_rb.html">lib/apphunk/config.rb</a></li>
25
-
26
- </ul>
27
- </div>
28
- <div id="bodyContent">
29
- <div id="content">
30
-
31
- <div class="description">
32
- <p>
33
- Used to configure the behaviour of <a href="../Apphunk.html">Apphunk</a>
34
- and its outgoing messages. Each option can be overriden by <a
35
- href="../Apphunk.html#M000006">Apphunk.log</a>&#8217;s <tt>option</tt>
36
- parameter. If <a href="../Apphunk.html">Apphunk</a> is used as part of a
37
- Rails application, the configuration should go to
38
- <tt>config/initializers/apphunk.rb</tt>.
39
- </p>
40
- <p>
41
- <b>Note</b>: The configuration must be set using <a
42
- href="../Apphunk.html#M000008">Apphunk.config</a> as shown in the example
43
- below.
44
- </p>
45
- <h4>Example</h4>
46
- <pre>
47
- Apphunk.config do |config|
48
- config.token = &quot;secret_project_token&quot;
49
- end
50
- </pre>
51
-
52
- </div>
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
- <div class="sectiontitle">Attributes</div>
73
- <table border='0' cellpadding='5'>
74
-
75
- <tr valign='top'>
76
- <td class='attr-rw'>
77
- [RW]
78
- </td>
79
- <td class='attr-name'>environment</td>
80
- <td class='attr-desc'><p>
81
- The current environment. Automatically retrieved if <a
82
- href="../Apphunk.html">Apphunk</a> is running as part of a Rails app.
83
- </p>
84
- <h4>Example</h4>
85
- <pre>
86
- config.environment = 'production'
87
- </pre></td>
88
- </tr>
89
-
90
- <tr valign='top'>
91
- <td class='attr-rw'>
92
- [RW]
93
- </td>
94
- <td class='attr-name'>environments</td>
95
- <td class='attr-desc'><p>
96
- A list of allowed environments. <a href="../Apphunk.html">Apphunk</a> will
97
- only send messages if <a
98
- href="Config.html#environment">Apphunk::Config.environment</a> is part of
99
- these allowed environments. <b>Note</b>: This step is skipped if <a
100
- href="Config.html#environment">Apphunk::Config.environment</a> is
101
- <tt>empty</tt>.
102
- </p>
103
- <h4>Example</h4>
104
- <pre>
105
- config.environments = %w(production staging)
106
- </pre></td>
107
- </tr>
108
-
109
- <tr valign='top'>
110
- <td class='attr-rw'>
111
- [RW]
112
- </td>
113
- <td class='attr-name'>tags</td>
114
- <td class='attr-desc'><p>
115
- A list of tags to be send with each message.
116
- </p>
117
- <h4>Example</h4>
118
- <pre>
119
- config.tags = 'each, message, will, get, these, tags'
120
- </pre></td>
121
- </tr>
122
-
123
- <tr valign='top'>
124
- <td class='attr-rw'>
125
- [RW]
126
- </td>
127
- <td class='attr-name'>token</td>
128
- <td class='attr-desc'><p>
129
- The token as provided by apphunk.com. Used to authenticate a message
130
- request.
131
- </p>
132
- <h4>Example</h4>
133
- <pre>
134
- config.token = 'secrect_project_token'
135
- </pre></td>
136
- </tr>
137
-
138
- <tr valign='top'>
139
- <td class='attr-rw'>
140
- [RW]
141
- </td>
142
- <td class='attr-name'>trails</td>
143
- <td class='attr-desc'><p>
144
- A list of trails to be send with each message.
145
- </p>
146
- <h4>Example</h4>
147
- <pre>
148
- config.trails = { :product =&gt; 'Car', :country =&gt; 'Germany' }
149
- </pre></td>
150
- </tr>
151
-
152
- </table>
153
-
154
-
155
-
156
- </div>
157
- </div>
158
- </body>
159
- </html>
@@ -1,105 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <title>Apphunk::Logger</title>
7
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
- <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
9
- <link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
10
- <script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
11
- <script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
12
- <script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
13
- </head>
14
-
15
- <body>
16
- <div class="banner">
17
- <h1>
18
- <span class="type">Module</span>
19
- Apphunk::Logger
20
-
21
- </h1>
22
- <ul class="files">
23
-
24
- <li><a href="../../files/lib/apphunk/logger_rb.html">lib/apphunk/logger.rb</a></li>
25
-
26
- </ul>
27
- </div>
28
- <div id="bodyContent">
29
- <div id="content">
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
- <div class="sectiontitle">Methods</div>
40
- <dl class="methods">
41
-
42
- <dt>E</dt>
43
- <dd>
44
- <ul>
45
-
46
- <li><a href="#M000000">error</a></li>
47
-
48
- </ul>
49
- </dd>
50
-
51
- </dl>
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
- <div class="sectiontitle">Class Public methods</div>
66
-
67
- <div class="method">
68
- <div class="title" id="M000000">
69
-
70
- <a name="M000000"></a><b>error</b>(message)
71
-
72
- </div>
73
-
74
-
75
-
76
-
77
- <div class="sourcecode">
78
- <p class="source-link">
79
- Source: <a href="javascript:toggleSource('M000000_source')" id="l_M000000_source">show</a>
80
-
81
- | <a href="http://github.com/apphunk/apphunk/blob/81946fcbedec89c3c1e745d1abc8a345162f1203/lib/apphunk/logger.rb#L5" target="_blank" class="github_url">on GitHub</a>
82
-
83
- </p>
84
- <div id="M000000_source" class="dyn-source">
85
- <pre><span class="ruby-comment cmt"># File lib/apphunk/logger.rb, line 5</span>
86
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">error</span>(<span class="ruby-identifier">message</span>)
87
- <span class="ruby-identifier">message</span> = <span class="ruby-node">&quot;[Apphunk] Error: #{message}&quot;</span>
88
- <span class="ruby-keyword kw">case</span>
89
- <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Rails</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">logger</span>
90
- <span class="ruby-constant">Rails</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">error</span>(<span class="ruby-identifier">message</span>)
91
- <span class="ruby-keyword kw">when</span> <span class="ruby-constant">RAILS_DEFAULT_LOGGER</span>
92
- <span class="ruby-constant">RAILS_DEFAULT_LOGGER</span>.<span class="ruby-identifier">error</span>(<span class="ruby-identifier">message</span>)
93
- <span class="ruby-keyword kw">else</span>
94
- <span class="ruby-identifier">puts</span>(<span class="ruby-identifier">message</span>)
95
- <span class="ruby-keyword kw">end</span>
96
- <span class="ruby-keyword kw">end</span></pre>
97
- </div>
98
- </div>
99
-
100
- </div>
101
-
102
- </div>
103
- </div>
104
- </body>
105
- </html>
@@ -1,196 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <title>Apphunk::Proxy</title>
7
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
- <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
9
- <link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
10
- <script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
11
- <script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
12
- <script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
13
- </head>
14
-
15
- <body>
16
- <div class="banner">
17
- <h1>
18
- <span class="type">Module</span>
19
- Apphunk::Proxy
20
-
21
- </h1>
22
- <ul class="files">
23
-
24
- <li><a href="../../files/lib/apphunk/proxy_rb.html">lib/apphunk/proxy.rb</a></li>
25
-
26
- </ul>
27
- </div>
28
- <div id="bodyContent">
29
- <div id="content">
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
- <div class="sectiontitle">Methods</div>
40
- <dl class="methods">
41
-
42
- <dt>P</dt>
43
- <dd>
44
- <ul>
45
-
46
- <li><a href="#M000002">prepare_payload</a>,</li>
47
-
48
- <li><a href="#M000003">process_response</a></li>
49
-
50
- </ul>
51
- </dd>
52
-
53
- <dt>S</dt>
54
- <dd>
55
- <ul>
56
-
57
- <li><a href="#M000001">send_message_to_apphunkd</a></li>
58
-
59
- </ul>
60
- </dd>
61
-
62
- </dl>
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
- <div class="sectiontitle">Constants</div>
73
- <table border='0' cellpadding='5'>
74
-
75
- <tr valign='top'>
76
- <td class="attr-name">PROXY_API_URL</td>
77
- <td>=</td>
78
- <td class="attr-value">&quot;http://127.0.0.1:8212/api/messages&quot;</td>
79
- </tr>
80
-
81
-
82
- </table>
83
-
84
-
85
-
86
-
87
-
88
- <div class="sectiontitle">Class Public methods</div>
89
-
90
- <div class="method">
91
- <div class="title" id="M000002">
92
-
93
- <a name="M000002"></a><b>prepare_payload</b>(message, options)
94
-
95
- </div>
96
-
97
-
98
-
99
-
100
- <div class="sourcecode">
101
- <p class="source-link">
102
- Source: <a href="javascript:toggleSource('M000002_source')" id="l_M000002_source">show</a>
103
-
104
- | <a href="http://github.com/apphunk/apphunk/blob/81946fcbedec89c3c1e745d1abc8a345162f1203/lib/apphunk/proxy.rb#L20" target="_blank" class="github_url">on GitHub</a>
105
-
106
- </p>
107
- <div id="M000002_source" class="dyn-source">
108
- <pre><span class="ruby-comment cmt"># File lib/apphunk/proxy.rb, line 20</span>
109
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prepare_payload</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">options</span>)
110
- {
111
- <span class="ruby-identifier">:message</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">message</span>,
112
- <span class="ruby-identifier">:token</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:token</span>],
113
- <span class="ruby-identifier">:environment</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:environment</span>],
114
- <span class="ruby-identifier">:tags</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:tags</span>],
115
- <span class="ruby-identifier">:trails</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:trails</span>].<span class="ruby-identifier">to_json</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:trails</span>])
116
- }
117
- <span class="ruby-keyword kw">end</span></pre>
118
- </div>
119
- </div>
120
-
121
- </div>
122
-
123
- <div class="method">
124
- <div class="title" id="M000003">
125
-
126
- <a name="M000003"></a><b>process_response</b>(result)
127
-
128
- </div>
129
-
130
-
131
-
132
-
133
- <div class="sourcecode">
134
- <p class="source-link">
135
- Source: <a href="javascript:toggleSource('M000003_source')" id="l_M000003_source">show</a>
136
-
137
- | <a href="http://github.com/apphunk/apphunk/blob/81946fcbedec89c3c1e745d1abc8a345162f1203/lib/apphunk/proxy.rb#L30" target="_blank" class="github_url">on GitHub</a>
138
-
139
- </p>
140
- <div id="M000003_source" class="dyn-source">
141
- <pre><span class="ruby-comment cmt"># File lib/apphunk/proxy.rb, line 30</span>
142
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_response</span>(<span class="ruby-identifier">result</span>)
143
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:ok</span>
144
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'201'</span>
145
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
146
- <span class="ruby-keyword kw">else</span>
147
- <span class="ruby-constant">Apphunk</span><span class="ruby-operator">::</span><span class="ruby-constant">Logger</span>.<span class="ruby-identifier">error</span> <span class="ruby-node">&quot;The Apphunkd-Proxy couldn't store the message: #{result.response.code} / #{result.response.body}&quot;</span>
148
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
149
- <span class="ruby-keyword kw">end</span>
150
- <span class="ruby-keyword kw">else</span>
151
- <span class="ruby-constant">Apphunk</span><span class="ruby-operator">::</span><span class="ruby-constant">Logger</span>.<span class="ruby-identifier">error</span> <span class="ruby-value str">&quot;Connection Error: Could not get a response from local Apphunkd-Proxy in time&quot;</span>
152
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
153
- <span class="ruby-keyword kw">end</span>
154
- <span class="ruby-keyword kw">end</span></pre>
155
- </div>
156
- </div>
157
-
158
- </div>
159
-
160
- <div class="method">
161
- <div class="title" id="M000001">
162
-
163
- <a name="M000001"></a><b>send_message_to_apphunkd</b>(message, options)
164
-
165
- </div>
166
-
167
-
168
-
169
-
170
- <div class="sourcecode">
171
- <p class="source-link">
172
- Source: <a href="javascript:toggleSource('M000001_source')" id="l_M000001_source">show</a>
173
-
174
- | <a href="http://github.com/apphunk/apphunk/blob/81946fcbedec89c3c1e745d1abc8a345162f1203/lib/apphunk/proxy.rb#L10" target="_blank" class="github_url">on GitHub</a>
175
-
176
- </p>
177
- <div id="M000001_source" class="dyn-source">
178
- <pre><span class="ruby-comment cmt"># File lib/apphunk/proxy.rb, line 10</span>
179
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_message_to_apphunkd</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">options</span>)
180
- <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:environments</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:environment</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-identifier">:environments</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:environment</span>])
181
- <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
182
- <span class="ruby-keyword kw">end</span>
183
-
184
- <span class="ruby-identifier">payload</span> = <span class="ruby-identifier">prepare_payload</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">options</span>)
185
- <span class="ruby-identifier">result</span> = <span class="ruby-constant">Apphunk</span><span class="ruby-operator">::</span><span class="ruby-constant">Remote</span>.<span class="ruby-identifier">post</span>(<span class="ruby-constant">PROXY_API_URL</span>, <span class="ruby-identifier">payload</span>, <span class="ruby-value">3</span>)
186
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">process_response</span>(<span class="ruby-identifier">result</span>)
187
- <span class="ruby-keyword kw">end</span></pre>
188
- </div>
189
- </div>
190
-
191
- </div>
192
-
193
- </div>
194
- </div>
195
- </body>
196
- </html>