oi-api-ruby 0.1.1 → 0.1.2

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: 3ec2819523ef00444ce014ef43cc6d24f1f0fea5
4
- data.tar.gz: ced108a991f7395a937252c34cd0edc1a3c6de16
3
+ metadata.gz: 331e2380c3556f84eb25fb38cc598b8de68d0c28
4
+ data.tar.gz: 96469b608941b68503fd04d82346411c673b09e8
5
5
  SHA512:
6
- metadata.gz: 3bf83a170f596a3362128294bd45c7d80b82d85da6edbba9ec2641b51e4176fe8fa4a885678361f1f3e608badcf07b9244fda6ebb0cbf3c61057065228967388
7
- data.tar.gz: 9101956f704cbb75962cffdac3b45b1a789b5d8552dceef494d60adf748c42488388d9283ee0f83f251bb48b6cab913a69b6f5264d0a1e3221fba59e3e715a99
6
+ metadata.gz: e133c3c7ee6a8b6779759ca454f293aafa0fd4e3035095d36bcc3862119330c54dc056031babe02170fe5306ed6b71a51e521b411e44c31d3526bd20667804be
7
+ data.tar.gz: 1a3fd7712c12498a32c290d4c5f66a84b24ab5c2f9b24d4164360c350633f811e42a6cb4217658cacf43ecd50be49582d4f77e3382df590a2503d6f6fd40d314
@@ -9,6 +9,7 @@ require 'oi_api/client/offers'
9
9
  require 'oi_api/client/data_transfers'
10
10
  require 'oi_api/client/auto_responders'
11
11
  require 'oi_api/client/reports'
12
+ require 'oi_api/errors'
12
13
 
13
14
  module OiApi
14
15
 
@@ -39,6 +40,10 @@ module OiApi
39
40
  public_send("#{key}=", merged_options[key])
40
41
  end
41
42
 
43
+ if username.nil? || password.nil?
44
+ raise NoCredentialsError, 'you must provide a username and password'
45
+ end
46
+
42
47
  # set base_uri and format via HTTParty class methods
43
48
  self.class.base_uri(api_endpoint)
44
49
  self.class.format(format)
@@ -0,0 +1,5 @@
1
+ module OiApi
2
+
3
+ class NoCredentialsError < StandardError; end;
4
+
5
+ end
@@ -1,3 +1,3 @@
1
1
  module OiApi
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -6,6 +6,10 @@ RSpec.describe OiApi do
6
6
  expect(OiApi::VERSION).to be_instance_of(String)
7
7
  end
8
8
 
9
+ it 'raises an error when instantiated with no username and password' do
10
+ expect { OiApi.new }.to raise_error(OiApi::NoCredentialsError)
11
+ end
12
+
9
13
  context 'configuration' do
10
14
 
11
15
  context '.username' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oi-api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarrod Spillers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-01 00:00:00.000000000 Z
11
+ date: 2015-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -150,6 +150,7 @@ files:
150
150
  - lib/oi_api/client/reports.rb
151
151
  - lib/oi_api/client/subscriptions.rb
152
152
  - lib/oi_api/configuration.rb
153
+ - lib/oi_api/errors.rb
153
154
  - lib/oi_api/lookup_tables.rb
154
155
  - lib/oi_api/version.rb
155
156
  - oi-api-ruby.gemspec