mxhero-api 0.1.28 → 0.1.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDNhNzFjMGM0OTZjN2Q1Y2YxZGNlYzUyNTNjYmJjODAzZDJmNTE3ZQ==
4
+ YzQ2ZDczOWZkZWZiODNjOThiMTdmZTM0OTkzMjYyMjJiMDVlOWMxYg==
5
5
  data.tar.gz: !binary |-
6
- YTVmZDczZTE3ZjczY2YxY2E4NWFhM2JlNjlhNzIwMjM1Yjk5YTUzMw==
6
+ OGNhNDAwOTA2MzVkYWMzOWM4MGMyODBiNGY4Njk1M2Q1ZDA5NzA4Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmFjZGEyZDkxOGQ5MTRlMzA2MWRiY2M0MzEyMjlmODlmMGFjNWQxYzAzZTc3
10
- MmJiNTE0MGFhOTdiM2FiMmVkYWMxYmMxODkxYzVlY2IxYzgzNTJkMWE3NDlh
11
- Njg1YWE4MjIxYTU2NjM2OTZmM2IzNDk0YjYxMzllOTE3MzRlYmY=
9
+ MzVjZGFkMGE5MjYyNzg0ZjExNGFiMjZmNDIzNGU3ZDI5MGEyYzY4NmNlODFi
10
+ ZTI0YTMxNzhlNTNlZjY2ZTY2MzlhNDBmMWMwMjFkYTczMmY3MmQ2MDc4ZWE4
11
+ ZTQzYmVlZGY1ZGQ5MTk2ZDE2Mjg4MmEwMDZkODNjMTM1Y2ExNjI=
12
12
  data.tar.gz: !binary |-
13
- NzBlZmJlY2NkMWQ0ZDhkNTg4YmVmMmFjZDZhY2MzMzA5ZjM3NDAyODg5MTYz
14
- NWVlZjNmZGMwZDA0OGI0ZjY0YzQ1MTVkMGUwZDMxMzc2MGQ0M2JiYjQyNGVm
15
- MWNiZTZhMjdmMDRmOTA1NTNmMGYwMzRiYWJmOGIzYzdlYzA2NzU=
13
+ NDc1ZjZhOWRiYmQ3ZmIwNDM4ZWM4NDg4MDJjOTRlZGZjZDViNDI2YmI2MWVh
14
+ YzcyMmNkNGZkNzQ0Yjk2NDQ2ZmUyODQxOWU2ZWM4NmJlMGE0M2Q2MTA4Y2Yx
15
+ M2EzMWNmMDk4NGI4M2I4Y2E0MDQ0ZjBmZmI1OTAyMGUyM2JlMmQ=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.28
1
+ 0.1.29
data/lib/mxhero-api.rb CHANGED
@@ -414,6 +414,15 @@ module MxHero::API
414
414
  response = call(:post, users_url, user.to_json, throw_exception: false)
415
415
  response.status == 201
416
416
  end
417
+
418
+
419
+ # Validate if the an user and password match
420
+ #
421
+ def valid_user_credentials?(user, password)
422
+ validate_user_credential_url = user_url(user) + "password/#{password}"
423
+ response = call(:get, validate_user_credential_url)
424
+ response.status == 204
425
+ end
417
426
 
418
427
  # --------------------------------------------------------------------------------------------------------------------------------
419
428
  private
data/mxhero-api.gemspec CHANGED
@@ -1,22 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: mxhero-api 0.1.28 ruby lib
2
+ # stub: mxhero-api 0.1.29 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "mxhero-api"
6
- s.version = "0.1.28"
6
+ s.version = "0.1.29"
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-01-20"
10
+ s.date = "2014-02-26"
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", ".rvmrc", "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/all_groups.yml", "test/fixtures/api/create_directory.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/user_domains.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", ".rvmrc", "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/all_groups.yml", "test/fixtures/api/create_directory.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/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"]
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/all_groups.yml", "test/fixtures/api/create_directory.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/user_domains.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/all_groups.yml", "test/fixtures/api/create_directory.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/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"]
20
20
 
21
21
  if s.respond_to? :specification_version then
22
22
  s.specification_version = 4
