-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.md.save
75 lines (44 loc) · 1.53 KB
/
README.md.save
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# SnowWeather
SnowWeather is a simple Gem to interface with Weather Undergounds API
## Gem Status
<a href="https://travis-ci.org/Jrsnow8921"><img src="https://travis-ci.org/Jrsnow8921/SnowWeatherGem.svg?branch=master" height="18"></a>
## Travis CI Build Status
<a href="
https://travis-ci.org/Jrsnow8921/SnowWeatherGem.svg?branch=master
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'SnowWeather'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install SnowWeather
## Usage
Set the api_key whithin in a model or controller
```ruby
SnowWeather.api_key(<'123456789123456789'>)
```
Get current conditions
```ruby
SnowWeather::Conditions.getConditions(<'state'>, <'city'>)
```
Example
```ruby
SnowWeather.api_key(<'123456789123456789'>)
@data = SnowWeather::Conditions.getConditions('PA', 'Pittsburgh')
#gets the current temp in F
@temp = @data['current_observation']['temp_f']
#gets the current weather condition
@weather = @data['current_observation']['weather']
puts "The current weather is #{@weather} with a temperature of #{@temp}°F"
```
Result
The current weather is cloudy with a temperature of 60°F
Data is returned in JSON format.
## Contributing
1. Fork it ( https://github.com/Jrsnow8921/SnowWeatherGem/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request