lita-apod 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +17 -0
- data/Gemfile +3 -0
- data/README.md +19 -0
- data/Rakefile +6 -0
- data/lib/lita/handlers/apod.rb +44 -0
- data/lib/lita-apod.rb +12 -0
- data/lita-apod.gemspec +24 -0
- data/locales/en.yml +4 -0
- data/spec/lita/handlers/apod_spec.rb +4 -0
- data/spec/spec_helper.rb +6 -0
- data/templates/.gitkeep +0 -0
- metadata +18 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29bbdb49b947774febd33d02cecc2d1a628e518e
|
4
|
+
data.tar.gz: da9e4eb57dd694b8ea820f4360a66c7552af8524
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 705451192734c896cde567fa303a0e3802b874c92240056245946bfe4a1439a89012b015356b205ca0b42c618d7805275823c9ca4053665c1791805a1126e9be
|
7
|
+
data.tar.gz: 33fe90f21f06a29778c258c1fa628a122ac21c3303d6fb124310b8d1de2df0c6498842d3c9e1ec0a9ac47214fa616bcb4eca981a361c86b392ba84a36d6b4017
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# lita-apod
|
2
|
+
|
3
|
+
Responds back with today's Astronomy Picture of the Day!
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add lita-apod to your Lita instance's Gemfile:
|
8
|
+
|
9
|
+
``` ruby
|
10
|
+
gem "lita-apod"
|
11
|
+
```
|
12
|
+
|
13
|
+
## Configuration
|
14
|
+
|
15
|
+
No configuration necessary! NASA gives their API away for free!!
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
Once installed, ```Lita: apod``` or ```Lita: apod?```
|
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
module Lita
|
2
|
+
module Handlers
|
3
|
+
class Apod < Handler
|
4
|
+
|
5
|
+
route(%r{^apod\?$}i, command: true, help: {
|
6
|
+
"apod" => "Gives you a RANDOM pretty picture! Pulled random from the NASA Picture of the Day. https://apod.nasa.gov/"
|
7
|
+
}) do |response|
|
8
|
+
|
9
|
+
rando = Time.at(rand((Time.now - (60*60*24*365*5))..Time.now)).strftime('%Y-%m-%d')
|
10
|
+
|
11
|
+
messageBody = ""
|
12
|
+
|
13
|
+
res = http.get("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&date=#{rando}")
|
14
|
+
|
15
|
+
object = MultiJson.load(res.body)
|
16
|
+
|
17
|
+
messageBody << object['hdurl'] + "\n"
|
18
|
+
messageBody << object['explanation']
|
19
|
+
|
20
|
+
response.reply(messageBody)
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
route(%r{^apod$}i, command: true, help: {
|
25
|
+
"apod" => "Gives you a pretty picture! Pulled from the NASA Picture of the Day. https://apod.nasa.gov/"
|
26
|
+
}) do |response|
|
27
|
+
|
28
|
+
messageBody = ""
|
29
|
+
|
30
|
+
res = http.get('https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY')
|
31
|
+
|
32
|
+
object = MultiJson.load(res.body)
|
33
|
+
|
34
|
+
messageBody << object['hdurl'] + "\n"
|
35
|
+
messageBody << object['explanation']
|
36
|
+
|
37
|
+
response.reply(messageBody)
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
Lita.register_handler(self)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/lita-apod.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "lita"
|
2
|
+
|
3
|
+
Lita.load_locales Dir[File.expand_path(
|
4
|
+
File.join("..", "..", "locales", "*.yml"), __FILE__
|
5
|
+
)]
|
6
|
+
|
7
|
+
require "lita/handlers/apod"
|
8
|
+
|
9
|
+
Lita::Handlers::Apod.template_root File.expand_path(
|
10
|
+
File.join("..", "..", "templates"),
|
11
|
+
__FILE__
|
12
|
+
)
|
data/lita-apod.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "lita-apod"
|
3
|
+
spec.version = "0.2.0"
|
4
|
+
spec.authors = "John Celoria"
|
5
|
+
spec.email = "jceloria@gmail.com"
|
6
|
+
spec.description = "Pulls a picture using the NASA APOD (astronomy picture of the day) API endpoint"
|
7
|
+
spec.summary = "NASA Space Pictures"
|
8
|
+
spec.homepage = "https://github.com/Brutalbeard/lita-apod"
|
9
|
+
spec.license = "MIT"
|
10
|
+
spec.metadata = { "lita_plugin_type" => "handler" }
|
11
|
+
|
12
|
+
spec.files = `git ls-files`.split($/)
|
13
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
14
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
|
+
spec.require_paths = ["lib"]
|
16
|
+
|
17
|
+
spec.add_runtime_dependency "lita", ">= 4.7"
|
18
|
+
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
20
|
+
spec.add_development_dependency "pry-byebug"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
spec.add_development_dependency "rack-test"
|
23
|
+
spec.add_development_dependency "rspec", ">= 3.0.0"
|
24
|
+
end
|
data/locales/en.yml
ADDED
data/spec/spec_helper.rb
ADDED
data/templates/.gitkeep
ADDED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-apod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Celoria
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -100,8 +100,19 @@ email: jceloria@gmail.com
|
|
100
100
|
executables: []
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
|
-
files:
|
104
|
-
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- Gemfile
|
106
|
+
- README.md
|
107
|
+
- Rakefile
|
108
|
+
- lib/lita-apod.rb
|
109
|
+
- lib/lita/handlers/apod.rb
|
110
|
+
- lita-apod.gemspec
|
111
|
+
- locales/en.yml
|
112
|
+
- spec/lita/handlers/apod_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
114
|
+
- templates/.gitkeep
|
115
|
+
homepage: https://github.com/Brutalbeard/lita-apod
|
105
116
|
licenses:
|
106
117
|
- MIT
|
107
118
|
metadata:
|
@@ -126,4 +137,6 @@ rubygems_version: 2.5.2
|
|
126
137
|
signing_key:
|
127
138
|
specification_version: 4
|
128
139
|
summary: NASA Space Pictures
|
129
|
-
test_files:
|
140
|
+
test_files:
|
141
|
+
- spec/lita/handlers/apod_spec.rb
|
142
|
+
- spec/spec_helper.rb
|