Class: CycleHire::Station

Inherits:
Object
  • Object
show all
Defined in:
lib/cycle_hire/station.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, id, latitude, longitude, bikes, empty_docks, installed, locked, temporary, timestamp) ⇒ Station

Returns a new instance of Station.



4
5
6
# File 'lib/cycle_hire/station.rb', line 4

def initialize(name)
  parse_name!(name)
end

Instance Attribute Details

#areaObject (readonly)

Returns the value of attribute area.



2
3
4
# File 'lib/cycle_hire/station.rb', line 2

def area
  @area
end

#bikesObject (readonly)

Returns the value of attribute bikes.



2
3
4
# File 'lib/cycle_hire/station.rb', line 2

def bikes
  @bikes
end

#empty_docksObject (readonly)

Returns the value of attribute empty_docks.



2
3
4
# File 'lib/cycle_hire/station.rb', line 2

def empty_docks
  @empty_docks
end

#idObject (readonly)

Returns the value of attribute id.



2
3
4
# File 'lib/cycle_hire/station.rb', line 2

def id
  @id
end

#installedObject (readonly)

Returns the value of attribute installed.



2
3
4
# File 'lib/cycle_hire/station.rb', line 2

def installed
  @installed
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



2
3
4
# File 'lib/cycle_hire/station.rb', line 2

def latitude
  @latitude
end

#lockedObject (readonly)

Returns the value of attribute locked.



2
3
4
# File 'lib/cycle_hire/station.rb', line 2

def locked
  @locked
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



2
3
4
# File 'lib/cycle_hire/station.rb', line 2

def longitude
  @longitude
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/cycle_hire/station.rb', line 2

def name
  @name
end

#temporaryObject (readonly)

Returns the value of attribute temporary.



2
3
4
# File 'lib/cycle_hire/station.rb', line 2

def temporary
  @temporary
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



2
3
4
# File 'lib/cycle_hire/station.rb', line 2

def timestamp
  @timestamp
end

Instance Method Details

#to_hObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cycle_hire/station.rb', line 23

def to_h
  {
    :id => @id,
    :name => @name,
    :area => @area,
    :latitude => @latitude,
    :longitude => @longitude,
    :bikes => @bikes,
    :empty_docks => @empty_docks,
    :installed => @installed,
    :locked => @locked,
    :temporary => @temporary,
    :timestamp => @timestamp
  }
end