what_is 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/what_is/configuration.rb +10 -0
- data/lib/what_is/version.rb +1 -1
- data/lib/what_is.rb +13 -3
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecae092953989984e4c4f514812e0420614662f9
|
4
|
+
data.tar.gz: 0f7df402005cfc6822bbaf840ebe2168e7421b20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 056846dbfbe2d35a410b88bf70b06bc90138afa636b556ff142cca978b9331b7d85d4627d604b9187a71de0cf49819404928fe7afc7bc3fdcea217652c180249
|
7
|
+
data.tar.gz: d37b28cf9f8e17edc17f07d3699345207e52c1cd964bff2dd409311953cc67f0b85d8702beb87dfa27d281f30a283fc5666070ebd07a87fbec243dbdcba97ab8
|
data/lib/what_is/version.rb
CHANGED
data/lib/what_is.rb
CHANGED
@@ -1,12 +1,22 @@
|
|
1
1
|
require "what_is/version"
|
2
|
+
require "what_is/configuration"
|
2
3
|
require "net/http"
|
3
4
|
require "uri"
|
4
5
|
require "nokogiri"
|
5
6
|
|
6
7
|
module WhatIs
|
7
8
|
class Define
|
8
|
-
|
9
|
-
|
9
|
+
class << self
|
10
|
+
attr_writer :configuration
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.configuration
|
14
|
+
@configuration ||= Configuration.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.configure
|
18
|
+
yield(configuration)
|
19
|
+
end
|
10
20
|
|
11
21
|
def initialize(word)
|
12
22
|
@word = word.to_s
|
@@ -14,7 +24,7 @@ module WhatIs
|
|
14
24
|
end
|
15
25
|
|
16
26
|
def define!
|
17
|
-
thesaurus_endpoint = "http://www.dictionaryapi.com/api/v1/references/thesaurus/xml/#{@word}?key=#{
|
27
|
+
thesaurus_endpoint = "http://www.dictionaryapi.com/api/v1/references/thesaurus/xml/#{@word}?key=#{WhatIs.configuration.thesaurus_api_key}"
|
18
28
|
uri = URI.parse(thesaurus_endpoint)
|
19
29
|
response = Net::HTTP.get_response(uri)
|
20
30
|
doc = Nokogiri::XML(response.body)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: what_is
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Chavez
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- README.md
|
81
81
|
- Rakefile
|
82
82
|
- lib/what_is.rb
|
83
|
+
- lib/what_is/configuration.rb
|
83
84
|
- lib/what_is/version.rb
|
84
85
|
- spec/lib/what_is_spec.rb
|
85
86
|
- spec/spec_helper.rb
|