mxhero-api 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/directories.rb +1 -1
- data/lib/groups.rb +15 -15
- data/lib/mxhero-api.rb +5 -5
- data/lib/urls.rb +3 -3
- data/mxhero-api.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cce4492502cccbd3a3c52242b7f1264eea971798
|
4
|
+
data.tar.gz: c5e3073a53de2de3b6ce827227e0009abf4d4dda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02af92752b3291a8c7224d7fcd159f71e8288180f5348db5a32f7a6c8b911a6283c76689eff293220ef42626980b6d9b74372ca78faabc3ff8749437ed1b79c0
|
7
|
+
data.tar.gz: 6cd69ed2806d0f2870b2ebc6ddf69d44818d25f8007b763e9aaa14549e02765506e61969be504fb77005d24ee0ac44aa8ddf337508933576aeadae3e0bfa11b1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.7
|
data/lib/directories.rb
CHANGED
data/lib/groups.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require_relative 'communication'
|
3
3
|
require_relative 'urls'
|
4
4
|
|
5
|
-
require 'open-uri'
|
5
|
+
require 'open-uri'
|
6
6
|
require 'delegate'
|
7
7
|
|
8
8
|
module MxHero::API
|
@@ -37,7 +37,7 @@ module MxHero::API
|
|
37
37
|
# @params pagination info. Ex.: page: 2, per_page: 10 or simple page: 2
|
38
38
|
#
|
39
39
|
# @return [PaginatedElement] that contains an array of Group elements
|
40
|
-
# Basically its an Array with instances of [MxHero::API::Group] with the methods total_elements, total_pages and actual_page
|
40
|
+
# Basically its an Array with instances of [MxHero::API::Group] with the methods total_elements, total_pages and actual_page
|
41
41
|
#
|
42
42
|
def all(pagination = { page: nil, per_page: nil })
|
43
43
|
response = call(:get, groups_url(pagination))
|
@@ -49,7 +49,7 @@ module MxHero::API
|
|
49
49
|
# Search available accounts
|
50
50
|
def search_accounts(term)
|
51
51
|
response = call(:get, search_accounts_url(term) ,nil, throw_exception: false)
|
52
|
-
Response.new(response.status, json_parse(response.content))
|
52
|
+
Response.new(response.status, json_parse(response.content))
|
53
53
|
end
|
54
54
|
|
55
55
|
# Save a new group
|
@@ -66,8 +66,8 @@ module MxHero::API
|
|
66
66
|
#
|
67
67
|
# @param group_name [String]
|
68
68
|
#
|
69
|
-
# @return [MxHero::API::Response] with content empty.
|
70
|
-
# In case on error, may be one of the following:
|
69
|
+
# @return [MxHero::API::Response] with content empty.
|
70
|
+
# In case on error, may be one of the following:
|
71
71
|
# + domain.group.not.found : Inexistent group
|
72
72
|
def delete(group_name)
|
73
73
|
response = call(:delete, group_url(group_name), nil, throw_exception: false)
|
@@ -93,8 +93,8 @@ module MxHero::API
|
|
93
93
|
# @param group_name [String]
|
94
94
|
# @param account_name [String]
|
95
95
|
#
|
96
|
-
# @return [MxHero::API::Response] with content empty.
|
97
|
-
# In case on error, may be one of the following:
|
96
|
+
# @return [MxHero::API::Response] with content empty.
|
97
|
+
# In case on error, may be one of the following:
|
98
98
|
# + domain.account.not.found : Inexistent account
|
99
99
|
# + domain.group.account.already.has.group : Try to add an account to a group when already is in that
|
100
100
|
def add_account(group_name, account_name)
|
@@ -105,17 +105,17 @@ module MxHero::API
|
|
105
105
|
# @param group_name [String]
|
106
106
|
# @param account_name [String]
|
107
107
|
#
|
108
|
-
# @return [MxHero::API::Response] with content empty.
|
109
|
-
# In case on error, may be one of the following:
|
108
|
+
# @return [MxHero::API::Response] with content empty.
|
109
|
+
# In case on error, may be one of the following:
|
110
110
|
# + domain.account.not.found : Inexistent account
|
111
111
|
# + domain.group.account.not.in.group : Try to remove an account that is not in the group
|
112
|
-
#
|
112
|
+
#
|
113
113
|
def remove_account(group_name, account_name)
|
114
114
|
response = call(:delete, group_remove_accounts_url(group_name, account_name), nil, throw_exception: false)
|
115
115
|
wrap_response_from response
|
116
116
|
end
|
117
117
|
|
118
|
-
private
|
118
|
+
private
|
119
119
|
|
120
120
|
def paginate_wrap(response, &block)
|
121
121
|
raise 'an error ocurred when try to communicate with the API' if response.status != 200
|
@@ -125,7 +125,7 @@ module MxHero::API
|
|
125
125
|
|
126
126
|
def wrap_response_from(response)
|
127
127
|
content = (200..299).include?(response.code) ? group_from(response) : json_parse(response.content)
|
128
|
-
Response.new(response.status, content)
|
128
|
+
Response.new(response.status, content)
|
129
129
|
end
|
130
130
|
|
131
131
|
def group_from(response)
|
@@ -139,7 +139,7 @@ module MxHero::API
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def groups_url(pagination = {})
|
142
|
-
domain_by_id_url(domain) + 'groups' + pagination_query(pagination)
|
142
|
+
domain_by_id_url(domain) + '/groups' + pagination_query(pagination)
|
143
143
|
end
|
144
144
|
|
145
145
|
def pagination_query(params = { page: nil, per_page: nil })
|
@@ -149,7 +149,7 @@ module MxHero::API
|
|
149
149
|
section << "offset=#{params[:page]}" if params[:page]
|
150
150
|
end.join('&')
|
151
151
|
end
|
152
|
-
|
152
|
+
|
153
153
|
def group_url(group_name)
|
154
154
|
groups_url + "/#{URI::encode(group_name)}"
|
155
155
|
end
|
@@ -161,7 +161,7 @@ module MxHero::API
|
|
161
161
|
def group_add_accounts_url(group_name, account_name)
|
162
162
|
group_accounts_url(group_name) + "/#{account_name}/add"
|
163
163
|
end
|
164
|
-
|
164
|
+
|
165
165
|
def group_remove_accounts_url(group_name, account_name)
|
166
166
|
group_accounts_url(group_name) + "/#{account_name}/remove"
|
167
167
|
end
|
data/lib/mxhero-api.rb
CHANGED
@@ -44,7 +44,7 @@ module MxHero::API
|
|
44
44
|
# @return MxHero::API::Directories
|
45
45
|
def directories(domain)
|
46
46
|
@directories ||= Directories.new(domain, api_url: @service_url,
|
47
|
-
username: @username, password: @password,
|
47
|
+
username: @username, password: @password,
|
48
48
|
verbose: @verbose, as_user: @as_user)
|
49
49
|
end
|
50
50
|
|
@@ -563,11 +563,11 @@ module MxHero::API
|
|
563
563
|
end
|
564
564
|
|
565
565
|
def user_url(user)
|
566
|
-
users_url + "/#{user}
|
566
|
+
users_url + "/#{user}"
|
567
567
|
end
|
568
568
|
|
569
569
|
def user_domains_url(user)
|
570
|
-
user_url(user) + "domains"
|
570
|
+
user_url(user) + "/domains"
|
571
571
|
end
|
572
572
|
|
573
573
|
def users_for_domain_url(domain)
|
@@ -575,7 +575,7 @@ module MxHero::API
|
|
575
575
|
end
|
576
576
|
|
577
577
|
def user_with_domain_url(user,domain)
|
578
|
-
user_url(user) + "domains/#{domain}/"
|
578
|
+
user_url(user) + "/domains/#{domain}/"
|
579
579
|
end
|
580
580
|
|
581
581
|
def user_url_set_password(user,new_password)
|
@@ -651,7 +651,7 @@ module MxHero::API
|
|
651
651
|
|
652
652
|
def accounts_by_domain_url(domain, filter_account = nil)
|
653
653
|
filter = filter_account ? "?account=#{filter_account}" : ''
|
654
|
-
domain_by_id_url(domain) + 'accounts' + filter
|
654
|
+
domain_by_id_url(domain) + '/accounts' + filter
|
655
655
|
end
|
656
656
|
|
657
657
|
def domain_rule_url(domain, id)
|
data/lib/urls.rb
CHANGED
@@ -5,15 +5,15 @@ module MxHero
|
|
5
5
|
def service_url
|
6
6
|
@service_url
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def domains_url
|
10
10
|
service_url + '/domains'
|
11
11
|
end
|
12
12
|
|
13
13
|
def domain_by_id_url(domain)
|
14
|
-
domains_url + "/#{domain}
|
14
|
+
domains_url + "/#{domain}"
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/mxhero-api.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: mxhero-api 1.2.
|
2
|
+
# stub: mxhero-api 1.2.7 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "mxhero-api"
|
6
|
-
s.version = "1.2.
|
6
|
+
s.version = "1.2.7"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Maximiliano Dello Russo", "Juan Pablo Royo", "mxHero"]
|
11
|
-
s.date = "
|
11
|
+
s.date = "2020-05-27"
|
12
12
|
s.description = "A gem to provide easy access to the API of MxHero platform (http://www.mxhero.com/)"
|
13
13
|
s.email = ["maxidr@mxhero.com", "juanpablo.royo@gmail.com", "mxhero@mxhero.com"]
|
14
14
|
s.files = [".gitignore", ".ruby-gemset", ".ruby-version", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "VERSION", "lib/communication.rb", "lib/directories.rb", "lib/dto.rb", "lib/email-sync.rb", "lib/groups.rb", "lib/mxhero-api.rb", "lib/pst-converter.rb", "lib/resource.rb", "lib/resources/account.rb", "lib/resources/domain.rb", "lib/resources/group.rb", "lib/response.rb", "lib/urls.rb", "mxhero-api.gemspec", "test/fixtures/api/account_properties.yml", "test/fixtures/api/account_properties_not_found.yml", "test/fixtures/api/accounts.yml", "test/fixtures/api/accounts_filtered.yml", "test/fixtures/api/accounts_from_domain.yml", "test/fixtures/api/accounts_from_domain_paginated.yml", "test/fixtures/api/accounts_without_group.yml", "test/fixtures/api/add_an_inexistent_account_to_group.yml", "test/fixtures/api/add_and_remove_account.yml", "test/fixtures/api/add_feature.yml", "test/fixtures/api/all_groups.yml", "test/fixtures/api/associate_user_domain.yml", "test/fixtures/api/create_directory.yml", "test/fixtures/api/create_domain.yml", "test/fixtures/api/create_rule_for_domain.yml", "test/fixtures/api/create_user.yml", "test/fixtures/api/delete_directory.yml", "test/fixtures/api/delete_group.yml", "test/fixtures/api/delete_rule.yml", "test/fixtures/api/domain_by_id.yml", "test/fixtures/api/domain_by_id_not_found.yml", "test/fixtures/api/domain_rule.yml", "test/fixtures/api/domains.yml", "test/fixtures/api/emailsync_delete.yml", "test/fixtures/api/emailsync_fetch_all.yml", "test/fixtures/api/emailsync_task_by_id.yml", "test/fixtures/api/fetch_directory.yml", "test/fixtures/api/fetch_user.yml", "test/fixtures/api/ldap_info.yml", "test/fixtures/api/move_to_trial.yml", "test/fixtures/api/pst_inactive_tasks.yml", "test/fixtures/api/refresh_directory.yml", "test/fixtures/api/remove_account_from_group_twice.yml", "test/fixtures/api/remove_inexistente_account_from_group.yml", "test/fixtures/api/rule_status.yml", "test/fixtures/api/rules_for_domain.yml", "test/fixtures/api/rules_for_domain_by_component.yml", "test/fixtures/api/save_group.yml", "test/fixtures/api/search_accounts_starts_with_a.yml", "test/fixtures/api/search_accounts_starts_with_ab.yml", "test/fixtures/api/system_properties.yml", "test/fixtures/api/system_properties_create.yml", "test/fixtures/api/system_properties_element.yml", "test/fixtures/api/test_domain.yml", "test/fixtures/api/update_account_properties.yml", "test/fixtures/api/update_accounts_group_scope.yml", "test/fixtures/api/update_accounts_properties_scope.yml", "test/fixtures/api/update_directory.yml", "test/fixtures/api/update_rule.yml", "test/fixtures/api/update_user.yml", "test/fixtures/api/user_domains.yml", "test/fixtures/api/users_for_domain.yml", "test/fixtures/api/validate_user_credential.yml", "test/fixtures/domain.rb", "test/helper.rb", "test/test_directories.rb", "test/test_domain.rb", "test/test_dto.rb", "test/test_emailsync.rb", "test/test_feature.rb", "test/test_groups.rb", "test/test_mxhero_api.rb", "test/test_mxhero_api_response.rb", "test/test_pst-converter.rb", "test/test_resource.rb"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mxhero-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maximiliano Dello Russo
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-05-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: vcr
|