lita-onewheel-wolfram-alpha 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 568fdb625d8249fa73b2a9c24c38a680b45223af
4
- data.tar.gz: 5cade098191fea9db8621cbaaf0a70be1868aa24
3
+ metadata.gz: 4656a007ca97cd0059c881747d01cc83596c4c5b
4
+ data.tar.gz: 4c96374eb4d63fcf59044d4e0446305bf574ea24
5
5
  SHA512:
6
- metadata.gz: cafda9a1aad6b8d22d23729897ccf078f1e2b030849e03dc5d296dac577a2eeb8f9e9ae0b165437715696295d2e4df029220b4d0289a709d33e3804536fdde35
7
- data.tar.gz: 01b0f7d4985d522c5625a28bdad365536abfc302145639dd00a6d0035a0fc2ceccadb13313dd919f2080f70b5e00ef6f312dde5a344e65eb50de43be747dd5d1
6
+ metadata.gz: 86e02b30b98082e440b822722c8387e422f13721de4142581b0d557aa88db140f9e52ab8e5350569f4e167e7a2cc25c4dd99457945b8aaa68c6245304115ef7c
7
+ data.tar.gz: 7844585a8046a4add10ba9a0446f24d1a1b30c2cbbd0d9b863484ef01f13b08774155424b09e56bf60076e58052bdc51637402e9f0f227c10c448bb286238240
@@ -29,7 +29,7 @@ module Lita
29
29
  if pods[1].attribute('title').to_s == 'Plot'
30
30
  pods[1].xpath('//img')[1].attribute('src').to_s
31
31
  else
32
- pods[1].xpath('//plaintext')[1].child.to_s
32
+ rid_thee_of_extras pods[1].xpath('//plaintext')[1].child.to_s
33
33
  end
34
34
 
35
35
  else
@@ -37,6 +37,10 @@ module Lita
37
37
  end
38
38
  end
39
39
 
40
+ def rid_thee_of_extras(str)
41
+ str.gsub /\s+\|\s/, ' | '
42
+ end
43
+
40
44
  def make_api_call(query)
41
45
  Lita.logger.debug "Making api call for #{query}"
