lita-onewheel-wolfram-alpha 0.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8e5259dae88f00f6256aadb3da967deb7f1fc377
4
+ data.tar.gz: c74d42343f8143a6c0b4e2b639e952b567f6e125
5
+ SHA512:
6
+ metadata.gz: 0ffb133c3aa8ffd5c2a32cd07efeceb15d667f47b2bda465d9f49792bd94df464836181da2f2879820a29bb1f48435bfa3b5cb8e05890049338f6da1b7c87703
7
+ data.tar.gz: eb73ecdab58022db773d5e831e624dd59f989862a0cd6b9deb896472378817e80ed810db19c2c3cdcadc4313a1ce5c69ab542a1f476a2a179c0bdf7be6766d6a
@@ -0,0 +1,8 @@
1
+ .idea
2
+ *.gem
3
+ .bundle
4
+ Gemfile.lock
5
+ coverage
6
+ *.iml
7
+ lita_config.rb
8
+ .rbenv-gemsets
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.4
4
+ script: bundle exec rake
5
+ before_install:
6
+ - gem update --system
7
+ services:
8
+ - redis-server
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2014 Andrew Kreps
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ lita-onewheel-wolfram-alpha
2
+ ----
3
+
4
+ .. image:: https://coveralls.io/repos/github/onewheelskyward/lita-onewheel-wolfram-alpha/badge.svg?branch=master
5
+ :target: https://coveralls.io/github/onewheelskyward/lita-onewheel-wolfram-alpha?branch=master
6
+ .. image:: https://travis-ci.org/onewheelskyward/lita-onewheel-wolfram-alpha.svg?branch=master
7
+ :target: https://travis-ci.org/onewheelskyward/lita-onewheel-wolfram-alpha
8
+
9
+ Queries Wolfram Alpha for the text specified.
10
+
11
+ Installation
12
+ ----
13
+ Add lita-onewheel-wolfram-alpha to your Lita instance's Gemfile:
14
+
15
+ ``gem 'lita-onewheel-wolfram-alpha'``
16
+
17
+
18
+ Configuration
19
+ ----
20
+ ```
21
+ Lita.configure do |config|
22
+ config.handlers.wolfram_alpha.app_id = 'yourwolframappid'
23
+ config.handlers.wolfram_alpha.api_uri = 'http://api.wolframalpha.com/v2/query?input=[query]&appid=[appid]'
24
+ end
25
+ ```
26
+
27
+ Usage
28
+ ----
29
+ bot: alpha pi
30
+
31
+ License
32
+ ----
33
+ [MIT](http://opensource.org/licenses/MIT)
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,7 @@
1
+ require 'lita'
2
+
3
+ Lita.load_locales Dir[File.expand_path(
4
+ File.join('..', '..', 'locales', '*.yml'), __FILE__
5
+ )]
6
+
7
+ require 'lita/handlers/onewheel_wolfram_alpha'
@@ -0,0 +1,42 @@
1
+ require 'rest_client'
2
+ require 'nokogiri'
3
+
4
+ module Lita
5
+ module Handlers
6
+ class OnewheelWolframAlpha < Handler
7
+ config :app_id
8
+ config :api_uri
9
+
10
+ route(/^alpha\s*(.*)/i, :handle_wolfram_query, command: true)
11
+
12
+ def handle_wolfram_query(response)
13
+ unless config.app_id and config.api_uri
14
+ Lita.logger.error 'Configuration error!'
15
+ return
16
+ end
17
+ query = response.matches[0][0]
18
+ api_response = make_api_call query
19
+ response.reply api_response
20
+ end
21
+
22
+ def make_api_call(query)
23
+ uri = build_uri query
24
+ response = RestClient.get(uri)
25
+ noko_doc = Nokogiri::XML response.to_s
26
+ success_node = noko_doc.xpath('queryresult').attribute('success')
27
+ if success_node.to_s == 'true'
28
+ plaintext_nodes = noko_doc.xpath('//plaintext')
29
+ plaintext_nodes[1].child.to_s
30
+ else
31
+ "Wolfram couldn't parse #{query}."
32
+ end
33
+ end
34
+
35
+ def build_uri(query)
36
+ uri = config.api_uri.sub '[query]', CGI::escape(query)
37
+ uri = uri.sub '[appid]', config.app_id
38
+ end
39
+ end
40
+ Lita.register_handler(OnewheelWolframAlpha)
41
+ end
42
+ end
@@ -0,0 +1,28 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = 'lita-onewheel-wolfram-alpha'
3
+ spec.version = '0.0.0'
4
+ spec.authors = ['Andrew Kreps']
5
+ spec.email = ['andrew.kreps@gmail.com']
6
+ spec.description = %q{Lita interface to Wolfram Alpha.}
7
+ spec.summary = %q{Summarize THIS!}
8
+ spec.homepage = 'https://github.com/onewheelskyward/lita-onewheel-wolfram-alpha'
9
+ spec.license = 'MIT'
10
+ spec.metadata = { 'lita_plugin_type' => 'handler'}
11
+
12
+ spec.files = `git ls-files`.split($/)
13
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.require_paths = ['lib']
16
+
17
+ spec.add_runtime_dependency 'lita', '~> 4.7'
18
+ spec.add_runtime_dependency 'rest-client', '~> 1.8'
19
+ spec.add_runtime_dependency 'nokogiri', '~> 1.6'
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ # spec.add_development_dependency 'pry-byebug', '~> 3.1'
23
+ spec.add_development_dependency 'rake', '~> 10.4'
24
+ spec.add_development_dependency 'rack-test', '~> 0.6'
25
+ spec.add_development_dependency 'rspec', '~> 3.0'
26
+ spec.add_development_dependency 'simplecov', '~> 0.10'
27
+ spec.add_development_dependency 'coveralls', '~> 0.8'
28
+ end
@@ -0,0 +1,4 @@
1
+ Lita.configure do |config|
2
+ config.handlers.wolfram_alpha.app_id = 'yourwolframappid'
3
+ config.handlers.wolfram_alpha.api_uri = 'http://api.wolframalpha.com/v2/query?input=[query]&appid=[appid]'
4
+ end
@@ -0,0 +1,16 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <queryresult success='false'
3
+ error='false'
4
+ numpods='0'
5
+ datatypes=''
6
+ timedout=''
7
+ timedoutpods=''
8
+ timing='0.367'
9
+ parsetiming='0.064'
10
+ parsetimedout='false'
11
+ recalculate=''
12
+ id=''
13
+ host='http://www4b.wolframalpha.com'
14
+ server='48'
15
+ related=''
16
+ version='2.6'/>
@@ -0,0 +1,316 @@
1
+
2
+ <?xml version='1.0' encoding='UTF-8'?>
3
+ <queryresult success='true'
4
+ error='false'
5
+ numpods='8'
6
+ datatypes='MathematicalFunctionIdentity'
7
+ timedout='Numeric'
8
+ timedoutpods=''
9
+ timing='3.08'
10
+ parsetiming='0.126'
11
+ parsetimedout='false'
12
+ recalculate='http://www3.wolframalpha.com/api/v2/recalc.jsp?id=MSPa15101g2g5479g67e910400000d941ga21b178f7a&amp;s=43'
13
+ id='MSPa15111g2g5479g67e9104000012f93b8f6161965b'
14
+ host='http://www3.wolframalpha.com'
15
+ server='43'
16
+ related='http://www3.wolframalpha.com/api/v2/relatedQueries.jsp?id=MSPa15121g2g5479g67e91040000229gbgie926b0icd&amp;s=43'
17
+ version='2.6'>
18
+ <pod title='Input'
19
+ scanner='Identity'
20
+ id='Input'
21
+ position='100'
22
+ error='false'
23
+ numsubpods='1'>
24
+ <subpod title=''>
25
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15131g2g5479g67e91040000156bigbgff9abb77?MSPStoreType=image/gif&amp;s=43'
26
+ alt='pi'
27
+ title='pi'
28
+ width='9'
29
+ height='18' />
30
+ <plaintext>pi</plaintext>
31
+ </subpod>
32
+ </pod>
33
+ <pod title='Decimal approximation'
34
+ scanner='Numeric'
35
+ id='DecimalApproximation'
36
+ position='200'
37
+ error='false'
38
+ numsubpods='1'
39
+ primary='true'>
40
+ <subpod title=''>
41
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15141g2g5479g67e910400003661b8iafc4343fg?MSPStoreType=image/gif&amp;s=43'
42
+ alt='3.141592653589793238462643383279502884197169399375105820974...'
43
+ title='3.141592653589793238462643383279502884197169399375105820974...'
44
+ width='483'
45
+ height='20' />
46
+ <plaintext>3.141592653589793238462643383279502884197169399375105820974...</plaintext>
47
+ </subpod>
48
+ <states count='1'>
49
+ <state name='More digits'
50
+ input='DecimalApproximation__More digits' />
51
+ </states>
52
+ </pod>
53
+ <pod title='Property'
54
+ scanner='Numeric'
55
+ id='Property'
56
+ position='300'
57
+ error='false'
58
+ numsubpods='1'>
59
+ <subpod title=''>
60
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15151g2g5479g67e9104000010418fa28hea846i?MSPStoreType=image/gif&amp;s=43'
61
+ alt='pi is a transcendental number'
62
+ title='pi is a transcendental number'
63
+ width='194'
64
+ height='18' />
65
+ <plaintext>pi is a transcendental number</plaintext>
66
+ </subpod>
67
+ </pod>
68
+ <pod title='Number line'
69
+ scanner='NumberLine'
70
+ id='NumberLine'
71
+ position='400'
72
+ error='false'
73
+ numsubpods='1'>
74
+ <subpod title=''>
75
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15161g2g5479g67e910400005159d4ad6i769eah?MSPStoreType=image/gif&amp;s=43'
76
+ alt=''
77
+ title=''
78
+ width='300'
79
+ height='56' />
80
+ <plaintext></plaintext>
81
+ </subpod>
82
+ </pod>
83
+ <pod title='Continued fraction'
84
+ scanner='ContinuedFraction'
85
+ id='ContinuedFraction'
86
+ position='500'
87
+ error='false'
88
+ numsubpods='1'>
89
+ <subpod title=''>
90
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15171g2g5479g67e910400004fe4aa5i790d1aa7?MSPStoreType=image/gif&amp;s=43'
91
+ alt='[3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1, 84, 2, 1, 1, 15, 3, 13, ...]'
92
+ title='[3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1, 84, 2, 1, 1, 15, 3, 13, ...]'
93
+ width='548'
94
+ height='20' />
95
+ <plaintext>[3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1, 84, 2, 1, 1, 15, 3, 13, ...]</plaintext>
96
+ </subpod>
97
+ <states count='2'>
98
+ <state name='More terms'
99
+ input='ContinuedFraction__More terms' />
100
+ <state name='Fraction form'
101
+ input='ContinuedFraction__Fraction form' />
102
+ </states>
103
+ </pod>
104
+ <pod title='Alternative representations'
105
+ scanner='MathematicalFunctionData'
106
+ id='AlternativeRepresentations:MathematicalFunctionIdentityData'
107
+ position='600'
108
+ error='false'
109
+ numsubpods='3'>
110
+ <subpod title=''>
111
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15181g2g5479g67e9104000044dfd958dg5998fa?MSPStoreType=image/gif&amp;s=43'
112
+ alt='pi = 180 °'
113
+ title='pi = 180 °'
114
+ width='61'
115
+ height='28' />
116
+ <plaintext>pi = 180 °</plaintext>
117
+ </subpod>
118
+ <subpod title=''>
119
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15191g2g5479g67e910400005ge2a99g1c2g293i?MSPStoreType=image/gif&amp;s=43'
120
+ alt='pi = -i log(-1)'
121
+ title='pi = -i log(-1)'
122
+ width='97'
123
+ height='28' />
124
+ <plaintext>pi = -i log(-1)</plaintext>
125
+ </subpod>
126
+ <subpod title=''>
127
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15201g2g5479g67e9104000013ihghh66d4ah9fh?MSPStoreType=image/gif&amp;s=43'
128
+ alt='pi = cos^(-1)(-1)'
129
+ title='pi = cos^(-1)(-1)'
130
+ width='94'
131
+ height='28' />
132
+ <plaintext>pi = cos^(-1)(-1)</plaintext>
133
+ </subpod>
134
+ <states count='1'>
135
+ <state name='More'
136
+ input='AlternativeRepresentations:MathematicalFunctionIdentityData__More' />
137
+ </states>
138
+ <infos count='4'>
139
+ <info text='log(x) is the natural logarithm'>
140
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15211g2g5479g67e910400000g0c5d008h0ih93e?MSPStoreType=image/gif&amp;s=43'
141
+ alt='log(x) is the natural logarithm'
142
+ title='log(x) is the natural logarithm'
143
+ width='198'
144
+ height='18' />
145
+ <link url='http://reference.wolfram.com/mathematica/ref/Log.html'
146
+ text='Documentation'
147
+ title='Mathematica' />
148
+ <link url='http://functions.wolfram.com/ElementaryFunctions/Log'
149
+ text='Properties'
150
+ title='Wolfram Functions Site' />
151
+ <link url='http://mathworld.wolfram.com/NaturalLogarithm.html'
152
+ text='Definition'
153
+ title='MathWorld' />
154
+ </info>
155
+ <info text='i is the imaginary unit'>
156
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15221g2g5479g67e910400004dee221640b909dh?MSPStoreType=image/gif&amp;s=43'
157
+ alt='i is the imaginary unit'
158
+ title='i is the imaginary unit'
159
+ width='147'
160
+ height='18' />
161
+ <link url='http://reference.wolfram.com/mathematica/ref/I.html'
162
+ text='Documentation'
163
+ title='Documentation' />
164
+ <link url='http://mathworld.wolfram.com/i.html'
165
+ text='Definition'
166
+ title='MathWorld' />
167
+ </info>
168
+ <info text='cos^(-1)(x) is the inverse cosine function'>
169
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15231g2g5479g67e910400005f21gbgba9gh132i?MSPStoreType=image/gif&amp;s=43'
170
+ alt='cos^(-1)(x) is the inverse cosine function'
171
+ title='cos^(-1)(x) is the inverse cosine function'
172
+ width='247'
173
+ height='18' />
174
+ <link url='http://reference.wolfram.com/mathematica/ref/ArcCos.html'
175
+ text='Documentation'
176
+ title='Mathematica' />
177
+ <link url='http://functions.wolfram.com/ElementaryFunctions/ArcCos'
178
+ text='Properties'
179
+ title='Wolfram Functions Site' />
180
+ <link url='http://mathworld.wolfram.com/InverseCosine.html'
181
+ text='Definition'
182
+ title='MathWorld' />
183
+ </info>
184
+ <info>
185
+ <link url='http://functions.wolfram.com/Constants/Pi/27/ShowAll.html'
186
+ text='More information' />
187
+ </info>
188
+ </infos>
189
+ </pod>
190
+ <pod title='Series representations'
191
+ scanner='MathematicalFunctionData'
192
+ id='SeriesRepresentations:MathematicalFunctionIdentityData'
193
+ position='700'
194
+ error='false'
195
+ numsubpods='3'>
196
+ <subpod title=''>
197
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15241g2g5479g67e910400004b022dbff79ihb85?MSPStoreType=image/gif&amp;s=43'
198
+ alt='pi = 4 sum_(k=0)^infinity (-1)^k/(2 k+1)'
199
+ title='pi = 4 sum_(k=0)^infinity (-1)^k/(2 k+1)'
200
+ width='110'
201
+ height='56' />
202
+ <plaintext>pi = 4 sum_(k=0)^infinity (-1)^k/(2 k+1)</plaintext>
203
+ </subpod>
204
+ <subpod title=''>
205
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15251g2g5479g67e91040000387db9gf303c2hd4?MSPStoreType=image/gif&amp;s=43'
206
+ alt='pi = -2+2 sum_(k=1)^infinity 2^k/(binomial(2 k, k))'
207
+ title='pi = -2+2 sum_(k=1)^infinity 2^k/(binomial(2 k, k))'
208
+ width='139'
209
+ height='69' />
210
+ <plaintext>pi = -2+2 sum_(k=1)^infinity 2^k/(binomial(2 k, k))</plaintext>
211
+ </subpod>
212
+ <subpod title=''>
213
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15261g2g5479g67e910400005d04e5g686ca3d4h?MSPStoreType=image/gif&amp;s=43'
214
+ alt='pi = sum_(k=0)^infinity (50 k-6)/(2^k binomial(3 k, k))'
215
+ title='pi = sum_(k=0)^infinity (50 k-6)/(2^k binomial(3 k, k))'
216
+ width='111'
217
+ height='67' />
218
+ <plaintext>pi = sum_(k=0)^infinity (50 k-6)/(2^k binomial(3 k, k))</plaintext>
219
+ </subpod>
220
+ <states count='1'>
221
+ <state name='More'
222
+ input='SeriesRepresentations:MathematicalFunctionIdentityData__More' />
223
+ </states>
224
+ <infos count='2'>
225
+ <info text='(n
226
+ m) is the binomial coefficient'>
227
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15271g2g5479g67e9104000048hgc5gfh3ib2aee?MSPStoreType=image/gif&amp;s=43'
228
+ alt='(n
229
+ m) is the binomial coefficient'
230
+ title='(n
231
+ m) is the binomial coefficient'
232
+ width='204'
233
+ height='36' />
234
+ <link url='http://reference.wolfram.com/mathematica/ref/Binomial.html'
235
+ text='Documentation'
236
+ title='Mathematica' />
237
+ <link url='http://functions.wolfram.com/GammaBetaErf/Binomial'
238
+ text='Properties'
239
+ title='Wolfram Functions Site' />
240
+ <link url='http://mathworld.wolfram.com/BinomialCoefficient.html'
241
+ text='Definition'
242
+ title='MathWorld' />
243
+ </info>
244
+ <info>
245
+ <link url='http://functions.wolfram.com/Constants/Pi/06/ShowAll.html'
246
+ text='More information' />
247
+ </info>
248
+ </infos>
249
+ </pod>
250
+ <pod title='Integral representations'
251
+ scanner='MathematicalFunctionData'
252
+ id='IntegralRepresentations:MathematicalFunctionIdentityData'
253
+ position='800'
254
+ error='false'
255
+ numsubpods='3'>
256
+ <subpod title=''>
257
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15281g2g5479g67e910400005238664ee0eebi39?MSPStoreType=image/gif&amp;s=43'
258
+ alt='pi = 2 integral_0^infinity 1/(t^2+1) dt'
259
+ title='pi = 2 integral_0^infinity 1/(t^2+1) dt'
260
+ width='126'
261
+ height='44' />
262
+ <plaintext>pi = 2 integral_0^infinity 1/(t^2+1) dt</plaintext>
263
+ </subpod>
264
+ <subpod title=''>
265
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15291g2g5479g67e9104000049ef817da3f57hc4?MSPStoreType=image/gif&amp;s=43'
266
+ alt='pi = 4 integral_0^1 sqrt(1-t^2) dt'
267
+ title='pi = 4 integral_0^1 sqrt(1-t^2) dt'
268
+ width='138'
269
+ height='45' />
270
+ <plaintext>pi = 4 integral_0^1 sqrt(1-t^2) dt</plaintext>
271
+ </subpod>
272
+ <subpod title=''>
273
+ <img src='http://www3.wolframalpha.com/Calculate/MSP/MSP15301g2g5479g67e9104000016ie02c6a5ichb76?MSPStoreType=image/gif&amp;s=43'
274
+ alt='pi = 2 integral_0^infinity (sin(t))/t dt'
275
+ title='pi = 2 integral_0^infinity (sin(t))/t dt'
276
+ width='124'
277
+ height='45' />
278
+ <plaintext>pi = 2 integral_0^infinity (sin(t))/t dt</plaintext>
279
+ </subpod>
280
+ <states count='1'>
281
+ <state name='More'
282
+ input='IntegralRepresentations:MathematicalFunctionIdentityData__More' />
283
+ </states>
284
+ <infos count='1'>
285
+ <info>
286
+ <link url='http://functions.wolfram.com/Constants/Pi/07/ShowAll.html'
287
+ text='More information' />
288
+ </info>
289
+ </infos>
290
+ </pod>
291
+ <assumptions count='1'>
292
+ <assumption type='Clash'
293
+ word='pi'
294
+ template='Assuming &quot;${word}&quot; is ${desc1}. Use as ${desc2} instead'
295
+ count='6'>
296
+ <value name='NamedConstant'
297
+ desc='a mathematical constant'
298
+ input='*C.pi-_*NamedConstant-' />
299
+ <value name='Character'
300
+ desc='a character'
301
+ input='*C.pi-_*Character-' />
302
+ <value name='MathWorld'
303
+ desc=' referring to a mathematical definition'
304
+ input='*C.pi-_*MathWorld-' />
305
+ <value name='MathWorldClass'
306
+ desc='a class of mathematical terms'
307
+ input='*C.pi-_*MathWorldClass-' />
308
+ <value name='Movie'
309
+ desc='a movie'
310
+ input='*C.pi-_*Movie-' />
311
+ <value name='Word'
312
+ desc='a word'
313
+ input='*C.pi-_*Word-' />
314
+ </assumption>
315
+ </assumptions>
316
+ </queryresult>
@@ -0,0 +1,243 @@
1
+
2
+ <?xml version='1.0' encoding='UTF-8'?>
3
+ <queryresult success='true'
4
+ error='false'
5
+ numpods='11'
6
+ datatypes='Gene,Species'
7
+ timedout=''
8
+ timedoutpods=''
9
+ timing='3.88'
10
+ parsetiming='0.126'
11
+ parsetimedout='false'
12
+ recalculate=''
13
+ id='MSPa127121e526f37g26886800002beidfh82d64fcd4'
14
+ host='http://www4c.wolframalpha.com'
15
+ server='7'
16
+ related='http://www4c.wolframalpha.com/api/v2/relatedQueries.jsp?id=MSPa127221e526f37g2688680000580376889e4hb76a&amp;s=7'
17
+ version='2.6'>
18
+ <pod title='Input interpretation'
19
+ scanner='Identity'
20
+ id='Input'
21
+ position='100'
22
+ error='false'
23
+ numsubpods='1'>
24
+ <subpod title=''>
25
+ <img src='http://www4c.wolframalpha.com/Calculate/MSP/MSP127321e526f37g2688680000621adg28i72609e1?MSPStoreType=image/gif&amp;s=7'
26
+ alt='wkd (fruit fly gene)'
27
+ title='wkd (fruit fly gene)'
28
+ width='129'
29
+ height='18' />
30
+ <plaintext>wkd (fruit fly gene)</plaintext>
31
+ </subpod>
32
+ </pod>
33
+ <pod title='Standard name'
34
+ scanner='Data'
35
+ id='StandardName:GeneData'
36
+ position='200'
37
+ error='false'
38
+ numsubpods='1'>
39
+ <subpod title=''>
40
+ <img src='http://www4c.wolframalpha.com/Calculate/MSP/MSP127421e526f37g26886800004baif3d1bee40i64?MSPStoreType=image/gif&amp;s=7'
41
+ alt='whacked'
42
+ title='whacked'
43
+ width='58'
44
+ height='18' />
45
+ <plaintext>whacked</plaintext>
46
+ </subpod>
47
+ </pod>
48
+ <pod title='Alternate names'
49
+ scanner='Data'
50
+ id='AlternateNames:GeneData'
51
+ position='300'
52
+ error='false'
53
+ numsubpods='1'>
54
+ <subpod title=''>
55
+ <img src='http://www4c.wolframalpha.com/Calculate/MSP/MSP127521e526f37g26886800002e2h3e746e98hg38?MSPStoreType=image/gif&amp;s=7'
56
+ alt='cg5344 | CG5344 | wkd-PA | wkd-PB | ...'
57
+ title='cg5344 | CG5344 | wkd-PA | wkd-PB | ...'
58
+ width='328'
59
+ height='18' />
60
+ <plaintext>cg5344 | CG5344 | wkd-PA | wkd-PB | ...</plaintext>
61
+ </subpod>
62
+ <states count='1'>
63
+ <state name='More'
64
+ input='AlternateNames:GeneData__More' />
65
+ </states>
66
+ </pod>
67
+ <pod title='Location'
68
+ scanner='Data'
69
+ id='Location:GeneData'
70
+ position='400'
71
+ error='false'
72
+ numsubpods='1'>
73
+ <subpod title=''>
74
+ <img src='http://www4c.wolframalpha.com/Calculate/MSP/MSP127621e526f37g268868000012702h57f25bf4ag?MSPStoreType=image/gif&amp;s=7'
75
+ alt='species | Drosophila melanogaster (fruit fly)
76
+ locus | chromosome 3R | 86E11
77
+ strand | plus
78
+ coordinates | 7407298 to 7411027'
79
+ title='species | Drosophila melanogaster (fruit fly)
80
+ locus | chromosome 3R | 86E11
81
+ strand | plus
82
+ coordinates | 7407298 to 7411027'
83
+ width='349'
84
+ height='132' />
85
+ <plaintext>species | Drosophila melanogaster (fruit fly)
86
+ locus | chromosome 3R | 86E11
87
+ strand | plus
88
+ coordinates | 7407298 to 7411027</plaintext>
89
+ </subpod>
90
+ </pod>
91
+ <pod title='Reference sequence'
92
+ scanner='Data'
93
+ id='ReferenceSequence:GeneData'
94
+ position='500'
95
+ error='false'
96
+ numsubpods='1'>
97
+ <subpod title=''>
98
+ <img src='http://www4c.wolframalpha.com/Calculate/MSP/MSP127721e526f37g268868000049abc585a05dfi78?MSPStoreType=image/gif&amp;s=7'
99
+ alt='ATCGCACAGTAGTCGCTTCGTTGCCATCGCCAATCTCGCT
100
+ ... AATATAAAACTTGAATACTAATAAAACAAAATATACCG'
101
+ title='ATCGCACAGTAGTCGCTTCGTTGCCATCGCCAATCTCGCT
102
+ ... AATATAAAACTTGAATACTAATAAAACAAAATATACCG'
103
+ width='387'
104
+ height='36' />
105
+ <plaintext>ATCGCACAGTAGTCGCTTCGTTGCCATCGCCAATCTCGCT
106
+ ... AATATAAAACTTGAATACTAATAAAACAAAATATACCG</plaintext>
107
+ </subpod>
108
+ <states count='1'>
109
+ <state name='More'
110
+ input='ReferenceSequence:GeneData__More' />
111
+ </states>
112
+ </pod>
113
+ <pod title='Reference sequence length'
114
+ scanner='Data'
115
+ id='Length:GeneData'
116
+ position='600'
117
+ error='false'
118
+ numsubpods='1'>
119
+ <subpod title=''>
120
+ <img src='http://www4c.wolframalpha.com/Calculate/MSP/MSP127821e526f37g26886800002083887dc3fdadef?MSPStoreType=image/gif&amp;s=7'
121
+ alt='3.73 kbp (kilobase pairs)'
122
+ title='3.73 kbp (kilobase pairs)'
123
+ width='157'
124
+ height='18' />
125
+ <plaintext>3.73 kbp (kilobase pairs)</plaintext>
126
+ </subpod>
127
+ </pod>
128
+ <pod title='Nearby genes'
129
+ scanner='Data'
130
+ id='NearbyGenes:GeneData'
131
+ position='700'
132
+ error='false'
133
+ numsubpods='1'>
134
+ <subpod title=''>
135
+ <img src='http://www4c.wolframalpha.com/Calculate/MSP/MSP127921e526f37g26886800000d3gachh811ae366?MSPStoreType=image/gif&amp;s=7'
136
+ alt=''
137
+ title=''
138
+ width='450'
139
+ height='99' />
140
+ <plaintext></plaintext>
141
+ </subpod>
142
+ <states count='2'>
143
+ <state name='More'
144
+ input='NearbyGenes:GeneData__More' />
145
+ <state name='Show table'
146
+ input='NearbyGenes:GeneData__Show table' />
147
+ </states>
148
+ </pod>
149
+ <pod title='Gene splicing structures'
150
+ scanner='Data'
151
+ id='CodingSequencesGraphic:GeneData'
152
+ position='800'
153
+ error='false'
154
+ numsubpods='1'>
155
+ <subpod title=''>
156
+ <img src='http://www4c.wolframalpha.com/Calculate/MSP/MSP128021e526f37g268868000014g0gb76g3af8860?MSPStoreType=image/gif&amp;s=7'
157
+ alt=''
158
+ title=''
159
+ width='450'
160
+ height='98' />
161
+ <plaintext></plaintext>
162
+ </subpod>
163
+ <states count='2'>
164
+ <state name='Show legend'
165
+ input='CodingSequencesGraphic:GeneData__Show legend' />
166
+ <state name='Show table'
167
+ input='CodingSequencesGraphic:GeneData__Show table' />
168
+ </states>
169
+ </pod>
170
+ <pod title='Protein names'
171
+ scanner='Data'
172
+ id='ProteinNames:GeneData'
173
+ position='900'
174
+ error='false'
175
+ numsubpods='1'>
176
+ <subpod title=''>
177
+ <img src='http://www4c.wolframalpha.com/Calculate/MSP/MSP128121e526f37g268868000040dfa067hea8ghcc?MSPStoreType=image/gif&amp;s=7'
178
+ alt='whacked CG5344-PA, isoform A | whacked CG5344-PB, isoform B'
179
+ title='whacked CG5344-PA, isoform A | whacked CG5344-PB, isoform B'
180
+ width='450'
181
+ height='18' />
182
+ <plaintext>whacked CG5344-PA, isoform A | whacked CG5344-PB, isoform B</plaintext>
183
+ </subpod>
184
+ </pod>
185
+ <pod title='Protein molecular weight'
186
+ scanner='Data'
187
+ id='ProteinMolecularWeight:GeneData'
188
+ position='1000'
189
+ error='false'
190
+ numsubpods='1'>
191
+ <subpod title=''>
192
+ <img src='http://www4c.wolframalpha.com/Calculate/MSP/MSP128221e526f37g26886800003aeicb7fh2a85cfd?MSPStoreType=image/gif&amp;s=7'
193
+ alt='41.92 kDa (kilodaltons)'
194
+ title='41.92 kDa (kilodaltons)'
195
+ width='147'
196
+ height='18' />
197
+ <plaintext>41.92 kDa (kilodaltons)</plaintext>
198
+ </subpod>
199
+ </pod>
200
+ <pod title='Homologs across organisms'
201
+ scanner='Data'
202
+ id='HomologsAcrossOrganisms:GeneData'
203
+ position='1100'
204
+ error='false'
205
+ numsubpods='1'>
206
+ <subpod title=''>
207
+ <img src='http://www4c.wolframalpha.com/Calculate/MSP/MSP128321e526f37g26886800004122ga6569a57dai?MSPStoreType=image/gif&amp;s=7'
208
+ alt=''
209
+ title=''
210
+ width='490'
211
+ height='382' />
212
+ <plaintext></plaintext>
213
+ </subpod>
214
+ <states count='1'>
215
+ <state name='Show legend'
216
+ input='HomologsAcrossOrganisms:GeneData__Show legend' />
217
+ </states>
218
+ </pod>
219
+ <assumptions count='1'>
220
+ <assumption type='Clash'
221
+ word='whackadoo'
222
+ template='Assuming &quot;${word}&quot; is ${desc1}. Use as ${desc2} instead'
223
+ count='2'>
224
+ <value name='Gene'
225
+ desc='a gene'
226
+ input='*C.whackadoo-_*Gene-' />
227
+ <value name='Word'
228
+ desc='a word'
229
+ input='*C.whackadoo-_*Word-' />
230
+ </assumption>
231
+ </assumptions>
232
+ <warnings count='1'>
233
+ <spellcheck word='whackadoo'
234
+ suggestion='whacked'
235
+ text='Interpreting &quot;whackadoo&quot; as &quot;whacked&quot;' />
236
+ </warnings>
237
+ <sources count='2'>
238
+ <source url='http://www.wolframalpha.com/sources/GeneDataSourceInformationNotes.html'
239
+ text='Gene data' />
240
+ <source url='http://www.wolframalpha.com/sources/GenomeSequenceDataSourceInformationNotes.html'
241
+ text='Genome sequence data' />
242
+ </sources>
243
+ </queryresult>
@@ -0,0 +1,42 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ def mock_fixture(fixture)
4
+ mock_xml = File.open("spec/fixtures/#{fixture}.xml").read
5
+ allow(RestClient).to receive(:get) { mock_xml }
6
+ end
7
+
8
+ describe Lita::Handlers::OnewheelWolframAlpha, :lita_handler => true do
9
+
10
+ before(:each) do
11
+ # mock_geocoder = ::Geocoder::Result::Google.new({'formatted_address' => 'Portland, OR', 'geometry' => { 'location' => { 'lat' => 45.523452, 'lng' => -122.676207 }}})
12
+ # allow(::Geocoder).to receive(:search) { [mock_geocoder] } # It expects an array of geocoder objects.
13
+
14
+ registry.configure do |config|
15
+ config.handlers.onewheel_wolfram_alpha.api_uri = 'http://api.wolframalpha.com/v2/query?input=[query]&appid=[appid]'
16
+ config.handlers.onewheel_wolfram_alpha.app_id = 'app-id-here'
17
+ end
18
+ end
19
+
20
+ it { is_expected.to route_command('alpha') }
21
+
22
+ it 'will work' do
23
+ mock_fixture('pi')
24
+ send_command 'alpha pi'
25
+ expect(replies.last).to eq('3.141592653589793238462643383279502884197169399375105820974...')
26
+ end
27
+
28
+ it 'will fail gracefully' do
29
+ mock_fixture('boopadoop')
30
+ send_command 'alpha boopadoop'
31
+ expect(replies.last).to eq('Wolfram couldn\'t parse boopadoop.')
32
+ end
33
+
34
+ it 'will error missing config' do
35
+ registry.configure do |config|
36
+ config.handlers.onewheel_wolfram_alpha.api_uri = 'http://api.wolframalpha.com/v2/query?input=[query]&appid=[appid]'
37
+ config.handlers.onewheel_wolfram_alpha.app_id = nil
38
+ end
39
+ send_command 'alpha pi'
40
+ expect(replies.last).to eq(nil)
41
+ end
42
+ end
@@ -0,0 +1,15 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ SimpleCov.formatters = [
4
+ SimpleCov::Formatter::HTMLFormatter,
5
+ Coveralls::SimpleCov::Formatter
6
+ ]
7
+ SimpleCov.start { add_filter '/spec/' }
8
+ Coveralls.wear!
9
+
10
+ require 'lita-onewheel-wolfram-alpha'
11
+ require 'lita/rspec'
12
+
13
+ # A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
14
+ # was generated with Lita 4, the compatibility mode should be left disabled.
15
+ Lita.version_3_compatibility_mode = false
metadata ADDED
@@ -0,0 +1,191 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-onewheel-wolfram-alpha
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Kreps
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: lita
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rack-test
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.6'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.10'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.10'
125
+ - !ruby/object:Gem::Dependency
126
+ name: coveralls
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.8'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.8'
139
+ description: Lita interface to Wolfram Alpha.
140
+ email:
141
+ - andrew.kreps@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".gitignore"
147
+ - ".travis.yml"
148
+ - Gemfile
149
+ - LICENSE
150
+ - README.rst
151
+ - Rakefile
152
+ - lib/lita-onewheel-wolfram-alpha.rb
153
+ - lib/lita/handlers/onewheel_wolfram_alpha.rb
154
+ - lita-onewheel-wolfram-alpha.gemspec
155
+ - lita_config_sample.rb
156
+ - spec/fixtures/boopadoop.xml
157
+ - spec/fixtures/pi.xml
158
+ - spec/fixtures/whackadoo.xml
159
+ - spec/lita/handlers/onewheel_wolfram_alpha_spec.rb
160
+ - spec/spec_helper.rb
161
+ homepage: https://github.com/onewheelskyward/lita-onewheel-wolfram-alpha
162
+ licenses:
163
+ - MIT
164
+ metadata:
165
+ lita_plugin_type: handler
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ requirements: []
181
+ rubyforge_project:
182
+ rubygems_version: 2.4.5.1
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: Summarize THIS!
186
+ test_files:
187
+ - spec/fixtures/boopadoop.xml
188
+ - spec/fixtures/pi.xml
189
+ - spec/fixtures/whackadoo.xml
190
+ - spec/lita/handlers/onewheel_wolfram_alpha_spec.rb
191
+ - spec/spec_helper.rb