Class: Bring::PostalCode
- Inherits:
-
BaseRequest
- Object
- BaseRequest
- Bring::PostalCode
- Defined in:
- lib/bring/postal_code.rb
Constant Summary collapse
- @@cities =
{}
Instance Attribute Summary collapse
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#postal_code ⇒ Object
readonly
Returns the value of attribute postal_code.
Class Method Summary collapse
Instance Method Summary collapse
- #city ⇒ Object
-
#initialize(pnr, options = {}) ⇒ PostalCode
constructor
A new instance of PostalCode.
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, = {}) @postal_code = pnr @country = [:country] || 'no' end |
Instance Attribute Details
#country ⇒ Object (readonly)
Returns the value of attribute country.
6 7 8 |
# File 'lib/bring/postal_code.rb', line 6 def country @country end |
#postal_code ⇒ Object (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
#city ⇒ Object
17 18 19 |
# File 'lib/bring/postal_code.rb', line 17 def city @@cities[postal_code] ||= request.body['result'] end |