apphunk 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +5 -6
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/apphunk.gemspec +35 -3
- data/doc/apple-touch-icon.png +0 -0
- data/doc/classes/Apphunk/Config.html +159 -0
- data/doc/classes/Apphunk/Logger.html +105 -0
- data/doc/classes/Apphunk/Proxy.html +196 -0
- data/doc/classes/Apphunk/Remote/Result.html +125 -0
- data/doc/classes/Apphunk/Remote.html +117 -0
- data/doc/classes/Apphunk.html +294 -0
- data/doc/created.rid +1 -0
- data/doc/css/main.css +263 -0
- data/doc/css/panel.css +383 -0
- data/doc/css/reset.css +53 -0
- data/doc/favicon.ico +0 -0
- data/doc/files/LICENSE.html +81 -0
- data/doc/files/README_rdoc.html +87 -0
- data/doc/files/lib/apphunk/config_rb.html +59 -0
- data/doc/files/lib/apphunk/logger_rb.html +59 -0
- data/doc/files/lib/apphunk/proxy_rb.html +68 -0
- data/doc/files/lib/apphunk/remote/result_rb.html +59 -0
- data/doc/files/lib/apphunk/remote_rb.html +70 -0
- data/doc/files/lib/apphunk_rb.html +66 -0
- data/doc/i/arrows.png +0 -0
- data/doc/i/results_bg.png +0 -0
- data/doc/i/tree_bg.png +0 -0
- data/doc/index.html +14 -0
- data/doc/js/jquery-1.3.2.min.js +19 -0
- data/doc/js/jquery-effect.js +593 -0
- data/doc/js/main.js +22 -0
- data/doc/js/searchdoc.js +628 -0
- data/doc/panel/index.html +71 -0
- data/doc/panel/search_index.js +1 -0
- data/doc/panel/tree.js +1 -0
- data/lib/apphunk/config.rb +54 -0
- data/lib/apphunk/logger.rb +12 -4
- data/lib/apphunk/proxy.rb +6 -2
- data/lib/apphunk.rb +57 -0
- data/rails/init.rb +3 -0
- data/spec/apphunk/proxy_spec.rb +11 -5
- metadata +35 -3
data/README.rdoc
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
= apphunk
|
2
2
|
|
3
|
-
|
3
|
+
A library that send's messages to the remote logging service apphunk.com.
|
4
|
+
|
4
5
|
|
5
6
|
== Note on Patches/Pull Requests
|
6
7
|
|
7
8
|
* Fork the project.
|
8
9
|
* Make your feature addition or bug fix.
|
9
|
-
* Add tests for it. This is important so I don't break it in a
|
10
|
-
|
11
|
-
*
|
12
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
-
* Send me a pull request. Bonus points for topic branches.
|
10
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
12
|
+
* Send me a pull request. Get bonus points for topic branches.
|
14
13
|
|
15
14
|
== Copyright
|
16
15
|
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "apphunk"
|
8
|
-
gem.summary = %Q{A library
|
8
|
+
gem.summary = %Q{A library that send's messages to Apphunk.com}
|
9
9
|
gem.description = %Q{Apphunk is a library that allows your applications (currently only Ruby AND Rails) to send messages to Apphunk.com}
|
10
10
|
gem.email = "andreas@apphunk.com"
|
11
11
|
gem.homepage = "http://apphunk.com"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/apphunk.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{apphunk}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andreas Wolff"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-27}
|
13
13
|
s.description = %q{Apphunk is a library that allows your applications (currently only Ruby AND Rails) to send messages to Apphunk.com}
|
14
14
|
s.email = %q{andreas@apphunk.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -26,7 +26,39 @@ Gem::Specification.new do |s|
|
|
26
26
|
"TODO.rdoc",
|
27
27
|
"VERSION",
|
28
28
|
"apphunk.gemspec",
|
29
|
+
"doc/apple-touch-icon.png",
|
30
|
+
"doc/classes/Apphunk.html",
|
31
|
+
"doc/classes/Apphunk/Config.html",
|
32
|
+
"doc/classes/Apphunk/Logger.html",
|
33
|
+
"doc/classes/Apphunk/Proxy.html",
|
34
|
+
"doc/classes/Apphunk/Remote.html",
|
35
|
+
"doc/classes/Apphunk/Remote/Result.html",
|
36
|
+
"doc/created.rid",
|
37
|
+
"doc/css/main.css",
|
38
|
+
"doc/css/panel.css",
|
39
|
+
"doc/css/reset.css",
|
40
|
+
"doc/favicon.ico",
|
41
|
+
"doc/files/LICENSE.html",
|
42
|
+
"doc/files/README_rdoc.html",
|
43
|
+
"doc/files/lib/apphunk/config_rb.html",
|
44
|
+
"doc/files/lib/apphunk/logger_rb.html",
|
45
|
+
"doc/files/lib/apphunk/proxy_rb.html",
|
46
|
+
"doc/files/lib/apphunk/remote/result_rb.html",
|
47
|
+
"doc/files/lib/apphunk/remote_rb.html",
|
48
|
+
"doc/files/lib/apphunk_rb.html",
|
49
|
+
"doc/i/arrows.png",
|
50
|
+
"doc/i/results_bg.png",
|
51
|
+
"doc/i/tree_bg.png",
|
52
|
+
"doc/index.html",
|
53
|
+
"doc/js/jquery-1.3.2.min.js",
|
54
|
+
"doc/js/jquery-effect.js",
|
55
|
+
"doc/js/main.js",
|
56
|
+
"doc/js/searchdoc.js",
|
57
|
+
"doc/panel/index.html",
|
58
|
+
"doc/panel/search_index.js",
|
59
|
+
"doc/panel/tree.js",
|
29
60
|
"lib/apphunk.rb",
|
61
|
+
"lib/apphunk/config.rb",
|
30
62
|
"lib/apphunk/logger.rb",
|
31
63
|
"lib/apphunk/proxy.rb",
|
32
64
|
"lib/apphunk/remote.rb",
|
@@ -41,7 +73,7 @@ Gem::Specification.new do |s|
|
|
41
73
|
s.rdoc_options = ["--charset=UTF-8"]
|
42
74
|
s.require_paths = ["lib"]
|
43
75
|
s.rubygems_version = %q{1.3.5}
|
44
|
-
s.summary = %q{A library
|
76
|
+
s.summary = %q{A library that send's messages to Apphunk.com}
|
45
77
|
s.test_files = [
|
46
78
|
"spec/apphunk/proxy_spec.rb",
|
47
79
|
"spec/apphunk_spec.rb",
|
Binary file
|
@@ -0,0 +1,159 @@
|
|
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>’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 = "secret_project_token"
|
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 => 'Car', :country => 'Germany' }
|
149
|
+
</pre></td>
|
150
|
+
</tr>
|
151
|
+
|
152
|
+
</table>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
</body>
|
159
|
+
</html>
|
@@ -0,0 +1,105 @@
|
|
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">"[Apphunk] Error: #{message}"</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">&&</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>
|
@@ -0,0 +1,196 @@
|
|
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">"http://127.0.0.1:8212/api/messages"</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">></span> <span class="ruby-identifier">message</span>,
|
112
|
+
<span class="ruby-identifier">:token</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:token</span>],
|
113
|
+
<span class="ruby-identifier">:environment</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:environment</span>],
|
114
|
+
<span class="ruby-identifier">:tags</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:tags</span>],
|
115
|
+
<span class="ruby-identifier">:trails</span> =<span class="ruby-operator">></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">"The Apphunkd-Proxy couldn't store the message: #{result.response.code} / #{result.response.body}"</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">"Connection Error: Could not get a response from local Apphunkd-Proxy in time"</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">&&</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:environment</span>] <span class="ruby-operator">&&</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>
|