lita-onewheel-amazon-product 0.3.0 → 0.4.0

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: 6899ecfa18f1bb5b95a06b39bd09c0448ad30a23
4
- data.tar.gz: 9c04098ff39157d2cabd9eba72a23ebf34816572
3
+ metadata.gz: ab88f848d78f7700fb32c6b7b85a1511eca6d354
4
+ data.tar.gz: 8cf86eea3f9beb0733750018400e0a283f5c19b0
5
5
  SHA512:
6
- metadata.gz: 530548e88d7ffc3ef3ccce4c69c348041eb027fac0aef818c3343cd0460692c0970ba27437b94e55f8e3f103ec2fe9dd7adbad707155517c0c892e888b14f6d8
7
- data.tar.gz: 2d17c457a457add13b13fd9d4a6c666ad2828e3f6c88ec8d4be26a77726782561f1c9a640cf3820cf54afd256082d9ae5d3eb03e4e305320e3a8c47930be4e4b
6
+ metadata.gz: 0612546d206ddead7ef777a3283960dba8eba36aa5b6ffdb8562b25197075074e418050230b94184a19445adc3b39479f2f8cac4a04cc5d9e5e2672272f9da68
7
+ data.tar.gz: c2f56a0edfac2234ab54883d46839f15406e51069e4fdf7bf3eb1d1bbf0ca59527ab780689111cd5cebd7b37a6a540f7c248ee0ba8ae14750ea59d227a5cd9d1
@@ -33,6 +33,8 @@ module Lita
33
33
  end
34
34
  end
35
35
 
36
+ # Getting prices is very non-intuitive, every type of price has it's own structure.
37
+ # Here we keep trying until we get something.
36
38
  def get_price(noko_doc)
37
39
  price_node = noko_doc.css('span#priceblock_ourprice')
38
40
 
@@ -58,7 +60,7 @@ module Lita
58
60
  end
59
61
 
60
62
  def process_description(desc)
61
- desc.sub! /^Amazon.com: /, ''
63
+ desc.sub! /^Amazon.com\s*: /, ''
62
64
  desc.sub! /:.*$/, ''
63
65
  end
64
66
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-amazon-product'
3
- spec.version = '0.3.0'
3
+ spec.version = '0.4.0'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = %q{Lita interface to post information about amazon products.}
@@ -0,0 +1,24 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
5
+ <link rel="canonical" href="http://www.amazon.com/Passion-Lubes-Silicone-Hybrid-Lubricant/dp/B00SZ3O6OU" />
6
+ <meta name="description" content="Amazon.com: Passion Lubes Passion Water and Silicone Blend Hybrid Lubricant, 55 Gallon: Health &amp; Personal Care" />
7
+ <meta name="title" content="Amazon.com: Passion Lubes Passion Water and Silicone Blend Hybrid Lubricant, 55 Gallon: Health &amp; Personal Care" />
8
+ <meta name="keywords" content="lube drum" />
9
+ <title>Amazon.com: Passion Lubes Passion Water and Silicone Blend Hybrid Lubricant, 55 Gallon: Health &amp; Personal Care</title>
10
+ </head>
11
+ <body>
12
+ <div id="price" class="a-section a-spacing-small">
13
+ <table class="a-lineitem">
14
+ <tr id="priceblock_ourprice_row">
15
+ <td id="priceblock_ourprice_lbl" class="a-color-secondary a-size-base a-text-right a-nowrap">Price:</td>
16
+ <td class="a-span12">
17
+ <span id="priceblock_ourprice" class="a-size-medium a-color-price">$1,415.67</span>
18
+ <span class="a-size-small a-color-price"> ($1,415.67 / Count)</span>
19
+ </td>
20
+ </tr>
21
+ </table>
22
+ </div>
23
+ </body>
24
+ </html>
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
5
+ <link rel="canonical" href="http://www.amazon.com/Nasco-Infant-Circumcision-Trainer-White/dp/B0083Y0W26" />
6
+ <meta name="description" content="Amazon.com : Infant Circumcision Trainer, White : Other Products : Everything Else" />
7
+ <meta name="title" content="Amazon.com : Infant Circumcision Trainer, White : Other Products : Everything Else" />
8
+ <meta name="keywords" content="Infant Circumcision Trainer, White,Nasco" />
9
+ <title>Amazon.com : Infant Circumcision Trainer, White : Other Products : Everything Else</title>
10
+ </head>
11
+ <body>
12
+ <span id="priceblock_ourprice" class="a-size-medium a-color-price">$192.00</span>
13
+ </body>
14
+ </html>
@@ -13,3 +13,4 @@
13
13
  <div class="a-text-center a-spacing-mini"><a href="/gp/offer-listing/B001AE8YBW/ref=dp_olp_new_mbc?ie=UTF8&amp;condition=new">2&nbsp;new</a>&nbsp;from&nbsp;<span class='a-color-price'>$67.30</span></div>
14
14
  </body>
15
15
  </html>
16
+ r
@@ -29,4 +29,16 @@ describe Lita::Handlers::OnewheelAmazonProduct, lita_handler: true do
29
29
  send_message ('http://www.amazon.com/Echo-Billionaire-Romance-Bleeding-Hearts-ebook/dp/B01786HTZW')
30
30
  expect(replies.last).to eq('$2.99 Echo')
31
31
  end
32
+
33
+ it 'puts the price of 55 gallons of lube' do
34
+ mock_fixture('55_gallons_of_lube_price')
35
+ send_message ('http://www.amazon.com/Passion-Lubes-Silicone-Hybrid-Lubricant/dp/B00SZ3O6OU/ref=sr_1_1?ie=UTF8&qid=1454972328&sr=8-1&keywords=lube+drum')
36
+ expect(replies.last).to eq('$1,415.67 Passion Lubes Passion Water and Silicone Blend Hybrid Lubricant, 55 Gallon')
37
+ end
38
+
39
+ it 'puts the price of an infant circumcision' do
40
+ mock_fixture('infant_circumcision_price')
41
+ send_message ('http://www.amazon.com/Nasco-Infant-Circumcision-Trainer-White/dp/B0083Y0W26')
42
+ expect(replies.last).to eq('$192.00 Infant Circumcision Trainer, White ')
43
+ end
32
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-amazon-product
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
@@ -151,7 +151,9 @@ files:
151
151
  - lib/lita-onewheel-amazon-product.rb
152
152
  - lib/lita/handlers/onewheel_amazon_product.rb
153
153
  - lita-onewheel-amazon-product.gemspec
154
+ - spec/fixtures/55_gallons_of_lube_price.html
154
155
  - spec/fixtures/book_price.html
156
+ - spec/fixtures/infant_circumcision_price.html
155
157
  - spec/fixtures/kindle_book_price.html
156
158
  - spec/fixtures/our_price.html
157
159
  - spec/fixtures/third_party_price.html
@@ -183,7 +185,9 @@ signing_key:
183
185
  specification_version: 4
184
186
  summary: See above.
185
187
  test_files:
188
+ - spec/fixtures/55_gallons_of_lube_price.html
186
189
  - spec/fixtures/book_price.html
190
+ - spec/fixtures/infant_circumcision_price.html
187
191
  - spec/fixtures/kindle_book_price.html
188
192
  - spec/fixtures/our_price.html
189
193
  - spec/fixtures/third_party_price.html