mxhero-api 0.1.29 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzQ2ZDczOWZkZWZiODNjOThiMTdmZTM0OTkzMjYyMjJiMDVlOWMxYg==
4
+ NDViNTdjZTE3ZDY4NjhmN2E2NjM5NjgyZDhmNWNlMWNkYTEzYzY5ZQ==
5
5
  data.tar.gz: !binary |-
6
- OGNhNDAwOTA2MzVkYWMzOWM4MGMyODBiNGY4Njk1M2Q1ZDA5NzA4Ng==
6
+ ODg0Mzc3NjY5ZGFjZTQwODljOGNkODgyOWEwY2RhM2ZkZWQ0ZjYwMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzVjZGFkMGE5MjYyNzg0ZjExNGFiMjZmNDIzNGU3ZDI5MGEyYzY4NmNlODFi
10
- ZTI0YTMxNzhlNTNlZjY2ZTY2MzlhNDBmMWMwMjFkYTczMmY3MmQ2MDc4ZWE4
11
- ZTQzYmVlZGY1ZGQ5MTk2ZDE2Mjg4MmEwMDZkODNjMTM1Y2ExNjI=
9
+ MDA0NDJhOWFmNTBiZTgyNDZhZjBkYmIxMmQ4ZGRmZWI5OGRkZjY3M2U4NTg1
10
+ MWQ3MjdhOWVlODYwZDY4ZmI2NTg3MGU0MmIxOTI0NTBlMDQzMjU2MmVlMWI5
11
+ OGNlNDk4YTJlOTFkNTQyMTM3ZWJhMTlkYzY5ZDdhMzYyOGRiN2M=
12
12
  data.tar.gz: !binary |-
13
- NDc1ZjZhOWRiYmQ3ZmIwNDM4ZWM4NDg4MDJjOTRlZGZjZDViNDI2YmI2MWVh
14
- YzcyMmNkNGZkNzQ0Yjk2NDQ2ZmUyODQxOWU2ZWM4NmJlMGE0M2Q2MTA4Y2Yx
15
- M2EzMWNmMDk4NGI4M2I4Y2E0MDQ0ZjBmZmI1OTAyMGUyM2JlMmQ=
13
+ MzM2YTA4ZGZjMTM4NDJmYzhlYTA4ZTc1YWQ5ZDkyNDdmYmYxOWFiMDVkMzk1
14
+ Mjk3YzgyOGQ0Y2M2ZjUzN2RiMjhmZmM0NWM2MmQzOTA0NmEyZDcxZGUyZTIz
15
+ YmY2MjJiNGI1OWIzZDA0Mzc5N2MxYjZhMmU5MzhkZWQwMGNjMTc=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.29
1
+ 0.1.30
data/lib/groups.rb CHANGED
@@ -2,6 +2,7 @@
2
2
  require_relative 'communication'
3
3
  require_relative 'urls'
4
4
 
5
+ require 'open-uri'
5
6
  require 'delegate'
6
7
 
7
8
  module MxHero::API
@@ -143,7 +144,7 @@ module MxHero::API
143
144
  end
144
145
 
145
146
  def group_url(group_name)
146
- groups_url + "/#{group_name}"
147
+ groups_url + "/#{URI::encode(group_name)}"
147
148
  end
148
149
 
149
150
  def group_accounts_url(group_name, pagination = {})
data/mxhero-api.gemspec CHANGED
@@ -1,13 +1,13 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: mxhero-api 0.1.29 ruby lib
2
+ # stub: mxhero-api 0.1.30 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "mxhero-api"
6
- s.version = "0.1.29"
6
+ s.version = "0.1.30"
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-02-26"
10
+ s.date = "2014-03-07"
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
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"]
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: delete
5
- uri: http://admin:password@test.mxhero.com/webapi/api/v1/domains/tesla.com/groups/test
5
+ uri: http://admin:password@test.mxhero.com/webapi/api/v1/domains/tesla.com/groups/test%20group
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -21,7 +21,7 @@ http_interactions:
21
21
  headers:
22
22
  !binary "RGF0ZQ==":
23
23
  - !binary |-
24
- VGh1LCAxMiBTZXAgMjAxMyAyMToyMTowMyBHTVQ=
24
+ RnJpLCAwNyBNYXIgMjAxNCAxNDozMDowOSBHTVQ=
25
25
  !binary "U2VydmVy":
26
26
  - !binary |-
27
27
  QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
@@ -35,7 +35,7 @@ http_interactions:
35
35
  encoding: US-ASCII
36
36
  string: ''
37
37
  http_version:
38
- recorded_at: Thu, 12 Sep 2013 21:21:03 GMT
38
+ recorded_at: Fri, 07 Mar 2014 14:30:09 GMT
39
39
  - request:
40
40
  method: get
41
41
  uri: http://admin:password@test.mxhero.com/webapi/api/v1/domains/tesla.com/groups
@@ -57,19 +57,19 @@ http_interactions:
57
57
  headers:
58
58
  !binary "RGF0ZQ==":
59
59
  - !binary |-
60
- VGh1LCAxMiBTZXAgMjAxMyAyMToyMTowMyBHTVQ=
60
+ RnJpLCAwNyBNYXIgMjAxNCAxNDozMDoxMCBHTVQ=
61
61
  !binary "U2VydmVy":
62
62
  - !binary |-
63
63
  QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
64
- !binary "Q29udGVudC1MZW5ndGg=":
64
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
65
65
  - !binary |-
66
- NjM=
66
+ Y2h1bmtlZA==
67
67
  !binary "Q29udGVudC1UeXBl":
68
68
  - !binary |-
69
69
  YXBwbGljYXRpb24vanNvbg==
70
70
  body:
71
71
  encoding: US-ASCII
72
- string: ! '{"elements":[],"totalElements":0,"totalPages":0,"actualPage":0}'
72
+ string: ! '{"totalElements":0,"totalPages":0,"actualPage":0,"elements":[]}'
73
73
  http_version:
74
- recorded_at: Thu, 12 Sep 2013 21:21:03 GMT
74
+ recorded_at: Fri, 07 Mar 2014 14:30:09 GMT
75
75
  recorded_with: VCR 2.5.0
@@ -21,27 +21,27 @@ http_interactions:
21
21
  headers:
22
22
  !binary "RGF0ZQ==":
23
23
  - !binary |-
24
- VGh1LCAxMiBTZXAgMjAxMyAyMToyMTowNCBHTVQ=
24
+ RnJpLCAwNyBNYXIgMjAxNCAxNDozMDo1NyBHTVQ=
25
25
  !binary "U2VydmVy":
26
26
  - !binary |-
27
27
  QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
28
- !binary "Q29udGVudC1MZW5ndGg=":
28
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
29
29
  - !binary |-
30
- NjM=
30
+ Y2h1bmtlZA==
31
31
  !binary "Q29udGVudC1UeXBl":
32
32
  - !binary |-
33
33
  YXBwbGljYXRpb24vanNvbg==
34
34
  body:
35
35
  encoding: US-ASCII
36
- string: ! '{"elements":[],"totalElements":0,"totalPages":0,"actualPage":0}'
36
+ string: ! '{"totalElements":0,"totalPages":0,"actualPage":0,"elements":[]}'
37
37
  http_version:
38
- recorded_at: Thu, 12 Sep 2013 21:21:04 GMT
38
+ recorded_at: Fri, 07 Mar 2014 14:30:56 GMT
39
39
  - request:
40
40
  method: post
41
41
  uri: http://admin:password@test.mxhero.com/webapi/api/v1/domains/tesla.com/groups
42
42
  body:
43
43
  encoding: UTF-8
44
- string: ! '{"name":"test","domain":"tesla.com","description":null}'
44
+ string: ! '{"name":"test group","domain":"tesla.com","description":null}'
45
45
  headers:
46
46
  Accept:
47
47
  - application/json
@@ -57,27 +57,27 @@ http_interactions:
57
57
  headers:
58
58
  !binary "RGF0ZQ==":
59
59
  - !binary |-
60
- VGh1LCAxMiBTZXAgMjAxMyAyMToyMTowNSBHTVQ=
60
+ RnJpLCAwNyBNYXIgMjAxNCAxNDozMDo1NyBHTVQ=
61
61
  !binary "U2VydmVy":
62
62
  - !binary |-
63
63
  QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
64
- !binary "Q29udGVudC1MZW5ndGg=":
64
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
65
65
  - !binary |-
66
- MTEx
66
+ Y2h1bmtlZA==
67
67
  !binary "Q29udGVudC1UeXBl":
68
68
  - !binary |-
69
69
  YXBwbGljYXRpb24vanNvbg==
70
70
  body:
71
71
  encoding: US-ASCII
72
- string: ! '{"name":"test","domain":"tesla.com","description":null,"createdDate":1379020865000,"updatedDate":1379020865000}'
72
+ string: ! '{"name":"test group","domain":"tesla.com","description":null,"createdDate":1394202657000,"updatedDate":1394202657000}'
73
73
  http_version:
74
- recorded_at: Thu, 12 Sep 2013 21:21:04 GMT
74
+ recorded_at: Fri, 07 Mar 2014 14:30:57 GMT
75
75
  - request:
76
76
  method: post
77
77
  uri: http://admin:password@test.mxhero.com/webapi/api/v1/domains/tesla.com/groups
78
78
  body:
79
79
  encoding: UTF-8
