Class: Osm::Grouping

Inherits:
Object
  • Object
show all
Defined in:
lib/osm/grouping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Grouping

Initialize a new Grouping using the hash returned by the API call

Parameters:

  • data

    the hash of data for the object returned by the API



17
18
19
20
21
22
# File 'lib/osm/grouping.rb', line 17

def initialize(data)
  @id = Osm::to_i_or_nil(data['patrolid'])
  @name = data['name']
  @active = (data['active'] == 1)
  @points = Osm::to_i_or_nil(data['points'])
end

Instance Attribute Details

#activeObject (readonly)

Returns the value of attribute active.



5
6
7
# File 'lib/osm/grouping.rb', line 5

def active
  @active
end

#idBoolean (readonly)

Returns wether the grouping is active.

Returns:

  • (Boolean)

    wether the grouping is active



6
7
8
# File 'lib/osm/grouping.rb', line 6

def id
  @id
end

#nameString (readonly)

Returns the name of the grouping.

Returns:

  • (String)

    the name of the grouping



6
7
8
# File 'lib/osm/grouping.rb', line 6

def name
  @name
end

#pointsFixnum (readonly)

Returns the points awarded to the grouping.

Returns:

  • (Fixnum)

    the points awarded to the grouping



6
7
8
# File 'lib/osm/grouping.rb', line 6

def points
  @points
end