42
46
  uri = build_uri query
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-wolfram-alpha'
3
- spec.version = '0.1.1'
3
+ spec.version = '0.1.2'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = %q{Lita interface to Wolfram Alpha.}
@@ -0,0 +1,284 @@
1
+
2
+ <?xml version='1.0' encoding='UTF-8'?>
3
+ <queryresult success='true'
4
+ error='false'
5
+ numpods='7'
6
+ datatypes='Quantity'
7
+ timedout=''
8
+ timedoutpods=''
9
+ timing='2.17'
10
+ parsetiming='0.495'
11
+ parsetimedout='false'
12
+ recalculate=''
13
+ id='MSPa359022hif15agcce362900005ac6ig6896h8a8a4'
14
+ host='http://www2.wolframalpha.com'
15
+ server='1'
16
+ related='http://www2.wolframalpha.com/api/v2/relatedQueries.jsp?id=MSPa359122hif15agcce3629000042178if829i81c3b&amp;s=1'
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://www2.wolframalpha.com/Calculate/MSP/MSP359222hif15agcce36290000464980bghgcb18h3?MSPStoreType=image/gif&amp;s=1'
26
+ alt='ly (light year)'
27
+ title='ly (light year)'
28
+ width='86'
29
+ height='18' />
30
+ <plaintext>ly (light year)</plaintext>
31
+ </subpod>
32
+ </pod>
33
+ <pod title='Conversions to other units'
34
+ scanner='Unit'
35
+ id='ConversionToOtherUnits'
36
+ position='200'
37
+ error='false'
38
+ numsubpods='1'>
39
+ <subpod title=''>
40
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP359322hif15agcce36290000312a6092c8i17107?MSPStoreType=image/gif&amp;s=1'
41
+ alt='1 ly | 0.3066 pc (parsecs)
42
+ | 63241 au (astronomical units)
43
+ | 9.461×10^12 km (kilometers)
44
+ | 9.461×10^15 meters
45
+ | 5.879 trillion miles'
46
+ title='1 ly | 0.3066 pc (parsecs)
47
+ | 63241 au (astronomical units)
48
+ | 9.461×10^12 km (kilometers)
49
+ | 9.461×10^15 meters
50
+ | 5.879 trillion miles'
51
+ width='262'
52
+ height='150' />
53
+ <plaintext>1 ly | 0.3066 pc (parsecs)
54
+ | 63241 au (astronomical units)
55
+ | 9.461×10^12 km (kilometers)
56
+ | 9.461×10^15 meters
57
+ | 5.879 trillion miles</plaintext>
58
+ </subpod>
59
+ <states count='1'>
60
+ <state name='Show exact conversions'
61
+ input='ConversionToOtherUnits__Show exact conversions' />
62
+ </states>
63
+ <infos count='1'>
64
+ <info>
65
+ <units count='1'>
66
+ <unit short='ly'
67
+ long='light years' />
68
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP359422hif15agcce3629000020i1hh6e7gbd9h3e?MSPStoreType=image/gif&amp;s=1'
69
+ width='110'
70
+ height='26' />
71
+ </units>
72
+ </info>
73
+ </infos>
74
+ </pod>
75
+ <pod title='Conversions from other units'
76
+ scanner='Unit'
77
+ id='ConversionFromOtherUnits'
78
+ position='300'
79
+ error='false'
80
+ numsubpods='1'>
81
+ <subpod title=''>
82
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP359522hif15agcce3629000045c1fa8i1a8gdcf3?MSPStoreType=image/gif&amp;s=1'
83
+ alt='1 pc | 3.262 ly
84
+ 1 au | 1.581×10^-5 ly
85
+ 1 km | 1.057×10^-13 ly
86
+ 1 m | 1.057×10^-16 ly
87
+ 1 mi | 1.701×10^-13 ly'
88
+ title='1 pc | 3.262 ly
89
+ 1 au | 1.581×10^-5 ly
90
+ 1 km | 1.057×10^-13 ly
91
+ 1 m | 1.057×10^-16 ly
92
+ 1 mi | 1.701×10^-13 ly'
93
+ width='178'
94
+ height='157' />
95
+ <plaintext>1 pc | 3.262 ly
96
+ 1 au | 1.581×10^-5 ly
97
+ 1 km | 1.057×10^-13 ly
98
+ 1 m | 1.057×10^-16 ly
99
+ 1 mi | 1.701×10^-13 ly</plaintext>
100
+ </subpod>
101
+ <states count='1'>
102
+ <state name='Show exact conversions'
103
+ input='ConversionFromOtherUnits__Show exact conversions' />
104
+ </states>
105
+ <infos count='1'>
106
+ <info>
107
+ <units count='6'>
108
+ <unit short='au'
109
+ long='astronomical units' />
110
+ <unit short='km'
111
+ long='kilometers' />
112
+ <unit short='ly'
113
+ long='light years' />
114
+ <unit short='mi'
115
+ long='miles' />
116
+ <unit short='m'
117
+ long='meters' />
118
+ <unit short='pc'
119
+ long='parsecs' />
120
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP359622hif15agcce362900004d35cgd7a6db16d6?MSPStoreType=image/gif&amp;s=1'
121
+ width='165'
122
+ height='131' />
123
+ </units>
124
+ </info>
125
+ </infos>
126
+ </pod>
127
+ <pod title='Physical quantities'
128
+ scanner='Unit'
129
+ id='PhysicalQuantity'
130
+ position='400'
131
+ error='false'
132
+ numsubpods='7'>
133
+ <subpod title=''>
134
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP359722hif15agcce3629000069hde5067a0dii57?MSPStoreType=image/gif&amp;s=1'
135
+ alt='length'
136
+ title='length'
137
+ width='42'
138
+ height='18' />
139
+ <plaintext>length</plaintext>
140
+ </subpod>
141
+ <subpod title=''>
142
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP359822hif15agcce3629000024hh29e545d63ed7?MSPStoreType=image/gif&amp;s=1'
143
+ alt='height'
144
+ title='height'
145
+ width='41'
146
+ height='18' />
147
+ <plaintext>height</plaintext>
148
+ </subpod>
149
+ <subpod title=''>
150
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP359922hif15agcce3629000063451ei0ef790621?MSPStoreType=image/gif&amp;s=1'
151
+ alt='depth'
152
+ title='depth'
153
+ width='37'
154
+ height='18' />
155
+ <plaintext>depth</plaintext>
156
+ </subpod>
157
+ <subpod title=''>
158
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP360022hif15agcce362900002hi3be42ia6c1ge5?MSPStoreType=image/gif&amp;s=1'
159
+ alt='radius'
160
+ title='radius'
161
+ width='41'
162
+ height='18' />
163
+ <plaintext>radius</plaintext>
164
+ </subpod>
165
+ <subpod title=''>
166
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP360122hif15agcce3629000058h2a318g75bdaba?MSPStoreType=image/gif&amp;s=1'
167
+ alt='diameter'
168
+ title='diameter'
169
+ width='58'
170
+ height='18' />
171
+ <plaintext>diameter</plaintext>
172
+ </subpod>
173
+ <subpod title=''>
174
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP360222hif15agcce362900004ga18aid04eic337?MSPStoreType=image/gif&amp;s=1'
175
+ alt='distance'
176
+ title='distance'
177
+ width='54'
178
+ height='18' />
179
+ <plaintext>distance</plaintext>
180
+ </subpod>
181
+ <subpod title=''>
182
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP360322hif15agcce362900002604iaebaf4ig7c0?MSPStoreType=image/gif&amp;s=1'
183
+ alt='circumference'
184
+ title='circumference'
185
+ width='94'
186
+ height='18' />
187
+ <plaintext>circumference</plaintext>
188
+ </subpod>
189
+ <states count='1'>
190
+ <state name='More'
191
+ input='PhysicalQuantity__More' />
192
+ </states>
193
+ </pod>
194
+ <pod title='Unit system'
195
+ scanner='Unit'
196
+ id='UnitSystem'
197
+ position='500'
198
+ error='false'
199
+ numsubpods='1'>
200
+ <subpod title=''>
201
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP360422hif15agcce362900003hi9e0f09f80a265?MSPStoreType=image/gif&amp;s=1'
202
+ alt='(not in a named unit system)'
203
+ title='(not in a named unit system)'
204
+ width='190'
205
+ height='18' />
206
+ <plaintext>(not in a named unit system)</plaintext>
207
+ </subpod>
208
+ </pod>
209
+ <pod title='Corresponding quantities for 1 ly'
210
+ scanner='Unit'
211
+ id='CorrespondingQuantity'
212
+ position='600'
213
+ error='false'
214
+ numsubpods='2'>
215
+ <subpod title=''>
216
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP360522hif15agcce3629000068ecia81f5i153f8?MSPStoreType=image/gif&amp;s=1'
217
+ alt='Light travel time t in vacuum from t = x/c:
218
+ | 1 year'
219
+ title='Light travel time t in vacuum from t = x/c:
220
+ | 1 year'
221
+ width='282'
222
+ height='41' />
223
+ <plaintext>Light travel time t in vacuum from t = x/c:
224
+ | 1 year</plaintext>
225
+ </subpod>
226
+ <subpod title=''>
227
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP360622hif15agcce36290000488hbe2hah8ei96f?MSPStoreType=image/gif&amp;s=1'
228
+ alt='Light travel time t in an optical fiber t = 1.48x/c:
229
+ | 1.5 years'
230
+ title='Light travel time t in an optical fiber t = 1.48x/c:
231
+ | 1.5 years'
232
+ width='320'
233
+ height='41' />
234
+ <plaintext>Light travel time t in an optical fiber t = 1.48x/c:
235
+ | 1.5 years</plaintext>
236
+ </subpod>
237
+ </pod>
238
+ <pod title='Comparisons for 1 ly as distance'
239
+ scanner='Unit'
240
+ id=''
241
+ position='700'
242
+ error='false'
243
+ numsubpods='2'>
244
+ <subpod title=''>
245
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP360722hif15agcce36290000112c6cgac34hge66?MSPStoreType=image/gif&amp;s=1'
246
+ alt=' ~~ ( 0.24 ~~ 1/4 ) × distance from Earth to Proxima Centauri (~~ 4.2 ly )'
247
+ title=' ~~ ( 0.24 ~~ 1/4 ) × distance from Earth to Proxima Centauri (~~ 4.2 ly )'
248
+ width='418'
249
+ height='18' />
250
+ <plaintext> ~~ ( 0.24 ~~ 1/4 ) × distance from Earth to Proxima Centauri (~~ 4.2 ly )</plaintext>
251
+ </subpod>
252
+ <subpod title=''>
253
+ <img src='http://www2.wolframalpha.com/Calculate/MSP/MSP360822hif15agcce3629000011e588gaddf1cb3e?MSPStoreType=image/gif&amp;s=1'
254
+ alt=' ~~ 0.9 × distance from the Sun to the Oort cloud&apos;s boundary (~~ 1.05×10^16 m )'
255
+ title=' ~~ 0.9 × distance from the Sun to the Oort cloud&apos;s boundary (~~ 1.05×10^16 m )'
256
+ width='474'
257
+ height='18' />
258
+ <plaintext> ~~ 0.9 × distance from the Sun to the Oort cloud&apos;s boundary (~~ 1.05×10^16 m )</plaintext>
259
+ </subpod>
260
+ </pod>
261
+ <assumptions count='1'>
262
+ <assumption type='MultiClash'
263
+ word=''
264
+ template='Assuming ${word1} is referring to ${desc1}. Use as ${desc2} instead. Use as ${desc3} instead. Use &quot;${word4}&quot; as ${desc4}.'
265
+ count='4'>
266
+ <value name='Unit'
267
+ word='the input'
268
+ desc='a unit'
269
+ input='*MC.%7E-_*Unit-' />
270
+ <value name='Movie'
271
+ word='the input'
272
+ desc='a movie'
273
+ input='*MC.%7E-_*Movie-' />
274
+ <value name='MusicWork'
275
+ word='the input'
276
+ desc='a music work'
277
+ input='*MC.%7E-_*MusicWork-' />
278
+ <value name='Book'
279
+ word='light'
280
+ desc='a book'
281
+ input='*MC.%7E-_*Book-' />
282
+ </assumption>
283
+ </assumptions>
284
+ </queryresult>
@@ -45,4 +45,10 @@ describe Lita::Handlers::OnewheelWolframAlpha, :lita_handler => true do
45
45
  send_command 'alpha pi'
