lita-wotd 1.0.0 → 1.1.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: ee72c410250b004deac0b117a0bc5f9c51aa864b
4
- data.tar.gz: 15374f97f28dc0cfdcacb86bd2f9850fb519e104
3
+ metadata.gz: 86f89aaa8ec02de298cd24271bb12c5dff1d8beb
4
+ data.tar.gz: 0ca747ee4466e52dc341c9cf52fb0cc980796d70
5
5
  SHA512:
6
- metadata.gz: 0262254106802f998d67b2cac2c8c2a1e7e174588c2e2b6f596406578f08228a982d7d0e4932360b38f4c970da288c685eeddd7610b5152d9924dd69f477ba92
7
- data.tar.gz: 548ac6cec020c41a951b8e4610fa40895363dfc2e403d2128c3b6c23e66399d99ef210ec29507c42e1e0e8775bf26784f661bbc4d9134073b01144fb9305aa86
6
+ metadata.gz: fc7a83ac94b2359655c7c5b8fbefaef1118de2f97dca33c87c571e5a61daeca9ef4b29b37fd2ca5188486d2ecf69073a89abc63cff50501e3a7781d957e98d02
7
+ data.tar.gz: da46c00f1a013e5fae01f66a414499816a3d045f0072d13ff89feb8dc9e801fc79d4d9554b996b801cc79b61c7d500278cca1d2a8e1378371e65c28ee1183c85
@@ -5,6 +5,8 @@ require 'rexml/document'
5
5
  module Lita
6
6
  module Handlers
7
7
  class Wotd < Handler
8
+ WOTD_URL = 'https://wordsmith.org/awad/rss1.xml'.freeze
9
+
8
10
  route(/wotd/, :wotd, command: true, help: {
9
11
  'wotd' => 'returns the word of the day from dictionary.com'
10
12
  })
@@ -14,18 +16,23 @@ module Lita
14
16
  end
15
17
 
16
18
  private
19
+
17
20
  def the_word
18
- "#{extract_the_word} - dictionary.com"
21
+ "#{extract_the_word} - wordsmith.org"
19
22
  end
20
23
 
21
24
  def extract_the_word
22
- xml_data = api_call.body
23
- doc = REXML::Document.new(xml_data)
24
- doc.get_elements('//description').last.get_text
25
+ title = doc.get_elements('//title').last.get_text
26
+ description = doc.get_elements('//description').last.get_text
27
+ "#{title} => #{description}"
28
+ end
29
+
30
+ def doc
31
+ @doc ||= REXML::Document.new(api_call.body)
25
32
  end
26
33
 
27
34
  def uri
28
- URI.parse 'http://www.dictionary.com/wordoftheday/wotd.rss'
35
+ URI.parse WOTD_URL
29
36
  end
30
37
 
31
38
  def api_call
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-wotd"
3
- spec.version = "1.0.0"
3
+ spec.version = "1.1.0"
4
4
  spec.authors = ["maxbeizer"]
5
5
  spec.email = ["max.beizer@gmail.com"]
6
6
  spec.description = "A lita bot to get the word of the day from dictionary.com"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-wotd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - maxbeizer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-02 00:00:00.000000000 Z
11
+ date: 2017-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
- rubygems_version: 2.4.5.1
137
+ rubygems_version: 2.6.13
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: A lita bot to get the word of the day from dictionary.com