connectwise_sdk 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/connectwise/model.rb +3 -1
- data/lib/connectwise/version.rb +1 -1
- data/spec/lib/connectwise/member_spec.rb +6 -0
- 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: 68ac46ac359aa92559aba1978421b651cef0c689
|
4
|
+
data.tar.gz: 2e271efa19715d2a236f0e052b8ec8e94d0c7417
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43098e427e3c46cbbd2a9fbc50517566f1542f5a55056b9c3626921fb5a2495dc6494326ef3608f80c926fc9694f91b3543864bab49ba77b543ac53725db92f8
|
7
|
+
data.tar.gz: 9c1465885322b7696f70da26ad0ec1074dc31f99982a19d4755ae0839428593b0ffe0f70b39493f1d7ea87f50388cf8fcc90814c1d3428cae106bc4e79a6ace8
|
data/lib/connectwise/model.rb
CHANGED
@@ -4,7 +4,9 @@ module Connectwise
|
|
4
4
|
def where(connection, *args, **attrs)
|
5
5
|
conditions = attrs.empty? ? args.join(' ') : attrs_to_query(transform(attrs))
|
6
6
|
resp = connection.call cw_api_name, "find_#{plural_class_name}".to_sym, {conditions: conditions}
|
7
|
-
resp
|
7
|
+
resp = resp.nil? ? [] : remove_root_node(resp)
|
8
|
+
resp = resp.respond_to?(:to_ary) ? resp : [resp]
|
9
|
+
resp.map {|attrs| self.new(connection, find_transform(attrs)) }
|
8
10
|
end
|
9
11
|
|
10
12
|
def find(connection, id)
|
data/lib/connectwise/version.rb
CHANGED
@@ -17,4 +17,10 @@ describe Connectwise::Member do
|
|
17
17
|
expect(response.count).to eq 2
|
18
18
|
expect(response.first.class).to eq Connectwise::Member
|
19
19
|
end
|
20
|
+
|
21
|
+
it 'finds a single member using string syntax' do
|
22
|
+
response = subject.where(conn, "MemberID='admin1'")
|
23
|
+
expect(response.count).to eq 1
|
24
|
+
expect(response.first.class).to eq Connectwise::Member
|
25
|
+
end
|
20
26
|
end
|