vehicle_coding_ph 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -9
- data/lib/vehicle_coding_ph/checker.rb +6 -5
- data/lib/vehicle_coding_ph/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c5c4f4e63a646bcb16fe9a50366e1438e8465939b815a376192c857fdc0aac31
|
|
4
|
+
data.tar.gz: 6f71b895af80dde97f34114daaa78d1cd529f6fb8a94f4429225b83c115d84a9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1cf62292fc9e3bc19b52236f14355637d1a7be5cde2d131162e7d2959d8881b8bbecd9555c6e093e0227a94ec3d708e4558b135a8ddc3370eda0bdd0bb4a7057
|
|
7
|
+
data.tar.gz: 573fbfe693699c44ba9d4e8ecd038e205c33d21dc215aae6d6f574661e89329eca94e57ea64f390f38f45120b5efb89abc6f33fca7c0108c541ec1d62327cf70
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -8,8 +8,6 @@ Helps you figure out if your car is legally okay to drive on a given date in the
|
|
|
8
8
|
|
|
9
9
|
- [x] Response object
|
|
10
10
|
- [x] Consider window hours
|
|
11
|
-
- [ ] Helpful return messages for the Gem users e.g. "areas you're allowed or
|
|
12
|
-
not allowed to go to" because areas have particular coding scheme applied
|
|
13
11
|
|
|
14
12
|
## Installation
|
|
15
13
|
|
|
@@ -30,16 +28,11 @@ Or install it yourself as:
|
|
|
30
28
|
## Usage
|
|
31
29
|
|
|
32
30
|
```ruby
|
|
33
|
-
|
|
31
|
+
# returns a `VehicleCodingPh::Response` object
|
|
32
|
+
VehicleCodingPh::Checker.(
|
|
34
33
|
plate_number_of_your_vehicle,
|
|
35
34
|
datetime # if not passed, defaults to datetime today
|
|
36
35
|
)
|
|
37
|
-
|
|
38
|
-
# result is a hash that has the ff. data structure
|
|
39
|
-
{
|
|
40
|
-
coding: boolean,
|
|
41
|
-
allowed_areas: [] # array of areas in Metro Manila
|
|
42
|
-
}
|
|
43
36
|
```
|
|
44
37
|
|
|
45
38
|
## Development
|
|
@@ -7,16 +7,17 @@ module VehicleCodingPh
|
|
|
7
7
|
|
|
8
8
|
hour_of_the_day = datetime.hour
|
|
9
9
|
|
|
10
|
-
allowed_areas = VehicleCodingPh::AREA_TO_HOUR_MAPPING.reduce([]) do |
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
allowed_areas = VehicleCodingPh::AREA_TO_HOUR_MAPPING.reduce([]) do |areas, mapping|
|
|
11
|
+
areas ||= []
|
|
12
|
+
|
|
13
|
+
name_of_area = mapping[0]
|
|
13
14
|
coding_hours = mapping[1]
|
|
14
15
|
|
|
15
16
|
if coding_hours.empty? || !coding_hours.include?(hour_of_the_day)
|
|
16
|
-
|
|
17
|
+
areas << name_of_area
|
|
17
18
|
end
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
areas
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
Response.new(true, allowed_areas)
|