pla 0.3.0 → 0.4.0

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: a6ff26195cda03de8489dfa3bed93742008759fc
4
- data.tar.gz: ce5325c8586cc7bcd5724f35680fae04eaa8d4e2
3
+ metadata.gz: 9b563329bb284dc1d88d82963b5ee5312208daa4
4
+ data.tar.gz: d743f239e67902f784d91b5f051fed534b47531a
5
5
  SHA512:
6
- metadata.gz: aee1d6bc76d3715cdff4dd8e45f815b82ec2ba3f0e5fd3a179979bd42c101752dffd2f39590b29797b78f2c8225caa3e4dc55c52022815410e828ba5a612a36d
7
- data.tar.gz: 9d908c1af6c73deff77aca7ac8c02db2e56ac136bdac3804c3dd717cc037bc4023c847383007a578bb37c6995ebaeafcde7d23bae9147b1203328b44e5f9f324
6
+ metadata.gz: 784ad73ef881942547a48d4ef0400149be5b39ad9f9f893744fde462d6eb856cbf8e60a3eece3329572f8ddd221d7f9dceb6b995eed6e21762b04d3feb3e0f79
7
+ data.tar.gz: 255e5bd0b487f5a9916cd4758fd540d9d8a59cd5baeec7c36d9e8c2089664c136a1009c83e61cec80f9369e7428c4936521f86477079c9d24cd95aff45d5785f
data/README.md CHANGED
@@ -25,14 +25,12 @@ require 'pla'
25
25
 
26
26
  arrivals = PLA.arrivals
27
27
  departures = PLA.departures
28
-
29
- # Note: all is an amalgam of arrivals and departures.
30
- # the 'movements' on the PLA website is incomplete; it just
31
- # shows movements within the port
28
+ in_port = PLA.in-port
32
29
  all = PLA.all
33
30
 
34
31
  puts arrivals
35
32
  puts departures
33
+ puts in_port
36
34
  puts all
37
35
 
38
36
  # Find next ten boats set to arrive
@@ -46,6 +44,9 @@ puts PLA.find_all_by_country 'Panama'
46
44
 
47
45
  # Find all movements by a particular vessel
48
46
  puts PLA.find_all_by_vessel_name 'feo swan'
47
+
48
+ # Listing the movements of a vessel by time
49
+ puts PLA.find_all_by_vessel_name('balmoral').sort_by{|s| s[:timestamp]}
49
50
  ```
50
51
 
51
52
  Licence
data/lib/pla.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'pla/arrivals'
2
2
  require 'pla/departures'
3
+ require 'pla/in_port'
3
4
 
4
5
  class PLA
5
6
  def self.arrivals
@@ -10,9 +11,16 @@ class PLA
10
11
  PLA::Departures.new.records
11
12
  end
12
13
 
14
+ def self.in_port
15
+ PLA::InPort.new.records
16
+ end
17
+
13
18
  def self.all
14
- [PLA::Arrivals.new.records,
15
- PLA::Departures.new.records].flatten.uniq
19
+ [
20
+ self.arrivals,
21
+ self.departures,
22
+ self.in_port
23
+ ].flatten.uniq
16
24
  end
17
25
 
18
26
  def self.find movement_type, field, key
@@ -0,0 +1,7 @@
1
+ require 'pla/movements'
2
+
3
+ class PLA
4
+ class InPort < Movements
5
+ set_url 'https://www.pla.co.uk/Port-Trade/Ship-movements/Ship-movements?flag=7'
6
+ end
7
+ end
@@ -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.3.0'
7
+ spec.version = '0.4.0'
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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jspc
@@ -99,6 +99,7 @@ files:
99
99
  - lib/pla.rb
100
100
  - lib/pla/arrivals.rb
101
101
  - lib/pla/departures.rb
102
+ - lib/pla/in_port.rb
102
103
  - lib/pla/movement.rb
103
104
  - lib/pla/movements.rb
104
105
  - lib/pla/vessel.rb