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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9347098835245913fdd9bf543c03fdb21b105c9e
4
- data.tar.gz: 96829346edad9c8b3d446b82cd4fef7bf8651363
3
+ metadata.gz: ecae092953989984e4c4f514812e0420614662f9
4
+ data.tar.gz: 0f7df402005cfc6822bbaf840ebe2168e7421b20
5
5
  SHA512:
6
- metadata.gz: f8400961bd2636f1236d3fd18a57ef3f70fdb4e4adf9919307bda1deb12638cfd678429a12fad3472f649c8b1d9c3f35480dc7ae7b03e28310ef32ca61296063
7
- data.tar.gz: be613cb18fb305f2ce3387239f31c330f9dc20f67a9d5977248a25cb411b2e607d640bce1b4219746b88ca40f222daa8617d5b1fcd934ee8ea24d2551a0190fa
6
+ metadata.gz: 056846dbfbe2d35a410b88bf70b06bc90138afa636b556ff142cca978b9331b7d85d4627d604b9187a71de0cf49819404928fe7afc7bc3fdcea217652c180249
7
+ data.tar.gz: d37b28cf9f8e17edc17f07d3699345207e52c1cd964bff2dd409311953cc67f0b85d8702beb87dfa27d281f30a283fc5666070ebd07a87fbec243dbdcba97ab8
@@ -0,0 +1,10 @@
1
+ module WhatIs
2
+ class Configuration
3
+ attr_accessor :thesaurus_api_key, :dictionary_api_key
4
+
5
+ def initialize
6
+ @thesaurus_api_key = "invalid"
7
+ @dictionary_api_key = "invalid"
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module WhatIs
2
- VERSION = "0.1.1"
2
+ VERSION = "1.0.0"
3
3
  end
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
- DICT_API_KEY = "ae396fba-2435-4197-b780-c4b5485fec22"
9
- THES_API_KEY = "c80b99cc-421c-4f86-bc50-45ef40b371fe"
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=#{THES_API_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.1.1
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