nypl-site-scraper 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/nypl_site_scraper/scraper.rb +17 -0
- data/lib/nypl_site_scraper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62542695832e4f92ebb34831948747906f23a939
|
4
|
+
data.tar.gz: 80a55110450211b9c4e43fc36d984301ebbbf567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78f405985ae1188622647f8c0559e7c0b5a088a030554c9e6599dcf053fc298cbf537a67790280cee7709702ef0266e8bb269d668eede2c6ec6afa0ce5c76cfc
|
7
|
+
data.tar.gz: 1c1e3ac070c3514bd6991d28bf594f8b5650a4658d64318fd7235b048d5612e4a67d597a4870f8522c065c0387661b847a30f4de812a96cc1ad57a1b73c8b867
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ using mechanize directly.
|
|
10
10
|
Examples of what it can get are your:
|
11
11
|
|
12
12
|
* Current Holds
|
13
|
-
* Fines
|
13
|
+
* Fines
|
14
14
|
* Current Checkouts (not implemented yet)
|
15
15
|
|
16
16
|
## Installation
|
@@ -38,6 +38,9 @@ client.login! # This is the network call
|
|
38
38
|
|
39
39
|
client.get_holds
|
40
40
|
# {"holds"=>[{"title"=>"Persepolis. English", "statusString"=>"READY FOR PICKUP", "status"=>"ready", "pickupLocation"=>"Mid-Manhattan Library at 42nd St"}...
|
41
|
+
|
42
|
+
client.get_fines
|
43
|
+
#{:fines=>[{:title=>"Zog and the flying doctors / by Julia Donaldson & illustrated by Axel Scheffler.", :fineAmount=>"$0.20"}...
|
41
44
|
```
|
42
45
|
|
43
46
|
## Development
|
@@ -20,6 +20,21 @@ module NyplSiteScraper
|
|
20
20
|
true
|
21
21
|
end
|
22
22
|
|
23
|
+
def get_fines
|
24
|
+
@fines_page ||= @agent.get("https://catalog.nypl.org/patroninfo~S1/thisurlsegment-doesnt-seem-to-matter-hahahah/overdues")
|
25
|
+
fines_rows = @fines_page.search('tr.patFuncFinesEntryTitle')
|
26
|
+
|
27
|
+
fines_response = []
|
28
|
+
fines_rows.each_with_index do |overdue_row, index|
|
29
|
+
fines_response << {
|
30
|
+
title: overdue_row.text.strip,
|
31
|
+
fineAmount: @fines_page.search('td.patFuncFinesDetailAmt')[index].text.strip
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
{fines: fines_response}
|
36
|
+
end
|
37
|
+
|
23
38
|
def get_holds
|
24
39
|
@holds_page ||= @homepage.link_with(text: "My Holds").click
|
25
40
|
holds_rows = @holds_page.css('tr.patFuncEntry')
|
@@ -35,8 +50,10 @@ module NyplSiteScraper
|
|
35
50
|
pickupLocation: get_pickup_location(hold_row),
|
36
51
|
}
|
37
52
|
end
|
53
|
+
|
38
54
|
{holds: response_holds}
|
39
55
|
end
|
56
|
+
|
40
57
|
private
|
41
58
|
|
42
59
|
def map_status_string(status_string)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nypl-site-scraper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nodanaonlyzuul
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|