README.md in owmo-1.0.0 vs README.md in owmo-1.0.1
- old
+ new
@@ -20,11 +20,11 @@
$ gem install owmo
## Usage
-You'll need and API key from OpenWeatherMap.org (http://openweathermap.org/appid).
+You'll need and API key from [OpenWeatherMap.org](http://openweathermap.org/appid).
Compelete examples can be found under owmo/examples.
----
### Quick Start
@@ -43,22 +43,27 @@
puts weather.get :forecast, city_name: "London,UK"
end
```
----
### Weather Information
-#### Current weather data (http://openweathermap.org/current)
+#### [Current weather data](http://openweathermap.org/current)
```ruby
puts weather.get :current, city_name: "London,UK"
```
-#### 5 day weather forecast (http://openweathermap.org/forecast5)
+[Full example](https://github.com/robb-randall/owmo/blob/master/examples/current.rb)
+
+#### [5 day weather forecast](http://openweathermap.org/forecast5)
```ruby
puts weather.get :forecast5, city_name: "London,UK"
```
-#### 16 day weather forecast (http://openweathermap.org/forecast16)
+[Full example](https://github.com/robb-randall/owmo/blob/master/examples/forecast5.rb)
+
+#### [16 day weather forecast](http://openweathermap.org/forecast16)
```ruby
puts weather.get :forecast16, city_name: "London,UK"
```
+[Full example](https://github.com/robb-randall/owmo/blob/master/examples/forecast16.rb)
----
### Query parameters
#### Geocode (required)
@@ -76,10 +81,11 @@
puts weather.get :current, zip_code: 90210
# Geocode by Coordinance
puts weather.get :current, lon: -118.41, lat: 34.09
```
+[Full example](https://github.com/robb-randall/owmo/blob/master/examples/query_geocode.rb)
#### Mode
```ruby
# Response in JSON format (default)
puts weather.get :current, city_name: "London,UK"
@@ -89,10 +95,11 @@
puts weather.get :current, city_name: "London,UK", mode: :xml
# Response in HTML format
puts weather.get :current, city_name: "London,UK", mode: :html
```
+[Full example](https://github.com/robb-randall/owmo/blob/master/examples/query_mode.rb)
#### Units
```ruby
# Kelvin (default)
puts weather.get :current, city_name: "London,UK"
@@ -101,10 +108,11 @@
puts weather.get :current, city_name: "London,UK", units: :imperial
# Metric
puts weather.get :current, city_name: "London,UK", units: :metric
```
+[Full example](https://github.com/robb-randall/owmo/blob/master/examples/query_units.rb)
#### All
```ruby
query = {
city_name: "London,UK",
@@ -113,9 +121,29 @@
lang: 'fr'
}
puts weather.get :current, query
```
+[Full example](https://github.com/robb-randall/owmo/blob/master/examples/query_all.rb)
+
+----
+### Wroking example using Sinatra
+
+```ruby
+require 'owmo'
+require 'sinatra' # Need to install, not included in gemspec
+require 'uri'
+
+get '/current/:name' do
+ api_key = '<API Key>'
+ weather = OWMO::Weather.new api_key
+ weather.get :current, city_name: params[:name], mode: :html
+end
+```
+
+Then navigate to: http://localhost:4567/current/London,UK
+
+[Full example](https://github.com/robb-randall/owmo/blob/master/examples/sinatra_example.rb)
----
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.