Class: OpenWeather::Base
- Inherits:
-
Object
- Object
- OpenWeather::Base
- Extended by:
- ClassMethods
- Defined in:
- lib/open_weather/api.rb,
lib/open_weather/base.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#weather_info ⇒ Object
readonly
Returns the value of attribute weather_info.
Instance Method Summary collapse
-
#initialize(url, options) ⇒ Base
constructor
A new instance of Base.
- #retrive ⇒ Object
- #success? ⇒ Boolean
Methods included from ClassMethods
Constructor Details
#initialize(url, options) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 |
# File 'lib/open_weather/base.rb', line 9 def initialize url, @status = false @url = url @options = () end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
7 8 9 |
# File 'lib/open_weather/base.rb', line 7 def @message end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/open_weather/base.rb', line 7 def @options end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/open_weather/base.rb', line 7 def status @status end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/open_weather/base.rb', line 7 def url @url end |
#weather_info ⇒ Object (readonly)
Returns the value of attribute weather_info.
7 8 9 |
# File 'lib/open_weather/base.rb', line 7 def weather_info @weather_info end |
Instance Method Details
#retrive ⇒ Object
15 16 17 18 |
# File 'lib/open_weather/base.rb', line 15 def retrive @response = send_request(self) unless @options.empty? parse_response if @response end |
#success? ⇒ Boolean
20 21 22 |
# File 'lib/open_weather/base.rb', line 20 def success? @status == 200 end |