marinetraffic 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 963b7256b9a67232841c756caff1c328b95f6bc6
4
- data.tar.gz: d293a6882f22a6ea43a6e674f70d2d6995779944
3
+ metadata.gz: 0f01e7fa9707d497da72d9ef6e12eb34d535fba5
4
+ data.tar.gz: 6b0c19cc2e002b3df7d665490807ab82b63eb158
5
5
  SHA512:
6
- metadata.gz: 1f896e46875f2b57af4fbb4c28fe4db5c898608294a1d3c92540efd2ae036fae80063a859653826fccd701574eddab9e95bfb03b1072d9e57129e074c59c5f19
7
- data.tar.gz: 9ae87d9b8c14b520cc161a3ba2f9a801d16d969dae9b9f358128da12b6585781d51e95ff7adb1f19a489652e45284b7cabf90e7cb2bfbd445b903bb1f6ade7f1
6
+ metadata.gz: 14fd7b860b44c1e8d3c50e19623e256be04c567577f8e6ec592ece9d2053c61a97f2f3256aed42a73f438fc9c2344f533ec11afe15ca5aa32c19331599589089
7
+ data.tar.gz: 745922760aec1ac8e7bbd79045125dbd031294e657a66aa9a85172182060b2ad074f6a5fc8ef7c14c5a20bbc57de78564be33d25ab86a748911b90a66817f4a9
@@ -1,3 +1,3 @@
1
1
  module Marinetraffic
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -34,8 +34,12 @@ module Marinetraffic
34
34
  params = { mmsi: mmsi, timespan: 20 }.merge(options)
35
35
  params[:msgtype] = :extended if extended
36
36
  response = API.call(:exportvessel, params)
37
- attributes = map_attributes(response.xpath("//row")[0], extended)
38
- new(attributes)
37
+ result = response.xpath("//row")[0]
38
+
39
+ if result != nil
40
+ attributes = map_attributes(response.xpath("//row")[0], extended)
41
+ new(attributes)
42
+ end
39
43
  end
40
44
 
41
45
  def self.map_attributes(response, extended)
@@ -105,32 +109,32 @@ module Marinetraffic
105
109
  'AIS-SART (active), MOB-AIS, EPIRB-AIS'
106
110
  when 15
107
111
  'undefined = default (also used by AIS-SART, MOB-AIS and EPIRB-AIS under test)'
108
- end
112
+ end
109
113
  end
110
114
 
111
115
  # http://help.marinetraffic.com/hc/en-us/articles/205579997-What-is-the-significance-of-the-AIS-SHIPTYPE-number-
112
116
  def ship_type_human
113
117
  return if ship_type == nil
114
118
  case ship_type / 10
115
- when 1
116
- 'Reserved'
117
- when 2
118
- 'Wing In Ground'
119
- when 3
120
- 'Special Category'
121
- when 4
122
- 'High-Speed Craft'
123
- when 5
124
- 'Special Category'
125
- when 6
126
- 'Passenger'
127
- when 7
128
- 'Cargo'
129
- when 8
130
- 'Tanker'
131
- when 9
132
- 'Other'
133
- end
119
+ when 1
120
+ 'Reserved'
121
+ when 2
122
+ 'Wing In Ground'
123
+ when 3
124
+ 'Special Category'
125
+ when 4
126
+ 'High-Speed Craft'
127
+ when 5
128
+ 'Special Category'
129
+ when 6
130
+ 'Passenger'
131
+ when 7
132
+ 'Cargo'
133
+ when 8
134
+ 'Tanker'
135
+ when 9
136
+ 'Other'
134
137
  end
138
+ end
135
139
  end
136
140
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marinetraffic
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
  - Fabio Kuhn