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: cd30fc4e6783463319ff56fe640bbed0596f79ba3dda2b64220a91885f6f7f74
4
- data.tar.gz: ac500bd5ffb985116bfeae957140a404bc989d5b54a0963ea7288d80866b8138
3
+ metadata.gz: 05db517bcb62361dc0db41ea5801c9dc98a1fbbd7dd9084cc13d7e70e93909eb
4
+ data.tar.gz: 003df3b6f68b8bf8371e2d6385ce2be77a09fbf989be0939c3034de8b0f5e496
5
5
  SHA512:
6
- metadata.gz: cd12a634eb9a246ada90436c956efff9eac149ab048e9bc2496211431587efaa26f95e9e8d7eb3d85de67f4c81c5959a98271365fe2b40849297a918ec5315fc
7
- data.tar.gz: 4a2fd3227794b88274454372811a821fc61debffd8bf9344682a62e771610669c4bd18452577003238511a2690e7baab585a8a7db46df231f66fefb9f15bfa46
6
+ metadata.gz: 53632a244690dd68be58ead6044706396a19426fdcd7bb246f2a9efd5342047c9570d6af6b06b7f39355580f2904f4e6a4f6a3003b1dfc33f44eae9f1176b56a
7
+ data.tar.gz: 1a0b8fbc02652cf5643a7c5f19bdd3cd156ac8eaaecdbeea26bb0e6ada654ace9e3b786bce57b3deb1f8761e7b04845580f308c869161e3dc10b7da623e6d9a8
@@ -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.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-04-18 00:00:00.000000000 Z
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