Class: CubeSmart::Address
- Inherits:
-
Object
- Object
- CubeSmart::Address
- Defined in:
- lib/cubesmart/address.rb
Overview
The address (street + city + state + zip) of a facility.
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(street:, city:, state:, zip:) ⇒ Address
constructor
A new instance of Address.
- #inspect ⇒ String
- #text ⇒ String
Constructor Details
#initialize(street:, city:, state:, zip:) ⇒ Address
Returns a new instance of Address.
26 27 28 29 30 31 |
# File 'lib/cubesmart/address.rb', line 26 def initialize(street:, city:, state:, zip:) @street = street @city = city @state = state @zip = zip end |
Instance Attribute Details
#city ⇒ String
12 13 14 |
# File 'lib/cubesmart/address.rb', line 12 def city @city end |
#state ⇒ String
16 17 18 |
# File 'lib/cubesmart/address.rb', line 16 def state @state end |
#street ⇒ String
8 9 10 |
# File 'lib/cubesmart/address.rb', line 8 def street @street end |
#zip ⇒ String
20 21 22 |
# File 'lib/cubesmart/address.rb', line 20 def zip @zip end |
Class Method Details
.parse(data:) ⇒ Address
52 53 54 55 56 57 58 59 |
# File 'lib/cubesmart/address.rb', line 52 def self.parse(data:) new( street: data['streetAddress'], city: data['addressLocality'], state: data['addressRegion'], zip: data['postalCode'] ) end |
Instance Method Details
#inspect ⇒ String
34 35 36 37 38 39 40 41 42 |
# File 'lib/cubesmart/address.rb', line 34 def inspect props = [ "street=#{@street.inspect}", "city=#{@city.inspect}", "state=#{@state.inspect}", "zip=#{@zip.inspect}" ] "#<#{self.class.name} #{props.join(' ')}>" end |
#text ⇒ String
45 46 47 |
# File 'lib/cubesmart/address.rb', line 45 def text "#{street}, #{city}, #{state} #{zip}" end |