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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8f8edcaf537f5ba58bc9fa24f6e2d25d6ae30c2
4
- data.tar.gz: 90eac0b99cdc5cd48a64be559d3280bf98c75808
3
+ metadata.gz: 860623a0d508c8584f07762c8b8e55c743348406
4
+ data.tar.gz: 273528a4c69fc97e39ba9dee023e0183d508fd2f
5
5
  SHA512:
6
- metadata.gz: 31c5974e5bd7556f09169f70e7f51a1e0654899f075546889de1c351c617e0cc7628b63c2c5ed0e737525518d2b9e3e2fc0e66a8e9b61b7ef9bc25ed7c1b72a9
7
- data.tar.gz: 9f7f8f2457948ec9d399096d719c8c8e9acf75f86d23a4627e613dd7ddee57434e6071e2c054a1326fced6252bc6fa451b5694a00a299267c884a4c81281e4ba
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 <city name>
13
+ @ruboty weather
7
14
  ```
8
15
 
9
16
  ## Contributing
10
17
 
11
- 1. Fork it ( https://github.com/[my-github-username]/ruboty-weather/fork )
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)? (?<keyword>\w+)/, name: "weather", description: "Fetch weather info from livedoor API"
4
+ on /weather( me)?/, name: "weather", description: "Fetch weather info from livedoor API"
5
5
 
6
6
  def weather(message)
7
- message.reply(fetch(message[:keyword]))
7
+ message.reply(fetch)
8
8
  end
9
9
 
10
10
  private
11
11
 
12
- def fetch(query)
13
- Ruboty::Weather::Client.new.get(query)
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(city_name)
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
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Weather
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  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.2
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-05-31 00:00:00.000000000 Z
11
+ date: 2014-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruboty