lita-stocks 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a7fd275422bfebddc45317dc7f3da4437aa9207
4
- data.tar.gz: 9b9bb0fbfe4e7c750a50f5a2f638bb26f39f7211
3
+ metadata.gz: 8a03cc9ae4756d10416e873a065fe60faa46479f
4
+ data.tar.gz: cc1c5b78c7fd3d8631f94353e02e7ad286e8a6a8
5
5
  SHA512:
6
- metadata.gz: b912a31430ca6e7a319b9286f67a1441f613fa661f7c5fc94129247a059052cc6be20845af76c27a1c63a0f36883a4ce60ee9b9221006ff41a73e7beba49a0eb
7
- data.tar.gz: ec831fd016a420db0fa18547439245fc13fa70afa9ea6d39fa62a5110cc4f47e177efc69e107457289e87b3930f25b480ad3ec913c5ca8b51125cd4efcbca6a9
6
+ metadata.gz: 2e26a75e9725c6cf26676202f941d1b0877dd2c5c5c2ac6dd580049daa5d9da156c415d79f35c5c72a9af3e85018335e0707f68bceb7b1dff9a2596a8d0f9571
7
+ data.tar.gz: 870481ebfb5cbc8a4af97f6d8e0fb92e2190464d3160bde6355af5f59dbb4b93aebd07e800d323d740b9064999bea9d08354afaa526199979fb455d434fa81f3
@@ -30,7 +30,16 @@ module Lita
30
30
  end
31
31
 
32
32
  def format_response(data)
33
- "#{data['name']} (#{data['e']}:#{data['t']}) - #{data['l']} (#{data['c']}, #{data['cp']}%) - 52week high/low: (#{data['hi52']}/#{data['lo52']}) - MktCap: #{data['mc']} - P/E: #{data['pe']}"
33
+ line = []
34
+ line << "#{data['name']} (#{data['e']}:#{data['t']})"
35
+ line << "#{data['l']} (#{data['c']}, #{data['cp']}%)"
36
+ line << "52week high/low: (#{data['hi52']}/#{data['lo52']})"
37
+
38
+ # don't include these sections if they don't exist
39
+ line << "MktCap: #{data['mc']}" unless data['mc'].empty?
40
+ line << "P/E: #{data['pe']}" unless data['pe'].empty?
41
+
42
+ line.join ' - '
34
43
  end
35
44
 
36
45
 
data/lita-stocks.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-stocks"
3
- spec.version = "0.0.3"
3
+ spec.version = "0.0.4"
4
4
  spec.authors = ["Mitch Dempsey"]
5
5
  spec.email = ["mrdempsey@gmail.com"]
6
6
  spec.description = %q{A Lita handler that displays stock prices}
@@ -9,10 +9,18 @@ describe Lita::Handlers::Stocks, lita_handler: true do
9
9
  expect(replies.last).to include("Google Inc")
10
10
  expect(replies.last).to include("GOOG")
11
11
  expect(replies.last).to include("NASDAQ")
12
+ expect(replies.last).to include("MktCap")
12
13
  end
13
14
 
14
15
  it "checks an invalid stock" do
15
16
  send_command "stock GOOGFAKE"
16
17
  expect(replies.last).to eq("Sorry, but there was a problem retrieving stock information.")
17
18
  end
19
+
20
+ it "checks a stock without mktcap" do
21
+ send_command "stock .DJI"
22
+ expect(replies.last).to include("Dow Jones Industrial")
23
+ expect(replies.last).to_not include("MktCap")
24
+ expect(replies.last).to_not include("P/E")
25
+ end
18
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-stocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitch Dempsey