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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9621145a467ec62c313b362e06c2e738cc871ca
4
- data.tar.gz: 2e1247ec027bd138cee0a7f483f6ec933dce265d
3
+ metadata.gz: 29bbdb49b947774febd33d02cecc2d1a628e518e
4
+ data.tar.gz: da9e4eb57dd694b8ea820f4360a66c7552af8524
5
5
  SHA512:
6
- metadata.gz: 7dacafddb4893acc3a8b09decdeb8b3d689c41a4516a1c85dd5fe25444ae72a7691dcf183b5bd1e77cc9e11e47b2887f25d20ced0b610a06883d291c16596f57
7
- data.tar.gz: 57a0be492c6d4dd23776f9d8f1a2c4d10f43e7be1195d5ad67e7ad4e6334d6a4d5869012e383febfec1f27e6796e9bae96ebebca649d4cf5fbd52e3a49ef3c2f
6
+ metadata.gz: 705451192734c896cde567fa303a0e3802b874c92240056245946bfe4a1439a89012b015356b205ca0b42c618d7805275823c9ca4053665c1791805a1126e9be
7
+ data.tar.gz: 33fe90f21f06a29778c258c1fa628a122ac21c3303d6fb124310b8d1de2df0c6498842d3c9e1ec0a9ac47214fa616bcb4eca981a361c86b392ba84a36d6b4017
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/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,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -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
@@ -0,0 +1,4 @@
1
+ en:
2
+ lita:
3
+ handlers:
4
+ apod:
@@ -0,0 +1,4 @@
1
+ require "spec_helper"
2
+
3
+ describe Lita::Handlers::Apod, lita_handler: true do
4
+ end
@@ -0,0 +1,6 @@
1
+ require "lita-apod"
2
+ require "lita/rspec"
3
+
4
+ # A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
5
+ # was generated with Lita 4, the compatibility mode should be left disabled.
6
+ Lita.version_3_compatibility_mode = false
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.1.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-21 00:00:00.000000000 Z
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
- homepage: https://github.com/Brutalbeard
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