ruboty-weather 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -2
- data/lib/ruboty/handlers/weather.rb +4 -4
- data/lib/ruboty/weather/client.rb +5 -2
- data/lib/ruboty/weather/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 860623a0d508c8584f07762c8b8e55c743348406
|
4
|
+
data.tar.gz: 273528a4c69fc97e39ba9dee023e0183d508fd2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fce8ab36a1a2ad7548453e55b0726a6e247edcd2e07392032503695c48643155dd953f1946e7e1d8f7d07fa0ac85a66286fcda8eb722bf8e686d0b1d2cbe6a1c
|
7
|
+
data.tar.gz: 3c3e0c6901bbbf1af01f93538f958e185cb64c24e3f37b3b7b45d7f77d99bfc272b2409ddf41ff6ba675926cb1b78d7afa83644ab9d5b6e746b1b603649692a0
|
data/README.md
CHANGED
@@ -1,14 +1,21 @@
|
|
1
1
|
# Ruboty::Weather
|
2
2
|
An ruboty handler to weather from livedoor API
|
3
3
|
|
4
|
+
## ENV
|
5
|
+
```
|
6
|
+
RUBOTY_WEATHER_CITY - City code for livedoor API (default: tokyo(130010))
|
7
|
+
RUBOTY_WEATHER_CITY=140010 #e.g. yokohama
|
8
|
+
```
|
9
|
+
[You can see city code you want.](https://gist.github.com/ryopeko/352e17af0b2f74bbddab)
|
10
|
+
|
4
11
|
## Usage
|
5
12
|
```
|
6
|
-
@ruboty weather
|
13
|
+
@ruboty weather
|
7
14
|
```
|
8
15
|
|
9
16
|
## Contributing
|
10
17
|
|
11
|
-
1. Fork it ( https://github.com/
|
18
|
+
1. Fork it ( https://github.com/ryopeko/ruboty-weather/fork )
|
12
19
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
13
20
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
14
21
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module Ruboty
|
2
2
|
module Handlers
|
3
3
|
class Weather < Base
|
4
|
-
on /weather( me)
|
4
|
+
on /weather( me)?/, name: "weather", description: "Fetch weather info from livedoor API"
|
5
5
|
|
6
6
|
def weather(message)
|
7
|
-
message.reply(fetch
|
7
|
+
message.reply(fetch)
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
11
11
|
|
12
|
-
def fetch
|
13
|
-
Ruboty::Weather::Client.new.get
|
12
|
+
def fetch
|
13
|
+
Ruboty::Weather::Client.new.get
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -19,8 +19,7 @@ module Ruboty
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def get(
|
23
|
-
return 'undefined city name' unless city_code = cities[city_name.to_sym]
|
22
|
+
def get(city_code=default_city)
|
24
23
|
response = @client.get("#{url}?city=#{city_code}").body
|
25
24
|
response['forecasts'][0]['telop']
|
26
25
|
end
|
@@ -34,6 +33,10 @@ module Ruboty
|
|
34
33
|
def cities
|
35
34
|
CITIES
|
36
35
|
end
|
36
|
+
|
37
|
+
def default_city
|
38
|
+
ENV['RUBOTY_WEATHER_CITY'] || 130010 #tokyo
|
39
|
+
end
|
37
40
|
end
|
38
41
|
end
|
39
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-weather
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryoichi SEKIGUCHI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruboty
|