goodwill 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/lib/goodwill/account.rb +3 -2
- data/lib/goodwill/auction.rb +4 -11
- data/lib/goodwill/biddingauction.rb +1 -10
- data/lib/goodwill/cli.rb +3 -1
- data/lib/goodwill/mechanize.rb +1 -3
- data/lib/goodwill/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4067be1f98e0d4de75e6b2880f35d671d8d88b3d939aaa64b1e85c5448775759
|
4
|
+
data.tar.gz: e5eedc6e6208cbf1b9706349bf7485934c1b2c4d91f07a8d655775134dcf151c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5351d1a764cf460f4e0850da86ae0f95da9608ead60742f25e42477d71bfbdf9a8fe2c78e7a28037060088b85c00f66db637dc0fa6ee193a51e7880a9f34dde
|
7
|
+
data.tar.gz: d1b3b90c793943446a2e0ac4b676b3785d2e4eb2d85ef997f59dbd8c030c170707b5049c06cc2867ddeb63f19077049c80a3fec22f1aa41f867e5ee2131dac0d
|
data/.travis.yml
CHANGED
data/lib/goodwill/account.rb
CHANGED
@@ -65,13 +65,14 @@ module Goodwill
|
|
65
65
|
# -5 - bid less than minimum
|
66
66
|
mechanize.get(BID_URL, params) do |page|
|
67
67
|
res = JSON.parse(page.body)
|
68
|
-
|
68
|
+
case res['BidResult']
|
69
|
+
when 1
|
69
70
|
return true if res['BidResultMessage'].include?('Bid Received')
|
70
71
|
|
71
72
|
return false if res['BidResultMessage'].include?('You have already been outbid.')
|
72
73
|
|
73
74
|
raise Goodwill::BidError, res['BidResultMessage']
|
74
|
-
|
75
|
+
when -5
|
75
76
|
raise Goodwill::BidError, res['BidResultMessage']
|
76
77
|
end
|
77
78
|
end
|
data/lib/goodwill/auction.rb
CHANGED
@@ -15,17 +15,7 @@ module Goodwill
|
|
15
15
|
include CSSPaths
|
16
16
|
include URLPaths
|
17
17
|
|
18
|
-
attr_reader :item_page
|
19
|
-
|
20
|
-
attr_reader :bids
|
21
|
-
attr_reader :current
|
22
|
-
attr_reader :end
|
23
|
-
attr_reader :href
|
24
|
-
attr_reader :item
|
25
|
-
attr_reader :itemid
|
26
|
-
attr_reader :seller
|
27
|
-
attr_reader :shipping
|
28
|
-
attr_reader :type
|
18
|
+
attr_reader :item_page, :bids, :current, :end, :href, :item, :itemid, :seller, :shipping, :type
|
29
19
|
|
30
20
|
def initialize(itemid, zipcode = '97222', state = 'OR', country = 'US')
|
31
21
|
@itemid = itemid
|
@@ -70,6 +60,9 @@ module Goodwill
|
|
70
60
|
params = "?ZipCode=#{zipcode}&Country=#{country}&ItemId=#{itemid}&Quantity=1&_=#{DateTime.now.strftime('%s')}"
|
71
61
|
page = mechanize.get(SHIPPING_URL + params)
|
72
62
|
page.search(SHIPPING_PATH).text.split(': ').last.tr('$', '').to_f
|
63
|
+
rescue StandardError
|
64
|
+
puts "Timeout (#{e}), retrying in 1 second..."
|
65
|
+
retry
|
73
66
|
end
|
74
67
|
|
75
68
|
def parse_end_time
|
@@ -6,19 +6,10 @@ module Goodwill
|
|
6
6
|
class BiddingAuction < Auction
|
7
7
|
include URLPaths
|
8
8
|
|
9
|
-
attr_reader :bidding
|
10
|
-
attr_reader :winning
|
11
|
-
attr_reader :max
|
9
|
+
attr_reader :bidding, :winning, :max, :current, :end, :href, :item, :itemid, :seller, :shipping
|
12
10
|
|
13
11
|
# TODO: why do i need this?
|
14
12
|
attr_reader :bids
|
15
|
-
attr_reader :current
|
16
|
-
attr_reader :end
|
17
|
-
attr_reader :href
|
18
|
-
attr_reader :item
|
19
|
-
attr_reader :itemid
|
20
|
-
attr_reader :seller
|
21
|
-
attr_reader :shipping
|
22
13
|
|
23
14
|
def initialize(itemid, mechanize)
|
24
15
|
super(itemid)
|
data/lib/goodwill/cli.rb
CHANGED
@@ -7,6 +7,7 @@ module Goodwill
|
|
7
7
|
class_option :verbose, type: :boolean
|
8
8
|
class_option :username
|
9
9
|
class_option :password
|
10
|
+
class_option :threads
|
10
11
|
|
11
12
|
def initialize(*args)
|
12
13
|
super
|
@@ -14,7 +15,8 @@ module Goodwill
|
|
14
15
|
|
15
16
|
username = options[:username] || ask('Username:')
|
16
17
|
password = options[:password] || ask('Password:') { |q| q.echo = false }
|
17
|
-
|
18
|
+
threads = options[:threads].to_i || 10
|
19
|
+
@account = Goodwill::Account.new(username, password, threads)
|
18
20
|
end
|
19
21
|
|
20
22
|
desc 'auctions', "List all auctions you're currently bidding on"
|
data/lib/goodwill/mechanize.rb
CHANGED
data/lib/goodwill/version.rb
CHANGED
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
|
+
version: 0.4.1
|
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-
|
11
|
+
date: 2020-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem-release
|