46
46
  expect(replies.last).to eq(nil)
47
47
  end
48
+
49
+ it 'will single-line a multi-line plaintext' do
50
+ mock_fixture('multiline-plaintext')
51
+ send_command 'alpha light years'
52
+ expect(replies.last).to eq('1 ly | 0.3066 pc (parsecs) | 63241 au (astronomical units) | 9.461&#xD7;10^12 km (kilometers) | 9.461&#xD7;10^15 meters | 5.879 trillion miles')
53
+ end
48
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-wolfram-alpha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-26 00:00:00.000000000 Z
11
+ date: 2016-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -154,6 +154,7 @@ files:
154
154
  - lita-onewheel-wolfram-alpha.gemspec
155
155
  - lita_config_sample.rb
156
156
  - spec/fixtures/boopadoop.xml
157
+ - spec/fixtures/multiline-plaintext.xml
157
158
  - spec/fixtures/pi.xml
158
159
  - spec/fixtures/whackadoo.xml
159
160
  - spec/fixtures/x^2.xml
@@ -186,6 +187,7 @@ specification_version: 4
186
187
  summary: Summarize THIS!
187
188
  test_files:
188
189
  - spec/fixtures/boopadoop.xml
190
+ - spec/fixtures/multiline-plaintext.xml
189
191
  - spec/fixtures/pi.xml
190
192
  - spec/fixtures/whackadoo.xml
191
193
  - spec/fixtures/x^2.xml