Class: Lookup::Base
- Inherits:
-
Object
- Object
- Lookup::Base
- Defined in:
- lib/lookup/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#geo_obj ⇒ Object
Returns the value of attribute geo_obj.
-
#response ⇒ Object
Returns the value of attribute response.
-
#response_obj ⇒ Object
Returns the value of attribute response_obj.
-
#zipcode ⇒ Object
Returns the value of attribute zipcode.
Class Method Summary collapse
Instance Method Summary collapse
- #api_request ⇒ Object
-
#initialize(zipcode, options = {}) ⇒ Base
constructor
A new instance of Base.
- #parsed_url ⇒ Object
- #process ⇒ Object
Constructor Details
#initialize(zipcode, options = {}) ⇒ Base
Returns a new instance of Base.
18 19 20 |
# File 'lib/lookup/base.rb', line 18 def initialize(zipcode, = {}) @zipcode = zipcode end |
Instance Attribute Details
#geo_obj ⇒ Object
Returns the value of attribute geo_obj.
8 9 10 |
# File 'lib/lookup/base.rb', line 8 def geo_obj @geo_obj end |
#response ⇒ Object
Returns the value of attribute response.
8 9 10 |
# File 'lib/lookup/base.rb', line 8 def response @response end |
#response_obj ⇒ Object
Returns the value of attribute response_obj.
8 9 10 |
# File 'lib/lookup/base.rb', line 8 def response_obj @response_obj end |
#zipcode ⇒ Object
Returns the value of attribute zipcode.
8 9 10 |
# File 'lib/lookup/base.rb', line 8 def zipcode @zipcode end |
Class Method Details
.process(zipcode, options = {}) ⇒ Object
10 11 12 |
# File 'lib/lookup/base.rb', line 10 def self.process(zipcode, = {}) new(zipcode, ).process end |
Instance Method Details
#api_request ⇒ Object
14 15 16 |
# File 'lib/lookup/base.rb', line 14 def api_request Net::HTTP.get(parsed_url) end |
#parsed_url ⇒ Object
22 23 24 |
# File 'lib/lookup/base.rb', line 22 def parsed_url URI.parse(search_url) end |
#process ⇒ Object
26 27 28 29 30 31 |
# File 'lib/lookup/base.rb', line 26 def process begin self.response = api_request rescue end end |