goodwill 0.4.4 → 0.4.6

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
  SHA256:
3
- metadata.gz: cf84ef363c1c87eaf2fc9f011d9fa681aef56247a2df2cf5af55d33dd725ed4b
4
- data.tar.gz: ec1584de80ef94d2cbbf6698eaf11eca99a61bd0c48a85885483bef37af5ac46
3
+ metadata.gz: 4179a1b7a46965ea77ed93238d5627d89e7bc1463c7c5a2aef0be750cab52d6e
4
+ data.tar.gz: 353fe9f4c623e93ea19554591840733a2436c9a1e2bd07a86da104b4f0b0029e
5
5
  SHA512:
6
- metadata.gz: af9b02c0825967780a2ea0d85825a936da69125a550a8804fcdd01c70f381dcca03e8680c7310423d3f9235ae6ceda049c4c1f90b2eeaf76dfdcf9342a3afa31
7
- data.tar.gz: 575bcdbc9ab1177d31bb73ce45bfbf9232d60fdfa5c4c18f1705027fed8d22374913ac726ae9f95216d2dbc71a60b61e2abb83dc51cf04795dc399c80f7945db
6
+ metadata.gz: c634d19b4480caa3b7d1b54680b16078cfb5c182dd8ed1aac7367b3681c0593ad87fe0c45589ded56e71cfe7561371f124a43b9fbaec3fb007bb9df8c9ad86de
7
+ data.tar.gz: 204669e69d251295d875a94ebb4f0f760afd2017945d1be77a5333309811923c0f21fd53a1ee885088ab10903a946564e187c1755f81d965dcde2451d937ca2f
@@ -101,7 +101,9 @@ module Goodwill
101
101
  end
102
102
 
103
103
  def total_items(page)
104
- page.search('//*[@id="search-results"]/div/div[1]/nav[1]/p').first.text.split(' of ')[1].split(' ').first.to_i
104
+ return 0 unless page.search(NO_ITEMS_FOUND_PATH).empty?
105
+
106
+ page.search(ITEMS_COUNT_PATH).first.text.split(' of ')[1].split(' ').first.to_i
105
107
  end
106
108
  end
107
109
  end
@@ -22,13 +22,23 @@ module Goodwill
22
22
  desc 'auctions', "List all auctions you're currently bidding on"
23
23
  def auctions
24
24
  say "Your current auctions:\n"
25
- tp @account.in_progress
25
+ res = @account.in_progress
26
+ if res.empty?
27
+ puts 'No items found.'
28
+ else
29
+ tp res
30
+ end
26
31
  end
27
32
 
28
33
  desc 'search SEARCH', 'Search for auctions matching SEARCH'
29
34
  def search(search)
30
35
  say 'Your search results:'
31
- tp @account.search(search)
36
+ res = @account.search(search)
37
+ if res.empty?
38
+ puts 'No items found.'
39
+ else
40
+ tp res
41
+ end
32
42
  end
33
43
 
34
44
  desc 'bid ITEMID MAXBID', 'Bid MAXBID on ITEMID'
@@ -11,7 +11,9 @@ module Goodwill
11
11
  END_TIME_PATH = '/html/body/section/div[2]/div[3]/div[2]/ul[2]/li[10]'
12
12
  IN_PROGRESS_ROWS = '#my-auctions-table > tbody > tr'
13
13
  ITEMID_PATH = 'body > span > div.itemdetail > div:nth-child(2) > div:nth-child(2) > div > table > tbody > tr:nth-child(3) > td'
14
+ ITEMS_COUNT_PATH = '//*[@id="search-results"]/div/div[1]/nav[1]/p'
14
15
  ITEM_TITLE_PATH = 'body > section > div.container > div:nth-child(3) > div:nth-child(2) > h1'
16
+ NO_ITEMS_FOUND_PATH = '/html/body/section/div[2]/div[4]/div[2]/div/div[2]/p'
15
17
  SEARCH_ROWS = '#search-results > div > section > ul.products > li'
16
18
  SELLER_ID_LINK = '/html/body/section/div[2]/div[4]/div/section/div/ul/li[4]/a'
17
19
  SELLER_PATH = 'body > section > div.container > div:nth-child(3) > div:nth-child(2) > ul.product-data > li:nth-child(8) > a'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Goodwill
4
- VERSION = '0.4.4'
4
+ VERSION = '0.4.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goodwill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Burnett
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-19 00:00:00.000000000 Z
11
+ date: 2020-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem-release