Class: PublicStorage::Rates
- Inherits:
-
Object
- Object
- PublicStorage::Rates
- Defined in:
- lib/publicstorage/rates.rb
Overview
The rates (street + web) for a facility
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(street:, web:) ⇒ Rates
constructor
A new instance of Rates.
- #inspect ⇒ String
-
#text ⇒ String
E.g.
Constructor Details
#initialize(street:, web:) ⇒ Rates
Returns a new instance of Rates.
16 17 18 19 |
# File 'lib/publicstorage/rates.rb', line 16 def initialize(street:, web:) @street = street @web = web end |
Instance Attribute Details
#street ⇒ Integer
8 9 10 |
# File 'lib/publicstorage/rates.rb', line 8 def street @street end |
#web ⇒ Integer
12 13 14 |
# File 'lib/publicstorage/rates.rb', line 12 def web @web end |
Class Method Details
.parse(data:) ⇒ Rates
38 39 40 41 42 |
# File 'lib/publicstorage/rates.rb', line 38 def self.parse(data:) street = data['listprice'] web = data['saleprice'] new(street:, web:) end |
Instance Method Details
#inspect ⇒ String
22 23 24 25 26 27 28 |
# File 'lib/publicstorage/rates.rb', line 22 def inspect props = [ "street=#{@street.inspect}", "web=#{@web.inspect}" ] "#<#{self.class.name} #{props.join(' ')}>" end |
#text ⇒ String
Returns e.g. “$80 (street) | $60 (web)”.
31 32 33 |
# File 'lib/publicstorage/rates.rb', line 31 def text "$#{@street} (street) | $#{@web} (web)" end |