lita-wordnik 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce8bb942f982996203a905a3212e4ee5d162c39c
4
- data.tar.gz: 20134edd81a00fde12234f006d47bb7568972a4f
3
+ metadata.gz: 7b47ef9632471408cb9aa52ec8374e0674895d2f
4
+ data.tar.gz: b91b0e980447702325965872652b0f7b84c5761a
5
5
  SHA512:
6
- metadata.gz: 7df229ffa08cc6fd6eca44c445896614d20f68d466f9bd31c5ec323e4e2807e97086122f806ac890cef6a0ea043a8cf4c9e6e2f83241f8dd8cd17d409b98c8f9
7
- data.tar.gz: dee4b9ebd3ce0a0567480d153d18dcbd2f73aa112dfb6d8512da9ceaffddf652a6badf3c0a7f58d1f33401645f95a3ed6f77621bc0fe7ef4a7486bb84fa1bb79
6
+ metadata.gz: 6fe78f6d45a6b911796844e563ed1a932fc7d51b59afcede6acaeca730cb8fcf4d2e20baaf33a2423560ef38d672faecb08ee7045ce304acde1d1ab2d93dabc0
7
+ data.tar.gz: ba85702a5b6c1a5956a36b2bcd2e31ce379ea3cb4a13b62bcee585af825652c3fbd53a93ece4f3ac6b406959334219b29b35239724b59ec206596f4744b75d9d
data/README.md CHANGED
@@ -18,7 +18,7 @@ gem "lita-wordnik"
18
18
 
19
19
  ### Required attributes
20
20
 
21
- * `api_key` - Your API key for Wordnik. Register for one at the [Wordnik Developer](http://developer.wordnik.com/) page.
21
+ * `api_key` (String) - Your API key for Wordnik. Register for one at the [Wordnik Developer](http://developer.wordnik.com/) page.
22
22
 
23
23
  ### Example
24
24
 
@@ -5,9 +5,7 @@ module Lita
5
5
  class Wordnik < Handler
6
6
  NO_RESULTS = "Wordnik doesn't have any results for that."
7
7
 
8
- def self.default_config(config)
9
- config.api_key = nil
10
- end
8
+ config :api_key, type: String, required: true
11
9
 
12
10
  route(/define\s+(.+)/i, :define, command: true, help: {
13
11
  "define WORD" => "Get the definition for WORD."
@@ -28,7 +26,6 @@ module Lita
28
26
  class << self
29
27
  def define_wordnik_method(name, getter_name)
30
28
  define_method(name) do |response|
31
- return unless validate(response)
32
29
  word = encode_word(response.matches[0][0])
33
30
  result = send(getter_name, word)
34
31
  response.reply(result)
@@ -115,15 +112,6 @@ module Lita
115
112
  end
116
113
  end
117
114
 
118
- def validate(response)
119
- if Lita.config.handlers.wordnik.api_key.nil?
120
- response.reply "Wordnik API key required."
121
- return
122
- end
123
-
124
- true
125
- end
126
-
127
115
  Lita.register_handler(Wordnik)
128
116
  end
129
117
  end
data/lita-wordnik.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-wordnik"
3
- spec.version = "0.1.0"
3
+ spec.version = "1.0.0"
4
4
  spec.authors = ["Jimmy Cuadra"]
5
5
  spec.email = ["jimmy@jimmycuadra.com"]
6
6
  spec.description = %q{A Lita handler for dictionary functionality backed by Wordnik.}
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
15
  spec.require_paths = ["lib"]
16
16
 
17
- spec.add_runtime_dependency "lita", ">= 2.1"
17
+ spec.add_runtime_dependency "lita", ">= 4.0"
18
18
 
19
19
  spec.add_development_dependency "bundler", "~> 1.3"
20
20
  spec.add_development_dependency "rake"
@@ -3,17 +3,13 @@ require "spec_helper"
3
3
  describe Lita::Handlers::Wordnik, lita_handler: true do
4
4
  let(:response) { double("Faraday::Response", status: 200, body: body) }
5
5
 
6
- it { routes_command("define computer").to(:define) }
7
- it { routes_command("synonyms cold").to(:synonyms) }
8
- it { routes_command("syn cold").to(:synonyms) }
9
- it { routes_command("words like cold").to(:synonyms) }
10
- it { routes_command("antonyms cold").to(:antonyms) }
11
- it { routes_command("ant cold").to(:antonyms) }
12
- it { routes_command("words unlike cold").to(:antonyms) }
13
-
14
- it "sets the API key to nil by default" do
15
- expect(Lita.config.handlers.wordnik.api_key).to be_nil
16
- end
6
+ it { is_expected.to route_command("define computer").to(:define) }
7
+ it { is_expected.to route_command("synonyms cold").to(:synonyms) }
8
+ it { is_expected.to route_command("syn cold").to(:synonyms) }
9
+ it { is_expected.to route_command("words like cold").to(:synonyms) }
10
+ it { is_expected.to route_command("antonyms cold").to(:antonyms) }
11
+ it { is_expected.to route_command("ant cold").to(:antonyms) }
12
+ it { is_expected.to route_command("words unlike cold").to(:antonyms) }
17
13
 
18
14
  context "with Faraday stubbing" do
19
15
  before do
@@ -35,13 +31,8 @@ assembles, stores, correlates, or otherwise processes information.",
35
31
  BODY
36
32
  end
37
33
 
38
- it "replies that the API key is required" do
39
- send_command("define computer")
40
- expect(replies.last).to include("API key required")
41
- end
42
-
43
34
  context "when the API key is set" do
44
- before { Lita.config.handlers.wordnik.api_key = "abc123" }
35
+ before { registry.config.handlers.wordnik.api_key = "abc123" }
45
36
 
46
37
  it "replies with the definition" do
47
38
  send_command("define computer")
@@ -101,7 +92,7 @@ BODY
101
92
  BODY
102
93
  end
103
94
 
104
- before { Lita.config.handlers.wordnik.api_key = "abc123" }
95
+ before { registry.config.handlers.wordnik.api_key = "abc123" }
105
96
 
106
97
  it "replies with synonyms" do
107
98
  send_command("synonyms cold")
@@ -123,7 +114,7 @@ BODY
123
114
  BODY
124
115
  end
125
116
 
126
- before { Lita.config.handlers.wordnik.api_key = "abc123" }
117
+ before { registry.config.handlers.wordnik.api_key = "abc123" }
127
118
 
128
119
  it "replies with antonyms" do
129
120
  send_command("antonyms cold")
data/spec/spec_helper.rb CHANGED
@@ -8,3 +8,5 @@ SimpleCov.start { add_filter "/spec/" }
8
8
 
9
9
  require "lita-wordnik"
10
10
  require "lita/rspec"
11
+
12
+ Lita.version_3_compatibility_mode = false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-wordnik
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Cuadra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-05 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.1'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '2.1'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement