conduit 0.6.4 → 0.6.5
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 +4 -4
- data/lib/conduit/core/action.rb +0 -26
- data/lib/conduit/core/connection.rb +0 -4
- data/lib/conduit/version.rb +1 -1
- data/spec/classes/core/action_spec.rb +0 -27
- data/spec/spec_helper.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7cf39a8b5a40460f2718e1b91f4bd6f80063d88
|
4
|
+
data.tar.gz: 6648815b5ab817132226aca79e505fd5ef598df6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acbfca131ac308212a6f87350320b2c6ce04fa3d4688169d0b3439245b6427f3a116b7c293b148f906352676e8b741bcfbf74a834d747196daaee1a14ebcfbec
|
7
|
+
data.tar.gz: 69241d1f40d6be02edb49cfe7b7faa485b7bcdabdf0665f1bdf5b43fb9da42fa1b52ad279850dfdef96257a245ffdf4b50d79a70bcf3d926e84da59486ce1b8f
|
data/lib/conduit/core/action.rb
CHANGED
@@ -13,7 +13,6 @@
|
|
13
13
|
#
|
14
14
|
|
15
15
|
require 'active_support/inflector'
|
16
|
-
require 'active_support/core_ext/object/blank'
|
17
16
|
require 'forwardable'
|
18
17
|
require 'ostruct'
|
19
18
|
require 'set'
|
@@ -140,36 +139,11 @@ module Conduit
|
|
140
139
|
# an ArgumentError listing missing attributes
|
141
140
|
#
|
142
141
|
def validate!(options)
|
143
|
-
!missing_required_keys?(options) &&
|
144
|
-
!required_keys_not_present?(options)
|
145
|
-
end
|
146
|
-
|
147
|
-
# Raises an Argument error if any required keys
|
148
|
-
# are not present in the options hash; otherwise
|
149
|
-
# returns false
|
150
|
-
#
|
151
|
-
def missing_required_keys?(options)
|
152
142
|
missing_keys = (requirements.to_a - options.keys)
|
153
143
|
if missing_keys.any?
|
154
144
|
raise ArgumentError,
|
155
145
|
"Missing keys: #{missing_keys.join(', ')}"
|
156
146
|
end
|
157
|
-
false
|
158
|
-
end
|
159
|
-
|
160
|
-
# Raises an Argument error if any required keys
|
161
|
-
# are present in the options hash but have nil values;
|
162
|
-
# otherwise returns false
|
163
|
-
#
|
164
|
-
def required_keys_not_present?(options)
|
165
|
-
required_options_not_present = requirements.reject do |required_key|
|
166
|
-
options[required_key].present?
|
167
|
-
end
|
168
|
-
if required_options_not_present.any?
|
169
|
-
raise ArgumentError,
|
170
|
-
"Nil keys: #{required_options_not_present.join(', ')}"
|
171
|
-
end
|
172
|
-
false
|
173
147
|
end
|
174
148
|
|
175
149
|
# Returns the parser for this action
|
@@ -54,10 +54,6 @@ module Conduit
|
|
54
54
|
raise(Conduit::TimeOut, timeout.message)
|
55
55
|
rescue Excon::Errors::Error => error
|
56
56
|
raise(Conduit::ConnectionError, error.message)
|
57
|
-
rescue SocketError => error
|
58
|
-
msg = 'Could not connect to the server. Please check your internet connection.' +
|
59
|
-
"\n#{error.message}"
|
60
|
-
raise(Conduit::ConnectionError, msg)
|
61
57
|
end
|
62
58
|
|
63
59
|
private
|
data/lib/conduit/version.rb
CHANGED
@@ -40,33 +40,6 @@ shared_examples_for Conduit::Core::Action do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
describe '.new' do
|
44
|
-
it 'should raise an error if any required arguments are not supplied' do
|
45
|
-
expect { described_class.new({}) }.to raise_error(ArgumentError)
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'should raise an error if any required arguments are nil' do
|
49
|
-
options = request_attributes.inject({}) do |h, (k, _v)|
|
50
|
-
h.merge(k => nil)
|
51
|
-
end
|
52
|
-
expect { described_class.new(options) }.to raise_error(ArgumentError)
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'should raise an error if any of the required arguments are blank' do
|
56
|
-
options = request_attributes.inject({}) do |h, (k, _v)|
|
57
|
-
h.merge(k => '')
|
58
|
-
end
|
59
|
-
expect { described_class.new(options) }.to raise_error(ArgumentError)
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'should raise an error if any of the required arguments are empty' do
|
63
|
-
options = request_attributes.inject({}) do |h, (k, _v)|
|
64
|
-
h.merge(k => [])
|
65
|
-
end
|
66
|
-
expect { described_class.new(options) }.to raise_error(ArgumentError)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
43
|
describe '#perform' do
|
71
44
|
before { Excon.stub({}, body: response, status: 200) }
|
72
45
|
|
data/spec/spec_helper.rb
CHANGED
@@ -18,7 +18,7 @@ RSpec.configure do |config|
|
|
18
18
|
config.include Helper
|
19
19
|
|
20
20
|
config.expect_with :rspec do |c|
|
21
|
-
c.syntax =
|
21
|
+
c.syntax = :should
|
22
22
|
end
|
23
23
|
|
24
24
|
config.before(:suite) do
|
@@ -29,4 +29,4 @@ RSpec.configure do |config|
|
|
29
29
|
|
30
30
|
Conduit::Driver.load_drivers
|
31
31
|
end
|
32
|
-
end
|
32
|
+
end
|