Class: ExtraSpace::Rates

Inherits:
Object
  • Object
show all
Defined in:
lib/extraspace/rates.rb

Overview

The rates (street + web) for a facility

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(street:, web:) ⇒ Rates

Returns a new instance of Rates.

Parameters:

  • street (Integer)
  • web (Integer)


26
27
28
29
# File 'lib/extraspace/rates.rb', line 26

def initialize(street:, web:)
  @street = street
  @web = web
end

Instance Attribute Details

#streetInteger

Returns:

  • (Integer)


8
9
10
# File 'lib/extraspace/rates.rb', line 8

def street
  @street
end

#webInteger

Returns:

  • (Integer)


12
13
14
# File 'lib/extraspace/rates.rb', line 12

def web
  @web
end

Class Method Details

.parse(data:) ⇒ Rates

Parameters:

  • data (Hash)

Returns:



17
18
19
20
21
22
# File 'lib/extraspace/rates.rb', line 17

def self.parse(data:)
  new(
    street: data['street'],
    web: data['web']
  )
end

Instance Method Details

#inspectString

Returns:

  • (String)


32
33
34
35
36
37
38
# File 'lib/extraspace/rates.rb', line 32

def inspect
  props = [
    "street=#{@street.inspect}",
    "web=#{@web.inspect}"
  ]
  "#<#{self.class.name} #{props.join(' ')}>"
end

#textString

Returns e.g. “$80 (street) | $60 (web)”.

Returns:

  • (String)

    e.g. “$80 (street) | $60 (web)”



41
42
43
# File 'lib/extraspace/rates.rb', line 41

def text
  "$#{@street} (street) | $#{@web} (web)"
end