Class: SeametrixRuby::Models::Waypoint

Inherits:
Object
  • Object
show all
Defined in:
lib/seametrix_ruby/models/waypoint.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Waypoint

Returns a new instance of Waypoint.



8
9
10
11
# File 'lib/seametrix_ruby/models/waypoint.rb', line 8

def initialize(attributes = {})
  @lon = attributes[:lon].to_f
  @lat = attributes[:lat].to_f
end

Instance Attribute Details

#latObject

Returns the value of attribute lat.



6
7
8
# File 'lib/seametrix_ruby/models/waypoint.rb', line 6

def lat
  @lat
end

#lonObject

Returns the value of attribute lon.



6
7
8
# File 'lib/seametrix_ruby/models/waypoint.rb', line 6

def lon
  @lon
end

Class Method Details

.from_json(json_string) ⇒ Object



13
14
15
16
17
# File 'lib/seametrix_ruby/models/waypoint.rb', line 13

def self.from_json(json_string)
  json = MultiJson.load(json_string)

  new(lon: json['lon'].to_f, lat: json['lat'].to_f)
end

Instance Method Details

#latitudeObject



19
20
21
# File 'lib/seametrix_ruby/models/waypoint.rb', line 19

def latitude
  lat
end

#latitude=(value) ⇒ Object



27
28
29
# File 'lib/seametrix_ruby/models/waypoint.rb', line 27

def latitude=(value)
  @lat = value.to_f
end

#longitudeObject



23
24
25
# File 'lib/seametrix_ruby/models/waypoint.rb', line 23

def longitude
  lon
end

#longitude=(value) ⇒ Object



31
32
33
# File 'lib/seametrix_ruby/models/waypoint.rb', line 31

def longitude=(value)
  @lon = value.to_f
end