marinetraffic 0.0.2 → 0.0.3
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/.gitignore +1 -1
- data/README.md +1 -1
- data/Rakefile +7 -0
- data/lib/marinetraffic/version.rb +1 -1
- data/lib/marinetraffic/vessel.rb +25 -21
- data/marinetraffic.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fe1149c7a048e9444ed97031b183b34f8278c35
|
4
|
+
data.tar.gz: fdeefac94cf1ffbd6e60d0f144f2f838d0e3a98b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bc0fb29d3fb911bb583c332c9daed7fe656d0c4422046a30952a6e7909cd3fe4a9d174103eb294ffda35198ee5c6ce303a7607964917e39c0785e38ab71d45a
|
7
|
+
data.tar.gz: 07bf25076fa89f60e5220186c02a7fd1970a3c3487924793458272a459150ab298dbdeaa924a0614df7050fe288732e8939e78b45729efc7575151cfca1499bd
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -29,7 +29,7 @@ You authenticate to the MarineTraffic API by providing your secret API key in th
|
|
29
29
|
To use your API key, you need only set Marinetraffic.api_key equal to the key. The Ruby library will automatically send this key in each request.
|
30
30
|
|
31
31
|
```ruby
|
32
|
-
require "
|
32
|
+
require "marinetraffic"
|
33
33
|
Marinetraffic.api_key = "2571121d07b9ce09c1abc34db75606a840a2c68c"
|
34
34
|
```
|
35
35
|
|
data/Rakefile
CHANGED
data/lib/marinetraffic/vessel.rb
CHANGED
@@ -29,39 +29,43 @@ module Marinetraffic
|
|
29
29
|
@year_built = attributes["year_built"]
|
30
30
|
end
|
31
31
|
|
32
|
-
def self.find(mmsi, extended = false)
|
33
|
-
params = { mmsi: mmsi, timespan: 20 }
|
32
|
+
def self.find(mmsi, extended = false, options = {})
|
33
|
+
params = { mmsi: mmsi, timespan: 20 }.merge(options)
|
34
34
|
params[:msgtype] = :extended if extended
|
35
35
|
response = API.call(:exportvessel, params)
|
36
36
|
list = JSON.parse(response.body).first
|
37
|
-
attributes = map_attributes(list)
|
37
|
+
attributes = map_attributes(list, extended)
|
38
38
|
new(attributes)
|
39
39
|
end
|
40
40
|
|
41
|
-
def self.map_attributes(list)
|
41
|
+
def self.map_attributes(list, extended)
|
42
42
|
attributes = {}
|
43
43
|
attributes["mmsi"] = list.shift
|
44
44
|
attributes["lat"] = list.shift
|
45
45
|
attributes["lon"] = list.shift
|
46
46
|
attributes["speed"] = list.shift
|
47
47
|
attributes["course"] = list.shift
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
48
|
+
if extended
|
49
|
+
attributes["timestamp"] = list.shift
|
50
|
+
attributes["ship_name"] = list.shift
|
51
|
+
attributes["ship_type"] = list.shift
|
52
|
+
attributes["imo"] = list.shift
|
53
|
+
attributes["callsign"] = list.shift
|
54
|
+
attributes["flag"] = list.shift
|
55
|
+
attributes["current_port"] = list.shift
|
56
|
+
attributes["last_port"] = list.shift
|
57
|
+
attributes["last_port_time"] = list.shift
|
58
|
+
attributes["destination"] = list.shift
|
59
|
+
attributes["eta"] = list.shift
|
60
|
+
attributes["length"] = list.shift
|
61
|
+
attributes["draught"] = list.shift
|
62
|
+
attributes["grt"] = list.shift
|
63
|
+
attributes["dwt"] = list.shift
|
64
|
+
attributes["year_built"] = list.shift
|
65
|
+
else
|
66
|
+
attributes["status"] = list.shift
|
67
|
+
attributes["timestamp"] = list.shift
|
68
|
+
end
|
65
69
|
attributes
|
66
70
|
end
|
67
71
|
end
|
data/marinetraffic.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency "faraday"
|
23
23
|
spec.add_dependency "json"
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler", "
|
25
|
+
spec.add_development_dependency "bundler", ">= 1.7.9"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
27
|
spec.add_development_dependency "guard"
|
28
28
|
spec.add_development_dependency "guard-minitest", "~> 2.4.4"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marinetraffic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabio Kuhn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.7.9
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.7.9
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|