Class: Location::Services::StubbedService
- Inherits:
-
Object
- Object
- Location::Services::StubbedService
- Defined in:
- lib/location/services/stubbed_service.rb
Class Method Summary collapse
- .attributes ⇒ Object
- .attributes_for(postal_code) ⇒ Object
- .set_result(postal_code, attributes) ⇒ Object
Instance Method Summary collapse
Class Method Details
.attributes ⇒ Object
4 5 6 |
# File 'lib/location/services/stubbed_service.rb', line 4 def self.attributes @attributes ||= {} end |
.attributes_for(postal_code) ⇒ Object
12 13 14 |
# File 'lib/location/services/stubbed_service.rb', line 12 def self.attributes_for(postal_code) self.attributes[postal_code] || {} end |
.set_result(postal_code, attributes) ⇒ Object
8 9 10 |
# File 'lib/location/services/stubbed_service.rb', line 8 def self.set_result(postal_code, attributes) self.attributes[postal_code] ||= attributes end |
Instance Method Details
#fetch(postal_code, address) ⇒ Object
16 17 18 19 20 |
# File 'lib/location/services/stubbed_service.rb', line 16 def fetch(postal_code, address) self.class.attributes_for(postal_code).each do |k, v| address.send("#{k}=", v) end end |