Class: PecCalcClient::Region
- Inherits:
-
Object
- Object
- PecCalcClient::Region
- Defined in:
- lib/pec_calc_client/region.rb
Constant Summary collapse
- URL =
'http://pecom.ru/ru/calc/towns.php'
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#towns ⇒ Object
readonly
Returns the value of attribute towns.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, towns) ⇒ Region
constructor
A new instance of Region.
Constructor Details
#initialize(name, towns) ⇒ Region
Returns a new instance of Region.
7 8 9 10 |
# File 'lib/pec_calc_client/region.rb', line 7 def initialize(name, towns) @name = name @towns = towns.collect { |id, name| Town.new id, name } end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/pec_calc_client/region.rb', line 5 def name @name end |
#towns ⇒ Object (readonly)
Returns the value of attribute towns.
5 6 7 |
# File 'lib/pec_calc_client/region.rb', line 5 def towns @towns end |
Class Method Details
.all ⇒ Object
12 13 14 15 |
# File 'lib/pec_calc_client/region.rb', line 12 def self.all @all = Connector.new(self::URL).request.to_hash.collect { |name, towns| new name, towns } if @all.nil? @all end |