contactually-api 0.0.5 → 0.0.6

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: ad56375cc4f733c53ed4180d476bc435ca6d47eb
4
- data.tar.gz: 368daf75ca9581ca6985c9bb79987789c617960f
3
+ metadata.gz: 5cd7a2066d2e464a598894a236dd4fc7e640fd8c
4
+ data.tar.gz: 54231ef13bfc48b4ca4f05a43839efc4e04bb39c
5
5
  SHA512:
6
- metadata.gz: 065e397609b59b9d0e5c5d6bf2843450e82bbc497863d3abde0ce2202f59efee70ef372412631b1fcc793012b6c07a61aacfb9941817ba9fc1947d060039ccca
7
- data.tar.gz: 9bf5c9fed47a5140b5386de06f3b66fc77960bae25797ecbee0a3cab2bf33df5178081e434276a0444c34bda5618fe6b03376e74a65bf6bde4ab0418c1d140f4
6
+ metadata.gz: 721a6a77ee10988644909cf9f917e40be57d1d535785cd01becc3dfe9426cdf0caea3eb62e47f9bf5468507ff1ab4941c2de761f1f3672c9e2b065f969318b4a
7
+ data.tar.gz: 3501748db20d7c4742549dfd60187047f1e83ae1dd6ba6039823e69b0fca76dd0d8e1560dfac31d332a16dbbec1b42366b9a4635d13991e461a14b305fb39f13
@@ -1,8 +1,8 @@
1
1
  module Contactually
2
2
  class API
3
- def initialize
4
- raise ConfigMissingApiKeyError, 'You must provide a Contactually API key' unless Contactually.config.api_key
5
- @api_key = Contactually.config.api_key
3
+ def initialize(api_key = nil)
4
+ raise ConfigMissingApiKeyError, 'You must provide a Contactually API key' unless Contactually.config.api_key || api_key
5
+ @api_key = Contactually.config.api_key || api_key
6
6
  @base_url = Contactually.config.contactually_url
7
7
  end
8
8
 
@@ -1,3 +1,3 @@
1
1
  module Contactually
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/spec/api_spec.rb CHANGED
@@ -7,6 +7,14 @@ describe Contactually::API do
7
7
  specify do
8
8
  expect{ subject }.to raise_error Contactually::ConfigMissingApiKeyError
9
9
  end
10
+
11
+ it 'allows to supply api key via initialize' do
12
+ expect{ described_class.new('asdf') }.not_to raise_error
13
+ end
14
+
15
+ it 'sets api_key from parameters' do
16
+ expect(described_class.new('asdf').instance_variable_get(:@api_key)).to eq 'asdf'
17
+ end
10
18
  end
11
19
 
12
20
  describe 'valid configuration' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contactually-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Heck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-06 00:00:00.000000000 Z
11
+ date: 2014-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport