Class: GeoipTs::Obj
- Inherits:
-
Object
- Object
- GeoipTs::Obj
- Defined in:
- lib/geoip_ts.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#response ⇒ Object
Returns the value of attribute response.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(domain, response) ⇒ Obj
constructor
A new instance of Obj.
Constructor Details
#initialize(domain, response) ⇒ Obj
Returns a new instance of Obj.
16 17 18 19 20 |
# File 'lib/geoip_ts.rb', line 16 def initialize(domain, response) @domain = domain @response = response build end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
14 15 16 |
# File 'lib/geoip_ts.rb', line 14 def hash @hash end |
#response ⇒ Object
Returns the value of attribute response.
13 14 15 |
# File 'lib/geoip_ts.rb', line 13 def response @response end |
#url ⇒ Object
Returns the value of attribute url.
13 14 15 |
# File 'lib/geoip_ts.rb', line 13 def url @url end |
Instance Method Details
#build ⇒ Object
22 23 24 25 26 27 |
# File 'lib/geoip_ts.rb', line 22 def build httpresp = HTTParty.get("http://www.freegeoip.net/json/#{@domain}") hash = httpresp.parsed_response @response.set(hash) @response end |