pla 0.1.0 → 0.1.1

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: 3629b76b8d19bb0c152b3f9b9d3989fd00704137
4
- data.tar.gz: 06f52a128ea81c4081ede4de27cfaea19ea78d0a
3
+ metadata.gz: 273a1bcd783512a908076b9d4bd1bda7547dd3c5
4
+ data.tar.gz: b48cfa6a31e46cbbaf9e8fdc4164d4f9598fea54
5
5
  SHA512:
6
- metadata.gz: 5ca799e12bd9bc71863da627edd45b81add14739f925aff6b6fc40da8dd2bf0f6eb37a0cea8e9fbe0e7933aa38b2014fd3323c7f95fab77ac00836ef5050e788
7
- data.tar.gz: 32004155e0342b737968776277565b8949920887045955d24d06325c80e26f7765d46078441853ad2f4fb0b076fa34036d7b4aaae8c4ce2f420f59a234cf6e6c
6
+ metadata.gz: 02d74b7a88c34231e7503976af12ca9320c0476e0bb5f250455e5144092623157775a8972a5929ba76114f63745515050965c10cba7e3bb7f8a3a84781959ca4
7
+ data.tar.gz: bf9e30967ddbf7d42085d30bcc5c039096b96739ae4c3df87910f264fdb32721873f6b29fbdd14aff3d9c01de786f73ba8567fd98f81942ef37df95455ebd903
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ [![Gem Version](https://badge.fury.io/rb/pla.svg)](https://badge.fury.io/rb/pla)
2
+ [![Build Status](https://travis-ci.org/jspc/pla.svg?branch=master)](https://travis-ci.org/jspc/pla)
3
+
1
4
  PLA
2
5
  ==
3
6
 
@@ -25,6 +28,13 @@ departures = PLA.departures
25
28
 
26
29
  puts arrivals
27
30
  puts departures
31
+
32
+ # Find next ten boats set to arrive
33
+ puts PLA.arrivals.sort_by{|a| a[:timestamp]}[0..9]
34
+
35
+ # Find all boats from Panama
36
+ puts PLA.arrivals.select{|b| b[:country] == 'Panama'}
37
+
28
38
  ```
29
39
 
30
40
  Licence
@@ -36,12 +36,12 @@ class PLA
36
36
  date = gen_date year+1, month, day, hour, minute
37
37
  end
38
38
 
39
- @record['timestamp'] = date.to_s
39
+ @record[:timestamp] = date
40
40
  end
41
41
 
42
42
  def normalise_ship!
43
43
  name = @record.delete(:'vessel name')
44
- @record['vessel'] = PLA::Ship.new(name).to_h
44
+ @record[:vessel] = PLA::Ship.new(name).to_h
45
45
  end
46
46
 
47
47
  def normalise_country!
@@ -49,6 +49,7 @@ class PLA
49
49
  begin
50
50
  country = IsoCountryCodes.find(country_code).name
51
51
  rescue IsoCountryCodes::UnknownCodeError
52
+ STDERR.puts "WARNING: Invalid country code #{country_code.upcase}"
52
53
  country = country_code
53
54
  end
54
55
 
@@ -34,7 +34,7 @@ class PLA
34
34
 
35
35
  def set_headers
36
36
  @headers = normalize_and_map(@ships.first.css('th'))
37
- @headers[-1] = 'Notes' # pla returns this as empty. We infer it means notes, though usually it says 'Pilot required'
37
+ @headers[-1] = 'notes' # pla returns this as empty. We infer it means notes, though usually it says 'Pilot required'
38
38
  end
39
39
 
40
40
  def set_records
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "pla"
7
- spec.version = '0.1.0'
7
+ spec.version = '0.1.1'
8
8
  spec.authors = ["jspc"]
9
9
  spec.email = ["james@zero-internet.org.uk"]
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jspc