bikeshare 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/bikeshare.rb +13 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmFiYzY3M2QxMzk1NjRmNDNkODgyZTg4YTEyZDQxZjcwOWI0NTFmMA==
4
+ MjdlMGQxOWIxY2Y2ZWJmNGM2MTU1MjMyNGU4Mzk2NDhlZGVmYTAxNA==
5
5
  data.tar.gz: !binary |-
6
- OTAyN2M3YTRlNWVhZDdhNTE4ZWMyNzNhNTU0ZmNkNjJiNjZkODNhNw==
6
+ Nzc4MDUxNzA0ZjNhN2RmYmRiOTc0NTUzOTI5YmU5OTE0Y2MzZDVlOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTY5NzY1MGI4MTM0MjJlM2U2MGE4ZmU0Y2Y5NDg5MTQ4OTUwOGExMGQ2YTE5
10
- ZDU3Yzc5YTVhMTdjOTM3MWY1ZGE3YzMwOGUwZDBkN2ExNmYzYWE3MmE1ZDIz
11
- OTk5MTBjZjI3OTMxNThjOTdkYjgyNjAwZjFkYjFlNjBjOGJlMDQ=
9
+ ZjdjNjI1YzFjYzIwMmM4ZjM3NWIyNDk1ZWM1MWQ2MzlhY2ExYzdhMWJkZWQ4
10
+ NjkzZWY1NTg5ZTU2YjEyMDk0ZTA5MTc3YTBmYzQ0NzdiMDcyY2VjYWIwODAx
11
+ ZTBlYWJjMjZkMGZiNmZjMWE1MDZmOTUwZTliYTcyZWRmYzU1NDc=
12
12
  data.tar.gz: !binary |-
13
- OGY1YWNhODE1MTQ4ZjJiODI2YzI5MDI3MzljYjVkMzgzZGQyNTgwYTBlODdj
14
- MmU0NGMzYjZmMjNhNzUyNDFhZjQ4MDczMjI1YWU2N2QyMzk4MzUzZWJlNGJh
15
- NWQ3MzU0NjJhMGQzOGIxNDA0MTNhMDc0NWExZWI1NGVmMTA3NTg=
13
+ YjEzZmE4ODI4YmNlYThiMzMxZGQ4MDg5YmZmM2I4ZGNkYjEwNmRjYzE2ZWZm
14
+ YTY1OTI0MWQ3YzAzMmY2YTYzZWRjY2QxZTYxZTk2YTk3YjA2YWZkNDRhMWU5
15
+ NTJkMzljNTI2MDljZjA0MWFjYzU2MWExYmVkN2VmMDgxN2FmNGY=
data/lib/bikeshare.rb CHANGED
@@ -10,17 +10,15 @@ class BikeShare
10
10
  end
11
11
 
12
12
  def between?(min, max)
13
- if (min >= 2 && max <= get_last_station)
14
- return true
15
- else
16
- raise "Please enter a station id in between 2 and #{last_station}"
17
- end
13
+ (min >= 2 && max <= get_last_station) ? true : false
18
14
  end
19
15
 
20
16
  def station_info(station_id)
21
17
  if station_id.between?(2, get_last_station)
22
18
  station = @response.select { |station| station["id"] == station_id }
23
19
  station.first
20
+ else
21
+ raise "Please enter a station id in between 2 and #{last_station}"
24
22
  end
25
23
  end
26
24
 
@@ -43,6 +41,8 @@ class BikeShare
43
41
  station = @response.select { |station| station["id"] == station_id }
44
42
 
45
43
  station.first["availableBikes"] == 0 ? true : false
44
+ else
45
+ raise "Please enter a station id in between 2 and #{last_station}"
46
46
  end
47
47
  end
48
48
 
@@ -51,6 +51,8 @@ class BikeShare
51
51
  station = @response.select { |station| station["id"] == station_id }
52
52
 
53
53
  station.first["availableBikes"] == station.first["totalDocks"] ? true : false
54
+ else
55
+ raise "Please enter a station id in between 2 and #{last_station}"
54
56
  end
55
57
  end
56
58
 
@@ -59,14 +61,17 @@ class BikeShare
59
61
  station = @response.select { |station| station["id"] == station_id }
60
62
 
61
63
  station.first["availableBikes"]
64
+ else
65
+ raise "Please enter a station id in between 2 and #{last_station}"
62
66
  end
63
67
  end
64
68
 
65
69
  def total_docks(station_id)
66
70
  if station_id.between?(2, get_last_station)
67
71
  station = @response.select { |station| station["id"] == station_id }
68
-
69
72
  station.first["totalDocks"]
73
+ else
74
+ raise "Please enter a station id in between 2 and #{last_station}"
70
75
  end
71
76
  end
72
77
 
@@ -79,6 +84,8 @@ class BikeShare
79
84
 
80
85
  percentage = (available * 100.0) / total
81
86
  percentage.round(2)
87
+ else
88
+ raise "Please enter a station id in between 2 and #{last_station}"
82
89
  end
83
90
  end
84
91
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bikeshare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zack Shapiro
@@ -10,7 +10,7 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2013-09-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Ditto
13
+ description: A Ruby wrapper for Bay Area Bike Share station information
14
14
  email: zack@zackshapiro.com
15
15
  executables: []
16
16
  extensions: []