samanage 1.8.0 → 1.8.1

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
  SHA1:
3
- metadata.gz: 9d70a2a85e1f7606feeb1ba847efa75067eb79e8
4
- data.tar.gz: 6d66b498fbbe47bcb48d2202718273a3bd462664
3
+ metadata.gz: 0ab1208aa59cadeb2047f640bb87445bdc5f4cf1
4
+ data.tar.gz: e007b60853fcfaf54476344234e95ba0ab790942
5
5
  SHA512:
6
- metadata.gz: 57efde3151897203323b7545db3892a0d0ccf733cadfda29b61c6bd9e9f596d284e1e4808319717ed4e731771b19c4d594d5e68f4bfcc11d134813e4fb47317d
7
- data.tar.gz: 7db1d6ee21585b792de8584ca07260dc31d6c58cc73f9298e17801a53327d568c8821fb51b28508528af9456743c0f9f1c36e3dfa23aeffe93e169230884135c
6
+ metadata.gz: 0e599dcce813c29db9589801a5b37dff279bf7803e600421ea7e99f9e93d2f0a89a683bb436086b81968fbbf979068f8f16b45a53e1f3bd720991d3e3c7c20aa
7
+ data.tar.gz: b5b485f16acfdf1f891e3c686392c80baac640579a1edcdbb0188f767790b4a30f377c963149e9499d82a8e40c64e7ae13f531cdf94e2624b2fa75bd0e836ece
data/changelog.md CHANGED
@@ -1,3 +1,7 @@
1
+ #1.8.1
2
+ - More flexible membership adding
3
+ - Collection method aliasing for simpler api
4
+
1
5
  #1.8.0
2
6
  - Adding coverage for invalid api requests
3
7
 
data/lib/samanage.rb CHANGED
@@ -2,20 +2,21 @@ $LOAD_PATH << File.dirname(__FILE__)
2
2
  require 'httparty'
3
3
 
4
4
  require 'samanage/api'
5
- require 'samanage/api/users'
6
- require 'samanage/api/requester'
7
- require 'samanage/api/hardwares'
8
- require 'samanage/api/other_assets'
9
- require 'samanage/api/mobiles'
10
- require 'samanage/api/incidents'
11
5
  require 'samanage/api/comments'
12
6
  require 'samanage/api/custom_fields'
13
7
  require 'samanage/api/custom_forms'
8
+ require 'samanage/api/departments'
14
9
  require 'samanage/api/groups'
10
+ require 'samanage/api/hardwares'
11
+ require 'samanage/api/incidents'
12
+ require 'samanage/api/mobiles'
13
+ require 'samanage/api/other_assets'
14
+ require 'samanage/api/requester'
15
15
  require 'samanage/api/sites'
16
- require 'samanage/api/departments'
16
+ require 'samanage/api/users'
17
17
  require 'samanage/error'
18
18
  require 'samanage/url_builder'
19
- module Samanage
20
19
 
20
+ module Samanage
21
+ VERSION = '1.8.1'
21
22
  end
@@ -27,5 +27,7 @@ module Samanage
27
27
  end
28
28
  comments
29
29
  end
30
+
31
+ alias_method :comments, :collect_comments
30
32
  end
31
33
  end
@@ -18,5 +18,8 @@ module Samanage
18
18
  end
19
19
  custom_fields
20
20
  end
21
+
22
+
23
+ alias_method :custom_fields, :collect_custom_fields
21
24
  end
22
25
  end
@@ -39,5 +39,7 @@ module Samanage
39
39
  end
40
40
  self.custom_forms[object_type]
41
41
  end
42
+
43
+ alias_method :custom_forms, :collect_custom_forms
42
44
  end
43
45
  end
@@ -19,5 +19,8 @@ module Samanage
19
19
  def create_department(payload: nil, options: {})
20
20
  self.execute(path: PATHS[:department], http_method: 'post', payload: payload)
21
21
  end
22
+
23
+
24
+ alias_method :departments, :collect_departments
22
25
  end
23
26
  end
@@ -32,10 +32,13 @@ module Samanage
32
32
  self.execute(path: path)
33
33
  end
34
34
 
35
- def add_member_to_group(email: nil, group_id: nil)
35
+ def add_member_to_group(email: nil, group_id: nil, group_name: nil)
36
+ group_id = group_id ||= self.find_group_id_by_name(group: group_name)
36
37
  user_id = self.find_user_id_by_email(email: email)
37
38
  member_path = "memberships.json?group_id=#{group_id}.json&user_ids=#{user_id}"
38
39
  self.execute(path: member_path, http_method: 'post')
39
40
  end
41
+ alias_method :groups, :collect_groups
42
+
40
43
  end
41
44
  end
@@ -48,5 +48,7 @@ module Samanage
48
48
  path = "hardwares/#{id}.json"
49
49
  self.execute(path: path, http_method: 'put', payload: payload)
50
50
  end
51
+
52
+ alias_method :hardwares, :collect_hardwares
51
53
  end
52
54
  end
@@ -37,5 +37,8 @@ module Samanage
37
37
  path = "incidents/#{id}.json"
38
38
  self.execute(path: path, http_method: 'put', payload: payload)
39
39
  end
40
+
41
+
42
+ alias_method :incidents, :collect_incidents
40
43
  end
41
44
  end
@@ -41,5 +41,8 @@ module Samanage
41
41
  path = "mobiles/#{id}.json"
42
42
  self.execute(path: path, http_method: 'put', payload: payload)
43
43
  end
44
+
45
+
46
+ alias_method :mobiles, :collect_mobiles
44
47
  end
45
48
  end
@@ -38,5 +38,9 @@ module Samanage
38
38
  path = "other_assets/#{id}.json"
39
39
  self.execute(path: path, http_method: 'put', payload: payload)
40
40
  end
41
+
42
+
43
+
44
+ alias_method :other_assets, :collect_other_assets
41
45
  end
42
46
  end
@@ -19,5 +19,7 @@ module Samanage
19
19
  def create_site(payload: nil, options: {})
20
20
  self.execute(path: PATHS[:site], http_method: 'post', payload: payload)
21
21
  end
22
+
23
+ alias_method :sites, :collect_sites
22
24
  end
23
25
  end
@@ -63,5 +63,7 @@ module Samanage
63
63
  path = "users/#{id}.json"
64
64
  self.execute(path: path, http_method: 'put', payload: payload)
65
65
  end
66
+
67
+ alias_method :users, :collect_users
66
68
  end
67
69
  end
data/samanage.gemspec CHANGED
@@ -1,7 +1,9 @@
1
1
  $:.push File.expand_path("../lib", __FILE__)
2
+ require 'samanage'
3
+
2
4
  Gem::Specification.new do |s|
3
5
  s.name = 'samanage'
4
- s.version = '1.8.0'
6
+ s.version = Samanage::VERSION
5
7
  s.date = Date.today.strftime("%Y-%m-%d")
6
8
  s.summary = "Samanage Ruby Gem"
7
9
  s.description = "Connect to Samanage using Ruby!"
@@ -104,7 +104,6 @@ describe Samanage::Api do
104
104
 
105
105
 
106
106
 
107
-
108
107
  it 'update_user: update_user by id' do
109
108
  users = @controller.collect_users
110
109
  sample_id = users.sample['id']
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.8.0
4
+ version: 1.8.1
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-13 00:00:00.000000000 Z
11
+ date: 2017-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty