lita-onewheel-wolfram-alpha 0.1.6 → 0.1.7

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: d710c2e31337fe20000c5b4217478d237a91d3a5
4
- data.tar.gz: 71c621a5354931955d31469641ba194a5c80f08e
3
+ metadata.gz: 32d63934952e4504db6d17f6dd505b5c65a1a76c
4
+ data.tar.gz: 50dbb62982c46ee9fff0e6c30eef451af75f34d0
5
5
  SHA512:
6
- metadata.gz: 2cf27290e2bf0626a26e2e8e5e5284d3c34cdbea56b98b7aa063137d9a20d27dd98e7126afaeb43e62a6ba19d9508752e6506bbf180e8e5e272c9c468b9c54a8
7
- data.tar.gz: c5898bb0e13fa55e180dc32f4ccc15959d774ad71f9cd9ef2db0bfcb66377fe11e3b0b4351dee91b6363e6c6759d6963d7acdb3aeaf60621b65ac0080e10400a
6
+ metadata.gz: 0fe0c32402834e5978545d17a84af6639cc4bc56d84e29617bab46eef648bf8b340013ba35f9f9c95f6ad2403924935b519e97842fc36e5a278ca4f15ea92ae9
7
+ data.tar.gz: 281b516a85370dcf72156b6cf5ee32e5946ea4f162f6095f9910507787ad8ed70d9a070b5df0789e8b857d8cdee1d01c11844392a87e0c2d45067f4bdd632ee6
@@ -24,12 +24,17 @@ module Lita
24
24
  def parse_response(noko_doc, query)
25
25
  success_node = noko_doc.xpath('queryresult').attribute('success')
26
26
  Lita.logger.debug "lita-onewheel-wolfram-alpha: Success attr: #{success_node.to_s}"
27
+
28
+ # No sense parsing if we didn't have success.
27
29
  if success_node.to_s == 'true'
30
+
28
31
  pods = noko_doc.xpath('//pod')
29
32
  Lita.logger.debug "lita-onewheel-wolfram-alpha: Pod title: #{pods[1].attribute('title').to_s}"
30
- if pods[1].attribute('title').to_s == 'Plot'
33
+
34
+ title = pods[1].attribute('title').to_s
35
+ if title == 'Plot' # Plot is a graph, grab the image.
31
36
  pods[1].xpath('//img')[1].attribute('src').to_s
32
- else
37
+ else # Plaintext seems to work well for, say, Definition.
33
38
  rid_thee_of_extras pods[1].xpath('//plaintext')[1].child.to_s
34
39
  end
35
40
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-wolfram-alpha'
3
- spec.version = '0.1.6'
3
+ spec.version = '0.1.7'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = %q{Lita interface to Wolfram Alpha.}
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
15
  spec.require_paths = ['lib']
16
16
 
17
- spec.add_runtime_dependency 'lita', '~> 4.7'
17
+ spec.add_runtime_dependency 'lita', '~> 4'
18
18
  spec.add_runtime_dependency 'rest-client', '~> 1.8'
19
19
  spec.add_runtime_dependency 'nokogiri', '~> 1.6'
20
20
 
@@ -28,7 +28,11 @@ describe Lita::Handlers::OnewheelWolframAlpha, :lita_handler => true do
28
28
  it 'will fail gracefully' do
29
29
  mock_fixture('boopadoop')
30
30
  send_command 'alpha boopadoop'
31
- expect(replies.last).to include('Wolfram couldn\'t parse boopadoop.')
31
+ expect(replies.last).to satisfy { |v|
32
+ ['Nope, no boopadoop to see here.',
33
+ 'What\'s that, now?',
34
+ 'boopadoop?'].include? v
35
+ }
32
36
  end
33
37
 
34
38
  it 'will print plot for mathy things' do
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.6
4
+ version: 0.1.7
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-02-04 00:00:00.000000000 Z
11
+ date: 2016-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.7'
19
+ version: '4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.7'
26
+ version: '4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  requirements: []
183
183
  rubyforge_project:
184
- rubygems_version: 2.4.5.1
184
+ rubygems_version: 2.5.1
185
185
  signing_key:
186
186
  specification_version: 4
187
187
  summary: Summarize THIS!