softwear-lib 1.5.5 → 1.5.6
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/softwear/auth/model.rb +21 -1
- data/lib/softwear/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 557217d84e460a14db3f2e7fdaa3f8d23baab04b
|
4
|
+
data.tar.gz: 6ed4d9f028f3e2ff0ed9a82f0a881531d8f53be1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50776b3c2a6b20ad8c6a817e9924b5ee183d39f887bab0106a763d8fdfa593bbefb0f8aa16e9dc8414f94f2c1a958f2ead01d686da635046afb40968dadc905b
|
7
|
+
data.tar.gz: 599f451f5d2102733836e5c43c3aade4b70e578dde3ee5db92e214295b82f22943cc976623cf465dfc2d57afaca6afbf99d5bbefdefb56046aa02411676787b9
|
data/lib/softwear/auth/model.rb
CHANGED
@@ -161,7 +161,7 @@ module Softwear
|
|
161
161
|
@default_socket.puts message
|
162
162
|
end
|
163
163
|
|
164
|
-
return default_socket.gets.chomp
|
164
|
+
return default_socket.gets.try(:chomp) || (raise AuthServerError, "Nil socket response?")
|
165
165
|
|
166
166
|
rescue Errno::ECONNREFUSED => e
|
167
167
|
raise AuthServerDown, "Unable to connect to the authentication server."
|
@@ -310,6 +310,26 @@ module Softwear
|
|
310
310
|
end
|
311
311
|
end
|
312
312
|
|
313
|
+
def filter_all(method, options)
|
314
|
+
all.send(method) do |user|
|
315
|
+
options.all? { |field, wanted_value| user.send(field) == wanted_value }
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
# ====================
|
320
|
+
# Finds a user with the given attributes (just queries for 'all' and uses ruby filters)
|
321
|
+
# ====================
|
322
|
+
def find_by(options)
|
323
|
+
filter_all(:find, options)
|
324
|
+
end
|
325
|
+
|
326
|
+
# ====================
|
327
|
+
# Finds users with the given attributes (just queries for 'all' and uses ruby filters)
|
328
|
+
# ====================
|
329
|
+
def where(options)
|
330
|
+
filter_all(:select, options)
|
331
|
+
end
|
332
|
+
|
313
333
|
# ====================
|
314
334
|
# Returns an array of all registered users
|
315
335
|
# ====================
|
data/lib/softwear/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: softwear-lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nigel Baillie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|