sipp 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sipp/code.rb +46 -23
  3. data/lib/sipp/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '086bb9e51ee12559956fba75a010b63e1e8a0f8f'
4
- data.tar.gz: 2f7d6032d53679caf7d565ec8cea564c1397026b
3
+ metadata.gz: a759acbd50e83cfbc4294f476ca21048c42286fb
4
+ data.tar.gz: 91df79cf3188f78777c1495002445c540e60d031
5
5
  SHA512:
6
- metadata.gz: 004c5f4a0d1027c9327f76bf99ed7fd0609bdfe510b0e0f72b644bf1669fd4b1a3b5411e2129ea0b90f441ba53c3d6938b80746ecab108b26fe2aa567df3cedd
7
- data.tar.gz: 8e50c19a31002240c004dc11b702f81f1742e40755874f99017b2034ffe61df2db32b9582d1dceaed628223b42e8d2458f06affbfd17784865c81e42dbaa13bc
6
+ metadata.gz: e699be1f95b5075a45b4b8b54fc1e1ea1c418c32e88e1a202e9659d4e5e1ec4dfa3bfd00ef803ff79555d858cb1acd831e767249381cae6a3dda4748905e3465
7
+ data.tar.gz: fbe654d6c318cbc133c7a43d60614a800135d093b62a3524eeaa26747f60e33183e108475925961e5048b8e754683f35a2a8560b38e50a2ec50c26217a0f863f
data/lib/sipp/code.rb CHANGED
@@ -26,57 +26,80 @@ module SIPP
26
26
  end
27
27
 
28
28
  def category
29
- CATEGORY[code[0]] if valid?
29
+ validate_category
30
+ CATEGORY[code[0]]
31
+ rescue CategoryError => e
32
+ nil
30
33
  end
31
34
 
32
35
  def type
33
- TYPE[code[1]] if valid?
36
+ validate_type
37
+ TYPE[code[1]]
38
+ rescue TypeError => e
39
+ nil
34
40
  end
35
41
 
36
42
  def transmission_drive
37
- TRANSMISSION_DRIVE[code[2]] if valid?
43
+ validate_transmission_drive
44
+ TRANSMISSION_DRIVE[code[2]]
45
+ rescue TransmissionDriveError => e
46
+ nil
38
47
  end
39
48
 
40
49
  def transmission
41
- TRANSMISSION[code[2]] if valid?
50
+ validate_transmission_drive
51
+ TRANSMISSION[code[2]]
52
+ rescue TransmissionDriveError => e
53
+ nil
42
54
  end
43
55
 
44
56
  def transmission_manual?
45
- if valid?
46
- 'Manual' == transmission ? true : false # TODO fix magic string
47
- else
48
- nil
49
- end
57
+ validate_transmission_drive
58
+ 'Manual' == transmission ? true : false # TODO fix magic string
59
+ rescue TransmissionDriveError => e
60
+ nil
50
61
  end
62
+
51
63
  def transmission_auto?
52
- if valid?
53
- 'Auto' == transmission ? true : false # TODO fix magic string
54
- else
55
- nil
56
- end
64
+ validate_transmission_drive
65
+ 'Auto' == transmission ? true : false # TODO fix magic string
66
+ rescue TransmissionDriveError => e
67
+ nil
57
68
  end
69
+
58
70
  def drive
59
- DRIVE[code[2]] if valid?
71
+ validate_transmission_drive
72
+ DRIVE[code[2]]
73
+ rescue TransmissionDriveError => e
74
+ nil
60
75
  end
61
76
 
62
77
  def fuel_ac
63
- FUEL_AC[code[3]] if valid?
78
+ validate_fuel_ac
79
+ FUEL_AC[code[3]]
80
+ rescue FuelACError => e
81
+ nil
64
82
  end
65
83
 
66
84
  def fuel
67
- FUEL[code[3]] if valid?
85
+ validate_fuel_ac
86
+ FUEL[code[3]]
87
+ rescue FuelACError => e
88
+ nil
68
89
  end
69
90
 
70
91
  def ac
71
- AC[code[3]] if valid?
92
+ validate_fuel_ac
93
+ AC[code[3]]
94
+ rescue FuelACError => e
95
+ nil
72
96
  end
73
97
 
74
98
  def ac?
75
- if valid?
76
- 'Air' == ac ? true : false # TODO fix magic string
77
- else
78
- nil
79
- end
99
+ validate_fuel_ac
100
+ 'Air' == ac ? true : false # TODO fix magic string
101
+ rescue FuelACError => e
102
+ nil
80
103
  end
81
104
 
82
105
  def to_s
data/lib/sipp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SIPP
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sipp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Buslaev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-31 00:00:00.000000000 Z
11
+ date: 2022-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler