ruboty-japan_weather 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 08d3a9f568f26bdc439d4503cc368a7088bbdb7d
4
+ data.tar.gz: d26fbd684ed61efd6c000607e40e9c8011487038
5
+ SHA512:
6
+ metadata.gz: 99c6d8c441b31528e38ca9ddf63796071ea9a5bd618860f34a74520245d3777c23c770e8a0a7ce8c8b6eb9462282d15a1701519b7c28491e7625496cf102b175
7
+ data.tar.gz: cf5ca954a2c967fec8539c73f5966cd15166015252d600f0b69851b83bbb854de240405e947deaab19e78b54b7453e3589075dd17ff93b935c240cade732a03a
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Taiki ONO (taiki45)
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # Ellen::JapanWeather
2
+ An action to tell weather forecast for [Ellen](https://github.com/r7kamura/ellen/) framework.
3
+
4
+ ## Installation
5
+ ```ruby
6
+ # Gemfile
7
+ gem 'ellen-japan_weather'
8
+ ```
9
+
10
+ ## Usage
11
+ ```
12
+ > @ellen 明日の秋葉原の天気教えて
13
+ 東京都 千代田区の明日の天気は曇時々雨 最高気温25度 最低気温17度 降水確率は60% です。
14
+ > @ellen きょうのテヘランの天気は?
15
+ イラン テヘランの現在の天気は(17時00分 現在)晴時々曇 です。
16
+ ```
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,21 @@
1
+ module Ruboty
2
+ module Actions
3
+ class JapanWeather < Base
4
+ def call
5
+ message.reply(forecast)
6
+ end
7
+
8
+ private
9
+
10
+ def forecast
11
+ look_for(message.body).to_s
12
+ end
13
+
14
+ def look_for(body)
15
+ WeatherJp.parse(body)
16
+ rescue WeatherJp::WeatherJpError => e
17
+ "Error: #{e}"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ module Ruboty
2
+ module Handlers
3
+ class JapanWeather < Base
4
+ on /.*の天気/, name: "japan_weather", description: "Reply weather forecast"
5
+
6
+ def japan_weather(message)
7
+ Ruboty::Actions::JapanWeather.new(message).call
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module Ruboty
2
+ module JapanWeather
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ require "weather_jp"
2
+ require "ruboty"
3
+ require "ruboty/japan_weather/version"
4
+ require "ruboty/actions/japan_weather"
5
+ require "ruboty/handlers/japan_weather"
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ruboty/japan_weather/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ruboty-japan_weather"
8
+ spec.version = Ruboty::JapanWeather::VERSION
9
+ spec.authors = ["Taiki ONO"]
10
+ spec.email = ["taiks.4559@gmail.com"]
11
+ spec.summary = %q{Weather forecast action for ruboty bot framework.}
12
+ spec.description = %q{An action to tell weather forecast for ruboty bot framework.}
13
+ spec.homepage = "https://github.com/taiki45/ruboty-japan_weather"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "ruboty"
22
+ spec.add_dependency "weather_jp", "~> 1.0"
23
+ spec.add_development_dependency "bundler", "~> 1.5"
24
+ spec.add_development_dependency "rake"
25
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruboty-japan_weather
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Taiki ONO
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruboty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: weather_jp
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: An action to tell weather forecast for ruboty bot framework.
70
+ email:
71
+ - taiks.4559@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - lib/ruboty/actions/japan_weather.rb
82
+ - lib/ruboty/handlers/japan_weather.rb
83
+ - lib/ruboty/japan_weather.rb
84
+ - lib/ruboty/japan_weather/version.rb
85
+ - ruboty-japan_weather.gemspec
86
+ homepage: https://github.com/taiki45/ruboty-japan_weather
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.2.2
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Weather forecast action for ruboty bot framework.
110
+ test_files: []
111
+ has_rdoc: