goodwill 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/goodwill/auction.rb +16 -2
- data/lib/goodwill/csspaths.rb +1 -0
- data/lib/goodwill/urlpaths.rb +1 -0
- data/lib/goodwill/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWU4N2ZmOGYxZWMzNjA0MGVhYTdiNzhjODVhZmMzYzdiZWFjMGQ4Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2NkYTA2MjE4Nzc3ODVmYWI4MTQ5ZTViMTcwZWVhNWY2ODJkM2QwMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTdkZmNlNmM2MjU3ODY4YWE1YmJiNWNhNDEzOGI0OWMwODc2OTFkMTMxMTM1
|
10
|
+
ZmQzODYxZjQ1NDg3MTVjMmQzNzRiMmY2MjM4Y2FmYWJhZDIxNmJjNGEwMjUx
|
11
|
+
ZWY2YmIxODUwNGY0NGM5YTUxNWIxMjFiY2YxMjIwZDQ5MWIzNGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjUxNWY5Y2UwNmZiZDhhYTcwOThjOTMzNzhmNzRkNTIzZDVjOTUyMmZhM2M3
|
14
|
+
MDFiZDljNmIyNGU3ODU3ODYyMWVlNzAyMzgzMDY4MzE1NjVjYmNlNzE1NzI5
|
15
|
+
NjcyNDMwNWY2NDU1MTZiZjViZGFkYTliNzQyNWFlNjRjYzAyYWQ=
|
data/lib/goodwill/auction.rb
CHANGED
@@ -17,10 +17,15 @@ module Goodwill
|
|
17
17
|
attr_reader :item
|
18
18
|
attr_reader :itemid
|
19
19
|
attr_reader :seller
|
20
|
+
attr_reader :shipping
|
20
21
|
|
21
|
-
def initialize(itemid =
|
22
|
-
@href = ITEM_SEARCH_URL + itemid.to_s
|
22
|
+
def initialize(itemid, zipcode = '97222', state = 'OR', country = 'United States')
|
23
23
|
@itemid = itemid
|
24
|
+
@zipcode = zipcode
|
25
|
+
@state = state
|
26
|
+
@country = country
|
27
|
+
|
28
|
+
@href = ITEM_SEARCH_URL + itemid.to_s
|
24
29
|
item_page = mechanize.get(@href)
|
25
30
|
@bids = item_page.search(BIDS_PATH).text[/\d+/]
|
26
31
|
@current = item_page.search(CURRENT_PRICE_PATH).text
|
@@ -28,10 +33,19 @@ module Goodwill
|
|
28
33
|
@item = item_page.search(ITEM_TITLE_PATH).text
|
29
34
|
@seller = item_page.search(SELLER_PATH).text
|
30
35
|
@bidding = false
|
36
|
+
@shipping = calculate_shipping(@itemid, @zipcode, @state, @country)
|
31
37
|
end
|
32
38
|
|
33
39
|
def ==(another_auction)
|
34
40
|
self.itemid == another_auction.itemid
|
35
41
|
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def calculate_shipping(itemid, zipcode, state, country)
|
46
|
+
params = "?itemid=#{itemid}&zip=#{zipcode}&state=#{state}&country=#{country}"
|
47
|
+
page = mechanize.get(SHIPPING_URL + params)
|
48
|
+
page.search(SHIPPING_PATH).text
|
49
|
+
end
|
36
50
|
end
|
37
51
|
end
|
data/lib/goodwill/csspaths.rb
CHANGED
@@ -8,5 +8,6 @@ module Goodwill
|
|
8
8
|
ITEMID_PATH = 'body > span > div.itemdetail > div:nth-child(2) > div:nth-child(2) > div > table > tbody > tr:nth-child(3) > td'
|
9
9
|
ITEM_TITLE_PATH = '#title > span'
|
10
10
|
SELLER_PATH = 'body > span > div.itemdetail > div:nth-child(2) > div:nth-child(2) > div > table > tr:nth-child(7) > td > b'
|
11
|
+
SHIPPING_PATH = 'body > center > table > tr:nth-child(8) > td:nth-child(2)'
|
11
12
|
end
|
12
13
|
end
|
data/lib/goodwill/urlpaths.rb
CHANGED
@@ -4,5 +4,6 @@ module Goodwill
|
|
4
4
|
LOGIN_URL = 'https://www.shopgoodwill.com/buyers/'
|
5
5
|
OPEN_ORDERS_URL = 'https://www.shopgoodwill.com/buyers/myShop/AuctionsInProgress.asp'
|
6
6
|
SEARCH_URL = 'http://www.shopgoodwill.com/search/SearchKey.asp?catid=0&sellerID=all&closed=no&minPrice=&maxPrice=&sortBy=itemEndTime&SortOrder=a&showthumbs=on&itemTitle='
|
7
|
+
SHIPPING_URL = 'https://www.shopgoodwill.com/itemShipChargeAction.asp'
|
7
8
|
end
|
8
9
|
end
|
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
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Burnett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|