Class: StationMaster::Station

Inherits:
Object
  • Object
show all
Extended by:
Find
Defined in:
lib/station_master/station.rb,
lib/station_master/station/find.rb

Defined Under Namespace

Modules: Find

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Find

all, find_by_city, find_details, find_region_id_by_code

Constructor Details

#initialize(station_code, latitude, longitude, region_id, location) ⇒ Station

Returns a new instance of Station.



9
10
11
12
13
14
15
# File 'lib/station_master/station.rb', line 9

def initialize(station_code, latitude, longitude, region_id, location)
  @station_code = station_code
  @latitude = latitude
  @longitude = longitude
  @region_id = region_id
  @location = location
end

Instance Attribute Details

#latitudeObject (readonly)

Returns the value of attribute latitude.



7
8
9
# File 'lib/station_master/station.rb', line 7

def latitude
  @latitude
end

#locationObject (readonly)

Returns the value of attribute location.



7
8
9
# File 'lib/station_master/station.rb', line 7

def location
  @location
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



7
8
9
# File 'lib/station_master/station.rb', line 7

def longitude
  @longitude
end

#region_idObject (readonly)

Returns the value of attribute region_id.



7
8
9
# File 'lib/station_master/station.rb', line 7

def region_id
  @region_id
end

#station_codeObject (readonly)

Returns the value of attribute station_code.



7
8
9
# File 'lib/station_master/station.rb', line 7

def station_code
  @station_code
end

Instance Method Details

#to_hashObject



17
18
19
20
21
22
23
24
25
# File 'lib/station_master/station.rb', line 17

def to_hash
  {
    station_code: station_code,
    latitude: latitude,
    longitude: longitude,
    region_id: region_id,
    location: location
  }
end