Class: Airports::AirportInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/movlog/airport.rb

Overview

airport

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ AirportInfo

Returns a new instance of AirportInfo.



10
11
12
13
# File 'lib/movlog/airport.rb', line 10

def initialize(data)
  @location = data[:location]
  load_geocode(data[:geocode])
end

Instance Attribute Details

#airportsObject (readonly)

Returns the value of attribute airports.



8
9
10
# File 'lib/movlog/airport.rb', line 8

def airports
  @airports
end

#latObject (readonly)

Returns the value of attribute lat.



7
8
9
# File 'lib/movlog/airport.rb', line 7

def lat
  @lat
end

#lngObject (readonly)

Returns the value of attribute lng.



7
8
9
# File 'lib/movlog/airport.rb', line 7

def lng
  @lng
end

#locationObject (readonly)

Returns the value of attribute location.



6
7
8
# File 'lib/movlog/airport.rb', line 6

def location
  @location
end

Class Method Details

.find(location) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/movlog/airport.rb', line 15

def self.find(location)
  data = {
    location: location,
    geocode: GoogleMapApi.geocode(location)
  }
  new(data)
end