vehicle_coding_ph 1.1.1 → 1.2.0
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 +7 -7
- data/lib/vehicle_coding_ph/checker.rb +11 -14
- data/lib/vehicle_coding_ph/response.rb +4 -3
- data/lib/vehicle_coding_ph/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfabb96edaefb820f72fb034babb4580eceb44c4b385a68d63299bc1beedcdf9
|
4
|
+
data.tar.gz: d28debcd5713a9cfdbbcb335fb306ccae601ba364fd142003f30424d5539a1d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3fd45fbb2083812c8fc3c987c7063d39576ef853dce6603c66e1803ceb7c2d65303f29704ac84f881d065d3e2ccad629dd680b54dcc2eb197cde6e68dff5b21
|
7
|
+
data.tar.gz: 380a4bd8ee6c04567112af7db46164a0eba4d4a1cb988f0986f1044d12c08b51290822a260a8330097fb998a502a7efa9098591eb67af7c73f52f2990b6224af
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,11 +4,6 @@
|
|
4
4
|
|
5
5
|
Helps you figure out if your car is legally okay to drive on a given date in the Philippines.
|
6
6
|
|
7
|
-
## Version 1.0 roadmap
|
8
|
-
|
9
|
-
- [x] Response object
|
10
|
-
- [x] Consider window hours
|
11
|
-
|
12
7
|
## Installation
|
13
8
|
|
14
9
|
Add this line to your application's Gemfile:
|
@@ -33,6 +28,11 @@ VehicleCodingPh::Checker.(
|
|
33
28
|
plate_number_of_your_vehicle,
|
34
29
|
datetime # if not passed, defaults to datetime today
|
35
30
|
)
|
31
|
+
|
32
|
+
# VehicleCodingPh::Response object returns:
|
33
|
+
- coding: boolean
|
34
|
+
- allowed: array of areas allowed to go
|
35
|
+
- not_allowed: array of areas not allowed to go
|
36
36
|
```
|
37
37
|
|
38
38
|
## Development
|
@@ -43,7 +43,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
43
43
|
|
44
44
|
## Contributing
|
45
45
|
|
46
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
46
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/MarkFChavez/vehicle_coding_ph. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
47
47
|
|
48
48
|
## License
|
49
49
|
|
@@ -51,4 +51,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
51
51
|
|
52
52
|
## Code of Conduct
|
53
53
|
|
54
|
-
Everyone interacting in the CodingPh project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
54
|
+
Everyone interacting in the CodingPh project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/MarkFChavez/vehicle_coding_ph/blob/master/CODE_OF_CONDUCT.md).
|
@@ -5,22 +5,19 @@ module VehicleCodingPh
|
|
5
5
|
return allowed_anywhere if weekend?(datetime)
|
6
6
|
return allowed_anywhere if not coding?(plate_no, datetime)
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
areas << name_of_area
|
8
|
+
allowed_areas = []
|
9
|
+
not_allowed_areas = []
|
10
|
+
hour_of_the_day = datetime.hour
|
11
|
+
|
12
|
+
VehicleCodingPh::AREA_TO_HOUR_MAPPING.each do |area, hours|
|
13
|
+
if hours.empty? || !hours.include?(hour_of_the_day)
|
14
|
+
allowed_areas << area
|
15
|
+
else
|
16
|
+
not_allowed_areas << area
|
18
17
|
end
|
19
|
-
|
20
|
-
areas
|
21
18
|
end
|
22
19
|
|
23
|
-
Response.new(true, allowed_areas)
|
20
|
+
Response.new(true, allowed_areas, not_allowed_areas)
|
24
21
|
end
|
25
22
|
|
26
23
|
def self.weekend?(datetime)
|
@@ -40,7 +37,7 @@ module VehicleCodingPh
|
|
40
37
|
private_class_method :coding?
|
41
38
|
|
42
39
|
def self.allowed_anywhere
|
43
|
-
Response.new(false, [:anywhere])
|
40
|
+
Response.new(false, [:anywhere], [])
|
44
41
|
end
|
45
42
|
private_class_method :allowed_anywhere
|
46
43
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module VehicleCodingPh
|
2
2
|
class Response
|
3
3
|
|
4
|
-
attr_reader :coding, :
|
4
|
+
attr_reader :coding, :allowed, :not_allowed
|
5
5
|
|
6
|
-
def initialize(coding,
|
6
|
+
def initialize(coding, allowed, not_allowed)
|
7
7
|
@coding = coding
|
8
|
-
@
|
8
|
+
@allowed = allowed
|
9
|
+
@not_allowed = not_allowed
|
9
10
|
end
|
10
11
|
|
11
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vehicle_coding_ph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Chavez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|