@@ -0,0 +1,111 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://admin:password@test.mxhero.com/webapi/api/v1/users/admin/password/password
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 YWRtaW46cGFzc3dvcmQ=
16
+ response:
17
+ status:
18
+ code: 204
19
+ message: !binary |-
20
+ Tm8gQ29udGVudA==
21
+ headers:
22
+ !binary "RGF0ZQ==":
23
+ - !binary |-
24
+ V2VkLCAyNiBGZWIgMjAxNCAxODo1MjowMyBHTVQ=
25
+ !binary "U2VydmVy":
26
+ - !binary |-
27
+ QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
28
+ !binary "Q29udGVudC1MZW5ndGg=":
29
+ - !binary |-
30
+ MA==
31
+ !binary "Q29udGVudC1UeXBl":
32
+ - !binary |-
33
+ dGV4dC9wbGFpbg==
34
+ body:
35
+ encoding: US-ASCII
36
+ string: ''
37
+ http_version:
38
+ recorded_at: Wed, 26 Feb 2014 18:52:03 GMT
39
+ - request:
40
+ method: get
41
+ uri: http://admin:password@test.mxhero.com/webapi/api/v1/users/admin/password/wrong
42
+ body:
43
+ encoding: US-ASCII
44
+ string: ''
45
+ headers:
46
+ Accept:
47
+ - application/json
48
+ Content-Type:
49
+ - application/json
50
+ Authorization:
51
+ - Basic YWRtaW46cGFzc3dvcmQ=
52
+ response:
53
+ status:
54
+ code: 404
55
+ message: !binary |-
56
+ Tm90IEZvdW5k
57
+ headers:
58
+ !binary "RGF0ZQ==":
59
+ - !binary |-
60
+ V2VkLCAyNiBGZWIgMjAxNCAxODo1MjowMyBHTVQ=
61
+ !binary "U2VydmVy":
62
+ - !binary |-
63
+ QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
64
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
65
+ - !binary |-
66
+ Y2h1bmtlZA==
67
+ !binary "Q29udGVudC1UeXBl":
68
+ - !binary |-
69
+ YXBwbGljYXRpb24vanNvbg==
70
+ body:
71
+ encoding: US-ASCII
72
+ string: ! '{"status":404,"code":404,"message":"user.not.found.or.invalid.password","developerMessage":"user.not.found.or.invalid.password","moreInfoUrl":"mailto:support@mxhero.com"}'
73
+ http_version:
74
+ recorded_at: Wed, 26 Feb 2014 18:52:17 GMT
75
+ - request:
76
+ method: get
77
+ uri: http://admin:password@test.mxhero.com/webapi/api/v1/users/inexistent.user/password/xxx
78
+ body:
79
+ encoding: US-ASCII
80
+ string: ''
81
+ headers:
82
+ Accept:
83
+ - application/json
84
+ Content-Type:
85
+ - application/json
86
+ Authorization:
87
+ - Basic YWRtaW46cGFzc3dvcmQ=
88
+ response:
89
+ status:
90
+ code: 404
91
+ message: !binary |-
92
+ Tm90IEZvdW5k
93
+ headers:
94
+ !binary "RGF0ZQ==":
95
+ - !binary |-
96
+ V2VkLCAyNiBGZWIgMjAxNCAxODo1MjoxNyBHTVQ=
97
+ !binary "U2VydmVy":
98
+ - !binary |-
99
+ QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
100
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
101
+ - !binary |-
102
+ Y2h1bmtlZA==
103
+ !binary "Q29udGVudC1UeXBl":
104
+ - !binary |-
105
+ YXBwbGljYXRpb24vanNvbg==
106
+ body:
107
+ encoding: US-ASCII
108
+ string: ! '{"status":404,"code":404,"message":"user.not.found.or.invalid.password","developerMessage":"user.not.found.or.invalid.password","moreInfoUrl":"mailto:support@mxhero.com"}'
109
+ http_version:
110
+ recorded_at: Wed, 26 Feb 2014 18:52:17 GMT
111
+ recorded_with: VCR 2.5.0
@@ -337,6 +337,13 @@ class MxHeroAPITest < MiniTest::Unit::TestCase
337
337
  end
338
338
  end
339
339
 
340
+ def test_valid_user_credentials
341
+ VCR.use_cassette('validate_user_credential') do
342
+ assert @api.valid_user_credentials?('admin', 'password')
343
+ refute @api.valid_user_credentials?('admin', 'wrong')
344
+ refute @api.valid_user_credentials?('inexistent.user', 'xxx')
345
+ end
346
+ end
340
347
 
341
348
  private
342
349
 
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.28
4
+ version: 0.1.29
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-01-20 00:00:00.000000000 Z
13
+ date: 2014-02-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: vcr
@@ -121,6 +121,7 @@ files:
121
121
  - test/fixtures/api/update_directory.yml
122
122
  - test/fixtures/api/update_rule.yml
123
123
  - test/fixtures/api/user_domains.yml
124
+ - test/fixtures/api/validate_user_credential.yml
124
125
  - test/fixtures/domain.rb
125
126
  - test/helper.rb
126
127
  - test/test_directories.rb
@@ -196,6 +197,7 @@ test_files:
196
197
  - test/fixtures/api/update_directory.yml
197
198
  - test/fixtures/api/update_rule.yml
198
199
  - test/fixtures/api/user_domains.yml
200
+ - test/fixtures/api/validate_user_credential.yml
199
201
  - test/fixtures/domain.rb
200
202
  - test/helper.rb
201
203
  - test/test_directories.rb
@@ -206,4 +208,3 @@ test_files:
206
208
  - test/test_mxhero_api.rb
207
209
  - test/test_mxhero_api_response.rb
208
210
  - test/test_resource.rb
209
- has_rdoc: