mxhero-api 0.1.31 → 0.1.32

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
- MDkzNTUwNzUxNDUzN2Y0MjE5NjZhNTUzNTNlMDEwYzBlZTMwZjBlOQ==
4
+ YTg2ZjZkNjM0YjgzMTk4YTE2ZjU5MWI2NDY3ZWQxODlhYzhlN2Y2Ng==
5
5
  data.tar.gz: !binary |-
6
- NTVlZTQ2NDA4ZGU1ZWE1ZjEyNTA5YTMwOTFjMmJhYmRkOTRkYmZiMg==
6
+ MTMxYjMwODZlYTFjZTlhNWM2YWQ1NTVjMGViY2QzZDM2ZTBjMTk5ZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjZhY2E1N2RlNDA3ZjkyNjJiMGRlYmRhZDRjNzQ3OGI5YzgyZmM0OTdiZjIy
10
- NDJkYWRiZmUwZjFlYjAyMTBmYzVhMzg3ODIwNTI3MTJiMDdmODEyMzMyZjA5
11
- NTMxYjY5OTg4YWI4MzEzZmJiMmQ1NzBiODQ0MjUyMTk3OGUyZTM=
9
+ ZTJlOWQ2ZmZmZGY1ZGNkYWJkNjkzODYyNjI1NzM0MTEwN2ExNDQxN2QxNTgw
10
+ ZjZlYTQzODE1YmJjZWQ2MzNiOTY2Mjg0MDVlY2NlZTAxYzk0ZTAxYTMxNTUy
11
+ NTIwYmZiYjVkOTkwMjI3N2UxODFlZGJmNjMzNjg2MzZlNWJjNjU=
12
12
  data.tar.gz: !binary |-
13
- ZmNiNzk4M2JmOGRmMGNjNTEzZTNmYWVkMTE5MWUzM2JmNDVkY2YxNmYwMjJl
14
- MDMwM2Q5ZmU5MTg4MDE5MmQyNGFmMjYzNjM3MTdkN2ViYTE3MmEzNTJjNzIz
15
- ZDBmYzMxNmJjNGRkODc1ZWI3ZDgzNTg1MGIwOWI2Y2VjZTQ5NmE=
13
+ ZWJkZWQxZGI0NWVlZDliZGMzYmQzNzEwOGIzZjFjYzExYjgzMDgwMTE1ZWU1
14
+ NWYxMjI2ODNiMjU1NTQ2YmMyZjcyMzE0OWE3OGRkNWE2YmNmNzRhMjlmZDlh
15
+ N2RiNjE5NWI5ZjVlMTFiNDFjZDQ3N2I3ZmUyODgzODE0YmY3NDg=
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ mxhero-api
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p448
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.31
1
+ 0.1.32
data/lib/mxhero-api.rb CHANGED
@@ -415,6 +415,16 @@ module MxHero::API
415
415
  response.status == 201
416
416
  end
417
417
 
418
+
419
+ # Update user
420
+ # @param [Hash] user retrieve to update
421
+ #
422
+ # @param user_name [String]
423
+ #
424
+ def update_user(user, user_name)
425
+ response = call(:put, user_url(user_name), user.to_json, throw_exception: false)
426
+ parse_response(response)
427
+ end
418
428
 
419
429
  # Validate if the an user and password match
420
430
  #
data/mxhero-api.gemspec CHANGED
@@ -1,22 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: mxhero-api 0.1.31 ruby lib
2
+ # stub: mxhero-api 0.1.32 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "mxhero-api"
6
- s.version = "0.1.31"
6
+ s.version = "0.1.32"
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-04-11"
10
+ s.date = "2014-04-15"
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/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/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/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"]
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/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/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/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"]
20
20
 
21
21
  if s.respond_to? :specification_version then
22
22
  s.specification_version = 4
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: http://admin:password@test.mxhero.com/webapi/api/v1/users/example.org/
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"name":"example.org","lastName":"example.org","notifyEmail":"mmarmol@mxhero.com","userName":"example.org","created":1389107927000,"locale":"en_US","enabled":true,"authorities":["ROLE_DOMAIN_ADMIN"],"metadata":"adsfadffads"}'
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 "Q29udGVudC1MZW5ndGg=":
26
+ - !binary |-
27
+ MA==
28
+ !binary "RGF0ZQ==":
29
+ - !binary |-
30
+ VHVlLCAxNSBBcHIgMjAxNCAxNDo1NTo1NiBHTVQ=
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ''
34
+ http_version:
35
+ recorded_at: Tue, 15 Apr 2014 14:55:56 GMT
36
+ recorded_with: VCR 2.5.0
data/test/helper.rb CHANGED
@@ -15,7 +15,7 @@ Dir["#{File.dirname(__FILE__)}/fixtures/**/*.rb"].each { |rb| require rb }
15
15
  TEST_API_DOMAIN = 'tesla.com'
16
16
  TEST_API_URL = ENV['TEST_API_URL'] || 'http://test.mxhero.com/webapi/api/v1'
17
17
  TEST_API_USER = 'admin'
18
- TEST_API_PASSWORD = 'password'
18
+ TEST_API_PASSWORD = ENV['TEST_API_PASSWORD'] || 'password'
19
19
 
20
20
  require 'vcr'
21
21
 
@@ -337,6 +337,24 @@ class MxHeroAPITest < MiniTest::Unit::TestCase
337
337
  end
338
338
  end
339
339
 
340
+ def test_update_user
341
+ VCR.use_cassette('update_user') do
342
+ user = {
343
+ name: "example.org",
344
+ lastName: "example.org",
345
+ notifyEmail: "mmarmol@mxhero.com",
346
+ userName: "example.org",
347
+ created: 1389107927000,
348
+ locale: "en_US",
349
+ enabled: true,
350
+ authorities: ["ROLE_DOMAIN_ADMIN"],
351
+ metadata:"adsfadffads"
352
+ }
353
+ created = @api.update_user(user, 'example.org')
354
+ assert created
355
+ end
356
+ end
357
+
340
358
  def test_valid_user_credentials
341
359
  VCR.use_cassette('validate_user_credential') do
342
360
  assert @api.valid_user_credentials?('admin', 'password')
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.31
4
+ version: 0.1.32
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-04-11 00:00:00.000000000 Z
13
+ date: 2014-04-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: vcr
@@ -64,7 +64,8 @@ extensions: []
64
64
  extra_rdoc_files: []
65
65
  files:
66
66
  - .gitignore
67
- - .rvmrc
67
+ - .ruby-gemset
68
+ - .ruby-version
68
69
  - Gemfile
69
70
  - LICENSE.txt
70
71
  - README.md
@@ -120,6 +121,7 @@ files:
120
121
  - test/fixtures/api/update_accounts_properties_scope.yml
121
122
  - test/fixtures/api/update_directory.yml
122
123
  - test/fixtures/api/update_rule.yml
124
+ - test/fixtures/api/update_user.yml
123
125
  - test/fixtures/api/user_domains.yml
124
126
  - test/fixtures/api/validate_user_credential.yml
125
127
  - test/fixtures/domain.rb
@@ -196,6 +198,7 @@ test_files:
196
198
  - test/fixtures/api/update_accounts_properties_scope.yml
197
199
  - test/fixtures/api/update_directory.yml
198
200
  - test/fixtures/api/update_rule.yml
201
+ - test/fixtures/api/update_user.yml
199
202
  - test/fixtures/api/user_domains.yml
200
203
  - test/fixtures/api/validate_user_credential.yml
201
204
  - test/fixtures/domain.rb
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use --create 1.9.3@mxhero-api