80
- string: ! '{"name":"test","domain":"tesla.com","description":null}'
80
+ string: ! '{"name":"test group","domain":"tesla.com","description":null}'
81
81
  headers:
82
82
  Accept:
83
83
  - application/json
@@ -93,13 +93,13 @@ http_interactions:
93
93
  headers:
94
94
  !binary "RGF0ZQ==":
95
95
  - !binary |-
96
- VGh1LCAxMiBTZXAgMjAxMyAyMToyMTowNSBHTVQ=
96
+ RnJpLCAwNyBNYXIgMjAxNCAxNDozMDo1NyBHTVQ=
97
97
  !binary "U2VydmVy":
98
98
  - !binary |-
99
99
  QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
100
- !binary "Q29udGVudC1MZW5ndGg=":
100
+ !binary "VHJhbnNmZXItRW5jb2Rpbmc=":
101
101
  - !binary |-
102
- Nzgy
102
+ Y2h1bmtlZA==
103
103
  !binary "Q29udGVudC1UeXBl":
104
104
  - !binary |-
105
105
  YXBwbGljYXRpb24vanNvbg==
@@ -107,13 +107,13 @@ http_interactions:
107
107
  encoding: US-ASCII
108
108
  string: ! '{"status":409,"code":409,"message":"PreparedStatementCallback; SQL
109
109
  [INSERT INTO `mxhero`.`groups` (`domain_id`,`name`, `created`,`description`,
110
- `updated`) VALUES(?,?,?,?,?) ;]; Duplicate entry ''tesla.com-test'' for key
111
- ''PRIMARY''; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
112
- Duplicate entry ''tesla.com-test'' for key ''PRIMARY''","developerMessage":"PreparedStatementCallback;
110
+ `updated`) VALUES(?,?,?,?,?) ;]; Duplicate entry ''tesla.com-test group''
111
+ for key ''PRIMARY''; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
112
+ Duplicate entry ''tesla.com-test group'' for key ''PRIMARY''","developerMessage":"PreparedStatementCallback;
113
113
  SQL [INSERT INTO `mxhero`.`groups` (`domain_id`,`name`, `created`,`description`,
114
- `updated`) VALUES(?,?,?,?,?) ;]; Duplicate entry ''tesla.com-test'' for key
115
- ''PRIMARY''; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
116
- Duplicate entry ''tesla.com-test'' for key ''PRIMARY''","moreInfoUrl":"mailto:support@mxhero.com"}'
114
+ `updated`) VALUES(?,?,?,?,?) ;]; Duplicate entry ''tesla.com-test group''
115
+ for key ''PRIMARY''; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
116
+ Duplicate entry ''tesla.com-test group'' for key ''PRIMARY''","moreInfoUrl":"mailto:support@mxhero.com"}'
117
117
  http_version:
118
- recorded_at: Thu, 12 Sep 2013 21:21:05 GMT
118
+ recorded_at: Fri, 07 Mar 2014 14:30:57 GMT
119
119
  recorded_with: VCR 2.5.0
data/test/test_groups.rb CHANGED
@@ -26,12 +26,13 @@ class GroupsTest < MiniTest::Unit::TestCase
26
26
  def test_save
27
27
  VCR.use_cassette('save_group') do
28
28
  delete_all_groups
29
- group = MxHero::API::Group.new(name: 'test')
29
+ group = MxHero::API::Group.new(name: 'test group')
30
30
  response = @groups.save(group)
31
31
  assert response.is_a? MxHero::API::Response
32
+ #puts response
32
33
  assert response.success?
33
34
  assert response.content.is_a? MxHero::API::Group
34
- assert 'test', response.content.name
35
+ assert 'test group', response.content.name
35
36
 
36
37
  response = @groups.save(group)
37
38
  refute response.success?
@@ -44,9 +45,9 @@ class GroupsTest < MiniTest::Unit::TestCase
44
45
 
45
46
  def test_delete
46
47
  VCR.use_cassette('delete_group') do
47
- assert @groups.delete('test')
48
+ assert @groups.delete('test group')
48
49
  groups = @groups.all
49
- refute groups.any? { |group| group.name == 'test' }
50
+ refute groups.any? { |group| group.name == 'test group' }
50
51
  end
51
52
  end
52
53
 
@@ -54,6 +55,9 @@ class GroupsTest < MiniTest::Unit::TestCase
54
55
  VCR.use_cassette('accounts') do
55
56
  accounts = @groups.accounts('development')
56
57
  assert accounts.first.is_a? MxHero::API::Account
58
+
59
+ #accounts = @groups.account('with spaces')
60
+ #assert accounts.first.is_a? MxHero::API::Account
57
61
  end
58
62
  end
59
63
 
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.29
4
+ version: 0.1.30
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-02-26 00:00:00.000000000 Z
13
+ date: 2014-03-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: vcr