marinetraffic 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0009285cd9ec60abb0264806ae7e1efdd054828
4
- data.tar.gz: d9a588dba5761380f20b6e3c59d09d926c992cf1
3
+ metadata.gz: 7fe1149c7a048e9444ed97031b183b34f8278c35
4
+ data.tar.gz: fdeefac94cf1ffbd6e60d0f144f2f838d0e3a98b
5
5
  SHA512:
6
- metadata.gz: 6aa89875c1c71a660b66b97b39e438b24fd77d0e081469861574e7f6c0a8c6b8508be6bd5ac90d9ac629de80ad0860f37784993341c16a3b664ca4a6209572e3
7
- data.tar.gz: 729f6793faab79abe5e610748e2f23427290da7d5b47b6582e6997ac156e78d5311c892818312d9c9ed5220a0141ba2a20f4dd70dce6f352bafae4d27c053b4b
6
+ metadata.gz: 0bc0fb29d3fb911bb583c332c9daed7fe656d0c4422046a30952a6e7909cd3fe4a9d174103eb294ffda35198ee5c6ce303a7607964917e39c0785e38ab71d45a
7
+ data.tar.gz: 07bf25076fa89f60e5220186c02a7fd1970a3c3487924793458272a459150ab298dbdeaa924a0614df7050fe288732e8939e78b45729efc7575151cfca1499bd
data/.gitignore CHANGED
@@ -7,4 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
- /**/env.yml/
10
+ **/env.yml
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 "stripe"
32
+ require "marinetraffic"
33
33
  Marinetraffic.api_key = "2571121d07b9ce09c1abc34db75606a840a2c68c"
34
34
  ```
35
35
 
data/Rakefile CHANGED
@@ -1 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ task :default => [:test]
5
+
6
+ Rake::TestTask.new do |t|
7
+ t.pattern = './test/**/test_*.rb'
8
+ end
@@ -1,3 +1,3 @@
1
1
  module Marinetraffic
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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
- attributes["status"] = list.shift
49
- attributes["timestamp"] = list.shift
50
- attributes["ship_type"] = list.shift
51
- attributes["ship_name"] = 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
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
@@ -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", "~> 1.9"
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.2
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-19 00:00:00.000000000 Z
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: '1.9'
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: '1.9'
54
+ version: 1.7.9
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement