lita-onewheel-freds-sound-of-music 0.0.1 → 0.0.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: d6fd7b6c4be0054af7af79c0ba7696a75183f497
4
- data.tar.gz: 6e2148af81b53fdc886bbf5310239bf4064c2e4e
3
+ metadata.gz: 91a01321671edca204a317004fbba9e3eae912ac
4
+ data.tar.gz: 15a70b0a0216ce68e62baa958bf705792bb4aa63
5
5
  SHA512:
6
- metadata.gz: 1e1f7e5026be0c13a60d319500a37a6de48aac276777c2c23438e9037cf0eaf8b7e68c2d9409c66e19112ab1fcac6535a0f6df640607fe2002ce7af1ce444dae
7
- data.tar.gz: 77f3f5d5bd4fe72d2be4e763f9fb75b4c05332a4095043446f193667f56af920f32c3cbaaf068b1d42096acd74fe3eda0636a4bcb46f6938a37f32298c021f78
6
+ metadata.gz: c49353ab20088bce2355d49700959847cb11778ea47f1186c077758d37d79c48e0b83a5e7c66532d8f8b26f854cd994085297b6732cc3c7d0c0dbfdc3ad8f885
7
+ data.tar.gz: f2321a2e8c4ed450f10ec992f93cd64521ce5dcbad0c4325f3e217af68096ee68ea78b654e80a2b34b1f9124e351f2abb0574c3958e460ac29396af06b8e02cb
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.4
4
+ script: bundle exec rake
5
+ before_install:
6
+ - gem update --system
7
+ services:
8
+ - redis-server
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lita-onewheel-freds-sound-of-music (0.0.1)
4
+ lita-onewheel-freds-sound-of-music (0.0.2)
5
5
  lita (~> 4)
6
6
  nokogiri (~> 1)
7
7
  rest-client (~> 1)
@@ -7,6 +7,7 @@ module Lita
7
7
  route(/^freds\s+(.*)/i, :freds_search, command: true, help: 'freds whatevs')
8
8
 
9
9
  def freds_search(response)
10
+ search_term = response.matches[0][0]
10
11
  doc = RestClient.get 'http://www.fredsoundofmusic.com/specials/pre-owned-components.html'
11
12
  noko_doc = Nokogiri::HTML doc
12
13
  tables = noko_doc.css('#rt-main table')
@@ -40,7 +41,13 @@ module Lita
40
41
  end
41
42
  end
42
43
  break if record[:brand].empty? and record[:model].empty?
43
- records.push record
44
+
45
+ if record[:brand].match(/#{search_term}/i) or
46
+ record[:model].match(/#{search_term}/i) or
47
+ record[:description].match(/#{search_term}/i)
48
+
49
+ records.push record
50
+ end
44
51
  end
45
52
  format_output(response, records)
46
53
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-freds-sound-of-music'
3
- spec.version = '0.0.1'
3
+ spec.version = '0.0.2'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = %q{Lita interface to Fred's sound of music used listings.}
@@ -5,5 +5,22 @@ describe Lita::Handlers::OnewheelFredsSoundOfMusic, lita_handler: true do
5
5
  mock_fixture('freds')
6
6
  send_command 'freds '
7
7
  expect(replies.last).to eq('Yamaha CT-1010 was $385.00, now $299.95')
8
+ expect(replies.length).to eq(176)
9
+ end
10
+
11
+ it 'will search for an item' do
12
+ mock_fixture('freds')
13
+ send_command 'freds mx130'
14
+ expect(replies.length).to eq(1)
15
+ expect(replies.last).to eq('Mcintosh MX130 was $4800.00, now $999.95')
16
+ end
17
+
18
+ it 'will search for an item by brand' do
19
+ mock_fixture('freds')
20
+ send_command 'freds mci'
21
+ expect(replies.length).to eq(3)
22
+ expect(replies[0]).to eq('Mcintosh MX130 was $4800.00, now $999.95')
23
+ expect(replies[1]).to eq('Mcintosh MC502 was $1200.00, now $895.00')
24
+ expect(replies.last).to eq('Mcintosh MR80 was $2499.00, now $1295.00')
8
25
  end
9
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-freds-sound-of-music
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
@@ -144,6 +144,7 @@ extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
146
  - ".gitignore"
147
+ - ".travis.yml"
147
148
  - Gemfile
148
149
  - Gemfile.lock
149
150
  - README.md