mxhero-api 0.1.35 → 0.1.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/VERSION +1 -1
- data/lib/mxhero-api.rb +16 -0
- data/mxhero-api.gemspec +5 -5
- data/test/fixtures/api/users_for_domain.yml +41 -0
- data/test/test_mxhero_api.rb +9 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGMzNjA3NmVhMGZhMzUxYzQzMGI5MmIzYWM5NTM5Yjk0YjY4MDA4YQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjdkYTAxMDIyNjNjMDVkOTM4MTdjMzI3MWVhNWFjMGEyZDQyODM2Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjMzMDBmOTlhZjk0MDgwMTI4OTI2YjIwYTYyZjYyMDRkODM0NGYyOTlmODNh
|
10
|
+
NGM2YmNmMzhkN2FjMmJkM2FhZGFjNzdmYjNkMWQ1OGU3OWNlMWRkMjdhNDBm
|
11
|
+
MzJhNDE3YWRiNDVlYzM3ZDQwNjM2YjJjMmQ2OTZmYjQwZjNlMDQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2JkYTFhMDgyMWZjMDA0NGQxNDhlNWIxNDRjY2M3MDNhMjllOWVlMmYyNDU1
|
14
|
+
NzNhYWQ3N2Y0Y2Q1MjBhYzdjMWE5MTE0ZmUzZjc4NWI0Zjk1YTM4M2IxYzE3
|
15
|
+
ZmE5ODE2MGUzZDIxYjM5ODY5OWNhYTBkMTYzMjIxMWE4M2U1MzA=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.36
|
data/lib/mxhero-api.rb
CHANGED
@@ -413,6 +413,18 @@ module MxHero::API
|
|
413
413
|
parse_response(response).success?
|
414
414
|
end
|
415
415
|
|
416
|
+
# Obtain the list of users admin in a specific domain
|
417
|
+
# @return [Array<UserVO>|nil] when there is no users for that domain.
|
418
|
+
# If the domain doesn't exist then return nil
|
419
|
+
def users_for_domain(domain)
|
420
|
+
users = nil
|
421
|
+
response = call(:get, users_for_domain_url(domain), throw_exception: false)
|
422
|
+
if response.status == 200
|
423
|
+
users = json_parse(response.content)
|
424
|
+
end
|
425
|
+
users
|
426
|
+
end
|
427
|
+
|
416
428
|
# Obtain the list of domains to one user
|
417
429
|
# @return [Array<String>|nil] when the user exist but don't have domains the list is empty.
|
418
430
|
# If the user isn't exist then return nil
|
@@ -495,6 +507,10 @@ module MxHero::API
|
|
495
507
|
user_url(user) + "domains"
|
496
508
|
end
|
497
509
|
|
510
|
+
def users_for_domain_url(domain)
|
511
|
+
users_url + "/domain/#{domain}/"
|
512
|
+
end
|
513
|
+
|
498
514
|
# Fetch an element from an URL. That element maybe not found
|
499
515
|
# @return a Hash when the element exist. Or return nil when not found.
|
500
516
|
#
|
data/mxhero-api.gemspec
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: mxhero-api 0.1.
|
2
|
+
# stub: mxhero-api 0.1.36 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "mxhero-api"
|
6
|
-
s.version = "0.1.
|
6
|
+
s.version = "0.1.36"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.authors = ["Maximiliano Dello Russo", "Juan Pablo Royo", "mxHero"]
|
10
|
-
s.date = "2014-11-
|
10
|
+
s.date = "2014-11-12"
|
11
11
|
s.description = "A gem to provide easy access to the API of MxHero platform (http://www.mxhero.com/)"
|
12
12
|
s.email = ["maxidr@mxhero.com", "juanpablo.royo@gmail.com", "mxhero@mxhero.com"]
|
13
|
-
s.files = [".gitignore", ".ruby-gemset", ".ruby-version", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "VERSION", "lib/communication.rb", "lib/directories.rb", "lib/dto.rb", "lib/groups.rb", "lib/mxhero-api.rb", "lib/resource.rb", "lib/resources/account.rb", "lib/resources/domain.rb", "lib/resources/group.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/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/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/refresh_directory.yml", "test/fixtures/api/remove_account_from_group_twice.yml", "test/fixtures/api/remove_inexistente_account_from_group.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/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/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_feature.rb", "test/test_groups.rb", "test/test_mxhero_api.rb", "test/test_mxhero_api_response.rb", "test/test_resource.rb"]
|
13
|
+
s.files = [".gitignore", ".ruby-gemset", ".ruby-version", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "VERSION", "lib/communication.rb", "lib/directories.rb", "lib/dto.rb", "lib/groups.rb", "lib/mxhero-api.rb", "lib/resource.rb", "lib/resources/account.rb", "lib/resources/domain.rb", "lib/resources/group.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/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/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/refresh_directory.yml", "test/fixtures/api/remove_account_from_group_twice.yml", "test/fixtures/api/remove_inexistente_account_from_group.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/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_feature.rb", "test/test_groups.rb", "test/test_mxhero_api.rb", "test/test_mxhero_api_response.rb", "test/test_resource.rb"]
|
14
14
|
s.homepage = "http://github.com/mxhero/mxhero-api"
|
15
15
|
s.licenses = ["GPL-3"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubygems_version = "2.1.9"
|
18
18
|
s.summary = "A MxHero API client for ruby"
|
19
|
-
s.test_files = ["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/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/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/refresh_directory.yml", "test/fixtures/api/remove_account_from_group_twice.yml", "test/fixtures/api/remove_inexistente_account_from_group.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/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/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_feature.rb", "test/test_groups.rb", "test/test_mxhero_api.rb", "test/test_mxhero_api_response.rb", "test/test_resource.rb"]
|
19
|
+
s.test_files = ["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/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/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/refresh_directory.yml", "test/fixtures/api/remove_account_from_group_twice.yml", "test/fixtures/api/remove_inexistente_account_from_group.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/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_feature.rb", "test/test_groups.rb", "test/test_mxhero_api.rb", "test/test_mxhero_api_response.rb", "test/test_resource.rb"]
|
20
20
|
|
21
21
|
if s.respond_to? :specification_version then
|
22
22
|
s.specification_version = 4
|
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/users/domain/mxhero.com/
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic YWRtaW46bXgraGVybw==
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: !binary |-
|
20
|
+
T0s=
|
21
|
+
headers:
|
22
|
+
!binary "U2VydmVy":
|
23
|
+
- !binary |-
|
24
|
+
QXBhY2hlLUNveW90ZS8xLjE=
|
25
|
+
!binary "Q29udGVudC1UeXBl":
|
26
|
+
- !binary |-
|
27
|
+
YXBwbGljYXRpb24vanNvbg==
|
28
|
+
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
29
|
+
- !binary |-
|
30
|
+
Y2h1bmtlZA==
|
31
|
+
!binary "RGF0ZQ==":
|
32
|
+
- !binary |-
|
33
|
+
V2VkLCAxMiBOb3YgMjAxNCAxNzoxODoyMiBHTVQ=
|
34
|
+
body:
|
35
|
+
encoding: US-ASCII
|
36
|
+
string: ! '[{"name":"test5@mxhero.com","lastName":"test2","notifyEmail":"test2@mxhero.com","userName":"test5@mxhero.com","created":1388066459000,"locale":"en_US","password":"81dc9bdb52d04dc20036dbd8313ed055","enabled":true,"authorities":null,"domains":null,"metadata":null},{"name":"mxHero","lastName":"Inc","notifyEmail":"mxhero@mxhero.com","userName":"mxhero@mxhero.com","created":1390251575000,"locale":"en_US","password":"81dc9bdb52d04dc20036dbd8313ed055","enabled":true,"authorities":null,"domains":null,"metadata":null},{"name":"Alex","lastName":"Panagides","notifyEmail":"alex@mxhero.com","userName":"alex@mxhero.com","created":1390588614000,"locale":"en_US","password":"81dc9bdb52d04dc20036dbd8313ed055","enabled":true,"authorities":null,"domains":null,"metadata":null},{"name":"Marcelo","lastName":"Marmol","notifyEmail":"mmarmol@mxhero.com","userName":"mmarmol@mxhero.com","created":1391433969000,"locale":"en_US","password":"5f4dcc3b5aa765d61d8327deb882cf99","enabled":true,"authorities":null,"domains":null,"metadata":null},{"name":"Bruno","lastName":"Santos","notifyEmail":"bruno@mxhero.com","userName":"bruno@mxhero.com","created":1391535026000,"locale":"en_US","password":"81dc9bdb52d04dc20036dbd8313ed055","enabled":true,"authorities":null,"domains":null,"metadata":null},{"name":"Juan
|
37
|
+
Pablo","lastName":"Royo","notifyEmail":"jproyo@mxhero.com","userName":"jproyo@mxhero.com","created":1391718582000,"locale":"en_US","password":"33f655fa8127b5534f26ed46c807f6bd","enabled":true,"authorities":null,"domains":null,"metadata":null},{"name":"Marcela","lastName":"Beresiarte","notifyEmail":"mberesiarte@mxhero.com","userName":"mberesiarte@mxhero.com","created":1403722660000,"locale":"en_US","password":"4885084f621fc3f6507d0c8d732543f5","enabled":true,"authorities":null,"domains":null,"metadata":null},{"name":"jason","lastName":"powers","notifyEmail":"jason@mxhero.com","userName":"jason@mxhero.com","created":1412794400000,"locale":"en_US","password":"d41d8cd98f00b204e9800998ecf8427e","enabled":true,"authorities":null,"domains":null,"metadata":null},{"name":"Maxi","lastName":"Dello
|
38
|
+
Russo","notifyEmail":"maxidr@mxhero.com","userName":"maxidr@mxhero.com","created":1415629345000,"locale":"en_US","password":"d41d8cd98f00b204e9800998ecf8427e","enabled":true,"authorities":null,"domains":null,"metadata":null}]'
|
39
|
+
http_version:
|
40
|
+
recorded_at: Wed, 12 Nov 2014 17:18:22 GMT
|
41
|
+
recorded_with: VCR 2.5.0
|
data/test/test_mxhero_api.rb
CHANGED
@@ -341,6 +341,15 @@ class MxHeroAPITest < MiniTest::Unit::TestCase
|
|
341
341
|
end
|
342
342
|
end
|
343
343
|
|
344
|
+
def test_users_for_domain
|
345
|
+
VCR.use_cassette('users_for_domain') do
|
346
|
+
users = @api.users_for_domain('mxhero.com')
|
347
|
+
assert !users.nil?
|
348
|
+
assert !users.empty?
|
349
|
+
assert users.find { |user| user[:userName] == 'mxhero@mxhero.com' }
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
344
353
|
def test_fetch_user
|
345
354
|
VCR.use_cassette('fetch_user') do
|
346
355
|
user = @api.fetch_user('mxhero@mxhero.com')
|
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: 0.1.
|
4
|
+
version: 0.1.36
|
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: 2014-11-
|
13
|
+
date: 2014-11-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: vcr
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- test/fixtures/api/update_rule.yml
|
126
126
|
- test/fixtures/api/update_user.yml
|
127
127
|
- test/fixtures/api/user_domains.yml
|
128
|
+
- test/fixtures/api/users_for_domain.yml
|
128
129
|
- test/fixtures/api/validate_user_credential.yml
|
129
130
|
- test/fixtures/domain.rb
|
130
131
|
- test/helper.rb
|
@@ -204,6 +205,7 @@ test_files:
|
|
204
205
|
- test/fixtures/api/update_rule.yml
|
205
206
|
- test/fixtures/api/update_user.yml
|
206
207
|
- test/fixtures/api/user_domains.yml
|
208
|
+
- test/fixtures/api/users_for_domain.yml
|
207
209
|
- test/fixtures/api/validate_user_credential.yml
|
208
210
|
- test/fixtures/domain.rb
|
209
211
|
- test/helper.rb
|