patience_and_fortitude 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: d8c9c84288da4dc9b61e2cb6d36eb58c0e3298ab
4
- data.tar.gz: a687ca49dc4407be67eab912930ae4f3698613dc
3
+ metadata.gz: ebd5173e21011f309f40e36233e925de588c92b5
4
+ data.tar.gz: e1bbd8eca6e8cce9ca423bc3ee47f668d8b42e0e
5
5
  SHA512:
6
- metadata.gz: 81c033b1d3e8103f94cfaccd820af32be554475eab1da5a4de6399d8a7ccefe320e0aaf58ffbd9879d8677f0a88d47c06fa879b7c5ad142e4ecb6de6402f574d
7
- data.tar.gz: f072d572af994d7bee9d7b6831efe2a5dc8f09cf53a5af4d57b58b7b09120a9dcacc1c181722061b6b3e2ea07aae0e299f1d649722557a7f6976f653b668d3b6
6
+ metadata.gz: 570863a8c6ba171c90815edf898a7c92d9b1a7b306a3962be0f75b6bdd50e0ecc508556cfbd533666756d20485235cc3ce72760dfb2933c4998c886ab274b4d3
7
+ data.tar.gz: 64b655c025f98dc6e3dc975d0ca6cacef37a26dbd4b2dd7685698fec22f383ba25530df20b2f0d4e75222c7d25b945146eacd5b6578da577060f0fa3d9e8a806
data/exe/nypl-cli CHANGED
@@ -39,11 +39,17 @@ def fetch_fines
39
39
  main_menu
40
40
  end
41
41
 
42
+ def fetch_checkouts
43
+ puts "\n#{PatienceAndFortitude::ResponseFormatter.checkout_response_to_sentence(@client.get_checkouts)}\n\n"
44
+ main_menu
45
+ end
46
+
42
47
  def main_menu
43
48
  @highline.choose do |menu|
44
49
  menu.prompt = "What would you like to do?"
45
50
  menu.choice("See My Holds") { fetch_holds }
46
51
  menu.choice("See My Fines") { fetch_fines }
52
+ menu.choice("See My Current Checkouts") { fetch_checkouts }
47
53
  menu.choice("Exit") { leave_app }
48
54
  end
49
55
  end
@@ -3,6 +3,25 @@ module PatienceAndFortitude
3
3
  require 'rainbow'
4
4
  require 'formatador'
5
5
 
6
+ def self.checkout_response_to_sentence(checkouts_response)
7
+ checkouts_array = checkouts_response[:checkouts]
8
+
9
+ table_data = []
10
+ checkouts_array.each do |checkout|
11
+ table_row = {
12
+ TITLE: checkout[:title],
13
+ DUE: checkout[:dueDate].gsub('DUE ', '')
14
+ }
15
+ table_data << table_row
16
+ end
17
+
18
+ if table_data.empty?
19
+ "You have nothing checked out. You should fix that.\nGo to https://nypl.org and take advantage of the world's greatest library."
20
+ else
21
+ Formatador.display_compact_table(table_data, [:TITLE, :DUE])
22
+ end
23
+ end
24
+
6
25
  def self.holds_response_to_sentence(holds_response)
7
26
  holds_array = holds_response[:holds]
8
27
 
@@ -1,3 +1,3 @@
1
1
  module PatienceAndFortitude
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.add_dependency 'highline', '~> 1.7'
33
33
  spec.add_dependency 'whirly', '~> 0.2.6'
34
- spec.add_dependency 'nypl-site-scraper', '0.1.1'
34
+ spec.add_dependency 'nypl-site-scraper', '0.1.2'
35
35
  spec.add_dependency 'rainbow', '~> 3.0'
36
36
  spec.add_dependency 'paint', '~> 2.0'
37
37
  spec.add_dependency 'formatador', '~> 0.2.5'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patience_and_fortitude
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-09 00:00:00.000000000 Z
11
+ date: 2017-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.1
47
+ version: 0.1.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.1
54
+ version: 0.1.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rainbow
57
57
  requirement: !ruby/object:Gem::Requirement