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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b51638e35e43cd30bfcd290095e94d2a6b0a9a77
4
- data.tar.gz: d0f055e818633850850acebdf5762a69cc78d9b8
3
+ metadata.gz: 62542695832e4f92ebb34831948747906f23a939
4
+ data.tar.gz: 80a55110450211b9c4e43fc36d984301ebbbf567
5
5
  SHA512:
6
- metadata.gz: 151184cbadf8a2e37e6e3db7955e87ce5681218d18ae7467d2427d37610a75bfdad1e1218f74e57312ff15c65e8d070492cc25d18544f26fa573b663031120f6
7
- data.tar.gz: 8d1b57050ae900ad0e11d8a5cf38d6fa7da8931ee031996c566012dda3307b8aeae9aa67b6190cbc4200db511428e3c0ecdbbbe72323bdf82a05146bc3832cf1
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 (not implemented yet)
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)
@@ -1,3 +1,3 @@
1
1
  module NyplSiteScraper
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-08 00:00:00.000000000 Z
11
+ date: 2017-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize