Class: Wettr::IP
- Inherits:
-
Object
- Object
- Wettr::IP
- Defined in:
- lib/wettr/ip.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#lat ⇒ Object
readonly
Returns the value of attribute lat.
-
#lon ⇒ Object
readonly
Returns the value of attribute lon.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(address:, lat:, lon:) ⇒ IP
constructor
A new instance of IP.
Constructor Details
#initialize(address:, lat:, lon:) ⇒ IP
Returns a new instance of IP.
4 5 6 |
# File 'lib/wettr/ip.rb', line 4 def initialize(address:, lat:, lon:) @address, @lat, @lon = address, lat, lon end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
2 3 4 |
# File 'lib/wettr/ip.rb', line 2 def address @address end |
#lat ⇒ Object (readonly)
Returns the value of attribute lat.
2 3 4 |
# File 'lib/wettr/ip.rb', line 2 def lat @lat end |
#lon ⇒ Object (readonly)
Returns the value of attribute lon.
2 3 4 |
# File 'lib/wettr/ip.rb', line 2 def lon @lon end |
Class Method Details
.new_without_ip ⇒ Object
8 9 10 11 12 |
# File 'lib/wettr/ip.rb', line 8 def self.new_without_ip response = Wettr::IPAPI.call_without_ip ip = self.new(address: response["ip"], lat: response["latitude"], lon: response["longitude"]) ip end |