Class: Bring::PostalCode

Inherits:
BaseRequest show all
Defined in:
lib/bring/postal_code.rb

Constant Summary collapse

@@cities =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pnr, options = {}) ⇒ PostalCode

Returns a new instance of PostalCode.



12
13
14
15
# File 'lib/bring/postal_code.rb', line 12

def initialize(pnr, options = {})
  @postal_code = pnr
  @country = options[:country] || 'no'
end

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



6
7
8
# File 'lib/bring/postal_code.rb', line 6

def country
  @country
end

#postal_codeObject (readonly)

Returns the value of attribute postal_code.



6
7
8
# File 'lib/bring/postal_code.rb', line 6

def postal_code
  @postal_code
end

Class Method Details

.reset_cache!Object



8
9
10
# File 'lib/bring/postal_code.rb', line 8

def self.reset_cache!
  @@cities.clear
end

Instance Method Details

#cityObject



17
18
19
# File 'lib/bring/postal_code.rb', line 17

def city
  @@cities[postal_code] ||= request.body['result']
end