Class: SeametrixRuby::Models::Port
- Inherits:
-
Object
- Object
- SeametrixRuby::Models::Port
- Defined in:
- lib/seametrix_ruby/models/port.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
Returns the value of attribute country.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#port_code ⇒ Object
Returns the value of attribute port_code.
-
#port_name ⇒ Object
Returns the value of attribute port_name.
-
#waypoint ⇒ Object
readonly
Returns the value of attribute waypoint.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Port
constructor
A new instance of Port.
Constructor Details
#initialize(attributes = {}) ⇒ Port
Returns a new instance of Port.
11 12 13 14 15 16 17 18 |
# File 'lib/seametrix_ruby/models/port.rb', line 11 def initialize(attributes = {}) @port_name = attributes[:port_name] @port_code = attributes[:port_code] @country = attributes[:country] self.longitude = attributes[:longitude].to_f self.latitude = attributes[:latitude].to_f end |
Instance Attribute Details
#country ⇒ Object
Returns the value of attribute country.
8 9 10 |
# File 'lib/seametrix_ruby/models/port.rb', line 8 def country @country end |
#latitude ⇒ Object
Returns the value of attribute latitude.
9 10 11 |
# File 'lib/seametrix_ruby/models/port.rb', line 9 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
9 10 11 |
# File 'lib/seametrix_ruby/models/port.rb', line 9 def longitude @longitude end |
#port_code ⇒ Object
Returns the value of attribute port_code.
8 9 10 |
# File 'lib/seametrix_ruby/models/port.rb', line 8 def port_code @port_code end |
#port_name ⇒ Object
Returns the value of attribute port_name.
8 9 10 |
# File 'lib/seametrix_ruby/models/port.rb', line 8 def port_name @port_name end |
#waypoint ⇒ Object (readonly)
Returns the value of attribute waypoint.
9 10 11 |
# File 'lib/seametrix_ruby/models/port.rb', line 9 def waypoint @waypoint end |
Class Method Details
.from_json(json_string) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/seametrix_ruby/models/port.rb', line 20 def self.from_json(json_string) json = MultiJson.load(json_string) new(port_name: json['portName'], port_code: json['portCode'], country: json['country'], longitude: json['longitude'].to_f, latitude: json['latitude'].to_f) end |