@@ -17,19 +17,32 @@ Add the following to your **Gemfile**
17
17
## Usage
18
18
19
19
20
+ #### Getting and using the API key
21
+
22
+ How to get an API key and tips for an effective usage of the API:
23
+ http://openweathermap.org/appid
24
+
25
+
26
+ ``` ruby
27
+ # get current weather by city name
28
+ options = { units: " metric" , APPID: " 1111111111" }
29
+ OpenWeather ::Current .city(" Berlin, DE" , options)
30
+ ```
31
+
20
32
### Current weather information API
21
33
34
+
22
35
``` ruby
23
36
require ' open_weather'
24
37
25
38
# get current weather by city name
26
- OpenWeather ::Current .city(" Cochin, IN" )
39
+ OpenWeather ::Current .city(" Cochin, IN" , options )
27
40
28
41
# get current weather by city id
29
- OpenWeather ::Current .city_id(" 1273874" )
42
+ OpenWeather ::Current .city_id(" 1273874" , options )
30
43
31
44
# get current weather by geocode. (lat, lon)
32
- OpenWeather ::Current .geocode(9.94 , 76.26 )
45
+ OpenWeather ::Current .geocode(9.94 , 76.26 , options )
33
46
34
47
# get current weather for a list of city ids
35
48
OpenWeather ::Current .cities([524901 , 703448 , 2643743 ])
@@ -40,8 +53,9 @@ OpenWeather::Current.rectangle_zone(12, 32, 15, 37, 10)
40
53
# get current weather for cities around a point
41
54
OpenWeather ::Current .circle_zone(55.5 , 37.5 , 10 )
42
55
43
- # get the current weather in degrees celsius
44
- OpenWeather ::Current .city(" Cochin, IN" , units: ' metric' )
56
+ # By default temperature is returned in fahrenheit to get the current weather in degrees celsius use unit as follows.
57
+ options = { units: " metric" , APPID: " 1111111111" }
58
+ OpenWeather ::Current .city(" Cochin, IN" , options)
45
59
```
46
60
47
61
Documentation about the current weather end-point:
@@ -84,16 +98,7 @@ OpenWeather::ForecastDaily.city_id("1273874", cnt: 6)
84
98
Doucumentation about the weather forecast end-point:
85
99
http://openweathermap.org/forecast
86
100
87
- #### Using the API key
88
101
89
- ``` ruby
90
- # get current weather by city name
91
- options = { units: " metric" , APPID: 1111111111 }
92
- OpenWeather ::Current .city(" Berlin, DE" , options)
93
- ```
94
-
95
- How to get an API key and tips for an effective usage of the API:
96
- http://openweathermap.org/appid
97
102
98
103
#### Multilingual support
99
104
0 commit comments