hypertrack 0.2.2 → 0.2.3
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05db517bcb62361dc0db41ea5801c9dc98a1fbbd7dd9084cc13d7e70e93909eb
|
4
|
+
data.tar.gz: 003df3b6f68b8bf8371e2d6385ce2be77a09fbf989be0939c3034de8b0f5e496
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53632a244690dd68be58ead6044706396a19426fdcd7bb246f2a9efd5342047c9570d6af6b06b7f39355580f2904f4e6a4f6a3003b1dfc33f44eae9f1176b56a
|
7
|
+
data.tar.gz: 1a0b8fbc02652cf5643a7c5f19bdd3cd156ac8eaaecdbeea26bb0e6ada654ace9e3b786bce57b3deb1f8761e7b04845580f308c869161e3dc10b7da623e6d9a8
|
data/lib/hypertrack.rb
CHANGED
@@ -15,6 +15,7 @@ require_relative "hypertrack/api_operations/common/nearby"
|
|
15
15
|
require_relative "hypertrack/api_operations/common/retrieve"
|
16
16
|
require_relative "hypertrack/api_operations/common/list"
|
17
17
|
require_relative "hypertrack/api_operations/common/update"
|
18
|
+
require_relative "hypertrack/api_operations/common/retrieve_by_unique_id"
|
18
19
|
require_relative "hypertrack/api_operations/user_api"
|
19
20
|
require_relative "hypertrack/api_operations/action_api"
|
20
21
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module HyperTrack
|
2
|
+
module ApiOperations
|
3
|
+
module Common
|
4
|
+
module RetrieveByUniqueId
|
5
|
+
|
6
|
+
def retrieve_by_unique_id(id)
|
7
|
+
raise HyperTrack::InvalidParameters.new("unique_id is required to retrieve a #{self.name}") unless valid_retrieve_id?(id)
|
8
|
+
|
9
|
+
retrieve_customer_path = "#{get_class_name::API_BASE_PATH}?lookup_id=#{id}"
|
10
|
+
result = HyperTrack::ApiClient.fetch(retrieve_customer_path)
|
11
|
+
|
12
|
+
unless result["count"]
|
13
|
+
raise HyperTrack::UnknownError.new("Unexpected response: " + result.inspect)
|
14
|
+
end
|
15
|
+
if result["count"] == 1
|
16
|
+
return get_class_name.new(result["results"][0]["id"], result["results"][0])
|
17
|
+
else
|
18
|
+
raise HyperTrack::ResourceNotFound.new("Found " + result["count"].to_s + " users with unique_id = " + id)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def valid_retrieve_id?(id)
|
25
|
+
!Util.blank?(id)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -4,6 +4,7 @@ module HyperTrack
|
|
4
4
|
extend HyperTrack::ApiOperations::Common::Retrieve
|
5
5
|
extend HyperTrack::ApiOperations::Common::List
|
6
6
|
extend HyperTrack::ApiOperations::Common::Nearby
|
7
|
+
extend HyperTrack::ApiOperations::Common::RetrieveByUniqueId
|
7
8
|
include HyperTrack::ApiOperations::Common::Patch
|
8
9
|
include HyperTrack::ApiOperations::Common::Get
|
9
10
|
include HyperTrack::ApiOperations::Common::Update
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hypertrack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Utsav Kesharwani
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-08-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- lib/hypertrack/api_operations/common/nearby.rb
|
43
43
|
- lib/hypertrack/api_operations/common/patch.rb
|
44
44
|
- lib/hypertrack/api_operations/common/retrieve.rb
|
45
|
+
- lib/hypertrack/api_operations/common/retrieve_by_unique_id.rb
|
45
46
|
- lib/hypertrack/api_operations/common/update.rb
|
46
47
|
- lib/hypertrack/api_operations/user_api.rb
|
47
48
|
- lib/hypertrack/errors/hypertrack_errors.rb
|