Skip to content

Commit 4d82f41

Browse files
sanipymcoderhs
authored andcommitted
Documentation updated
1 parent 7ab7ace commit 4d82f41

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,32 @@ Add the following to your **Gemfile**
1717
## Usage
1818

1919

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+
2032
### Current weather information API
2133

34+
2235
```ruby
2336
require 'open_weather'
2437

2538
# get current weather by city name
26-
OpenWeather::Current.city("Cochin, IN")
39+
OpenWeather::Current.city("Cochin, IN", options)
2740

2841
# get current weather by city id
29-
OpenWeather::Current.city_id("1273874")
42+
OpenWeather::Current.city_id("1273874", options)
3043

3144
# get current weather by geocode. (lat, lon)
32-
OpenWeather::Current.geocode(9.94, 76.26)
45+
OpenWeather::Current.geocode(9.94, 76.26 , options)
3346

3447
# get current weather for a list of city ids
3548
OpenWeather::Current.cities([524901, 703448, 2643743])
@@ -40,8 +53,9 @@ OpenWeather::Current.rectangle_zone(12, 32, 15, 37, 10)
4053
# get current weather for cities around a point
4154
OpenWeather::Current.circle_zone(55.5, 37.5, 10)
4255

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)
4559
```
4660

4761
Documentation about the current weather end-point:
@@ -84,16 +98,7 @@ OpenWeather::ForecastDaily.city_id("1273874", cnt: 6)
8498
Doucumentation about the weather forecast end-point:
8599
http://openweathermap.org/forecast
86100

87-
#### Using the API key
88101

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
97102

98103
#### Multilingual support
99104

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy