samanage 1.7.6 → 1.7.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2dcaf45e80af6697cc02ed71271c47f35cafbaba
4
- data.tar.gz: adbb18edb16566748da8bd0d10f2659fb1989fb8
3
+ metadata.gz: cb12b546eb1a488af322ae25c1dce8e292482ea2
4
+ data.tar.gz: 34224322612da1dae4e2b7935bff25ac3a7270e8
5
5
  SHA512:
6
- metadata.gz: 253b6ed89aa71a09502d8feb86bb656aec49c9296a67263312778dcb64cf21ecd6573ebe0ed5a5a16f7e882cc8cbe4c8cd4348374e9db5ddd18ca0aa104a36a7
7
- data.tar.gz: 8d46136866bb6db7bd66c91ef07dffe589c32693acd01456e40891de62bf1caa1134b6cddfe65501c3220f50ae4348253b3fdb0c42c53c1609c8348fe4881f99
6
+ metadata.gz: 42b13f09b7c0a63c6cbf63f52de097538b7256246c3241802eb5bbbb103fcfdc76389cdc017342bedb386c021b6b6b39bd13a83aacf11f22476af964f8303a15
7
+ data.tar.gz: f03fcca29bb64cc26b5b2080b6efc9f41e5e3818c5c77d023ea4e3c5e5f79e8e7bca74cb487958e13bb505c2ff042d10aec86819b2ca3208a9ece87a2bd4ef8b
@@ -1,7 +1,6 @@
1
1
  module Samanage
2
2
  class Api
3
3
 
4
-
5
4
  # Get users, using URL builder
6
5
  def get_users(path: PATHS[:user], options: {})
7
6
  url = Samanage::UrlBuilder.new(path: path, options: options).url
@@ -26,21 +25,21 @@ module Samanage
26
25
  end
27
26
 
28
27
  # Return user by ID
29
- def find_user(id: nil)
28
+ def find_user(id: nil)
30
29
  path = "users/#{id}.json"
31
30
  self.execute(path: path)
32
31
  end
33
32
 
34
33
  # Email is unique so compare first for exact match only. Returns nil or the id
35
- def find_user_id_by_email(email: nil)
34
+ def find_user_id_by_email(email: )
36
35
  api_call = self.check_user(value: email)
37
- api_call.dig(:data).first.to_h.dig('email').to_s.downcase == email.to_s.downcase ? api_call.dig(:data).first.dig('id') : nil
36
+ api_call.dig(:data).select{|u| u['email'].to_s.downcase == email.to_s.downcase}.first['id']
38
37
  end
39
38
 
40
39
  # Returns nil if no matching group_id
41
- def find_user_group_id_by_email(email: nil)
40
+ def find_user_group_id_by_email(email: )
42
41
  user = self.check_user(value: email)
43
- group_ids = user[:data].select{|u| u['email'] == email}.first['group_ids']
42
+ group_ids = user[:data].select{|u| u['email'].to_s.downcase == email.to_s.downcase}.first['group_ids']
44
43
  group_ids.each do |group_id|
45
44
  group = self.find_group(id: group_id)
46
45
  if group[:data]['is_user'] && email == group[:data]['email']
data/samanage.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  $:.push File.expand_path("../lib", __FILE__)
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'samanage'
4
- s.version = '1.7.6'
4
+ s.version = '1.7.7'
5
5
  s.date = Date.today.strftime("%Y-%m-%d")
6
6
  s.summary = "Samanage Ruby Gem"
7
7
  s.description = "Connect to Samanage using Ruby!"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: samanage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.6
4
+ version: 1.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Walls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-06 00:00:00.000000000 Z
11
+ date: 2017-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty