mxhero-api 0.1.25 → 0.1.26
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 +39 -0
- data/mxhero-api.gemspec +5 -5
- data/test/fixtures/api/system_properties.yml +53 -0
- data/test/fixtures/api/system_properties_create.yml +219 -0
- data/test/fixtures/api/system_properties_element.yml +39 -0
- data/test/test_mxhero_api.rb +31 -5
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2NiMTVjOWRlNTVkMDE0MjcwZDEzYjQ4OTg4NmJkZWIxN2Y5N2ViMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWE1MzVkZjZkZDk1ZjlhOTYwYTU2YmM5YTI1YzRlYjI4ZjAyNWJkNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDQzMDVlMDA0NWMwODA1MDViZGUzMGM0YWM1NzkwZjk3Zjc0ZjAyMjdlNjQz
|
10
|
+
ZWU0NDY0MWQ0YzVjY2RlNzcwZjk3OWU2NzI3ZjBlOWJkNTEwOWZhODlhMDhl
|
11
|
+
Y2IyY2QwNGIxYjEwY2YzYjgxZDc4NzMzMjAyNzBhMjRiZTZjMzg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTBmYmI5NTgwMzk1MjVlZjg3ZmU5NzhkZTdlZDUzY2JjOGU4YjA3OTk2M2Nl
|
14
|
+
MmMxN2JkMDkyYjk5YzI4NzY3YzBkYzBiMzhmNmM2NmMwMDEyNmM1NjlhYThm
|
15
|
+
MGJmNjlkYzkwMjY5MTUxZTZlYTg1NTEwMmZjNjQzNGIzOTUyMTM=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.26
|
data/lib/mxhero-api.rb
CHANGED
@@ -334,6 +334,39 @@ module MxHero::API
|
|
334
334
|
parse_response(response)
|
335
335
|
end
|
336
336
|
|
337
|
+
# @return [Hash|String|nil] can return a hash with the key and value of any
|
338
|
+
# system property. If use a parameter (key) return the string of this value.
|
339
|
+
# In the two cases return nil when not found values
|
340
|
+
#
|
341
|
+
def system_properties(key = nil)
|
342
|
+
response = call(:get, system_properties_url(key))
|
343
|
+
if response.status == 200
|
344
|
+
parsed = json_parse(response.content)
|
345
|
+
if parsed.is_a? Array
|
346
|
+
props = {}
|
347
|
+
parsed.each { |property| props[property[:key]] = property[:value] }
|
348
|
+
return props
|
349
|
+
else
|
350
|
+
return parsed[:value]
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
nil
|
355
|
+
end
|
356
|
+
|
357
|
+
# Update or create a system property
|
358
|
+
def save_system_property(key, value)
|
359
|
+
property = { key: key, value: value }.to_json
|
360
|
+
response = if system_properties(key).nil?
|
361
|
+
call(:post, system_properties_url, property)
|
362
|
+
else
|
363
|
+
call(:put, system_properties_url(key), property)
|
364
|
+
end
|
365
|
+
|
366
|
+
parse_response(response).success?
|
367
|
+
end
|
368
|
+
|
369
|
+
|
337
370
|
# --------------------------------------------------------------------------------------------------------------------------------
|
338
371
|
private
|
339
372
|
|
@@ -418,6 +451,12 @@ module MxHero::API
|
|
418
451
|
accounts_by_domain_url(domain) + "/#{account}/properties"
|
419
452
|
end
|
420
453
|
|
454
|
+
def system_properties_url(key = nil)
|
455
|
+
fixed_key = key.nil? ? nil : "#{key}/"
|
456
|
+
service_url + "/system/properties/#{fixed_key}"
|
457
|
+
end
|
458
|
+
|
459
|
+
|
421
460
|
end
|
422
461
|
|
423
462
|
end
|
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.26 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.26"
|
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 = "
|
10
|
+
s.date = "2014-01-09"
|
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/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/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/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/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/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/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/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/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/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/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/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/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/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/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,53 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/system/properties/
|
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: 200
|
19
|
+
message: !binary |-
|
20
|
+
T0s=
|
21
|
+
headers:
|
22
|
+
!binary "RGF0ZQ==":
|
23
|
+
- !binary |-
|
24
|
+
VGh1LCAwOSBKYW4gMjAxNCAxNToxOToxNSBHTVQ=
|
25
|
+
!binary "U2VydmVy":
|
26
|
+
- !binary |-
|
27
|
+
QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
|
28
|
+
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
29
|
+
- !binary |-
|
30
|
+
Y2h1bmtlZA==
|
31
|
+
!binary "Q29udGVudC1UeXBl":
|
32
|
+
- !binary |-
|
33
|
+
YXBwbGljYXRpb24vanNvbg==
|
34
|
+
body:
|
35
|
+
encoding: US-ASCII
|
36
|
+
string: ! '[{"key":"api.password","value":"6x5ItobNGPW31x4"},{"key":"api.username","value":"apiuser"},{"key":"commercial.version","value":"true"},{"key":"default.user.language","value":"en_US"},{"key":"documentation.url","value":"http://wiki.mxhero.com:8080/display/docs/mxHero+User+Manual"},{"key":"external.logo.path","value":null},{"key":"feature.category.unclassified.id","value":"4"},{"key":"license.data","value":"<?xml
|
37
|
+
version=\"1.0\" encoding=\"utf-8\"?>\n<mxHeroLicense verifier=\"MX1\">\n <item
|
38
|
+
name=\"APIEnabled\" value=\"true\"/>\n <item name=\"AccountsLimit\" value=\"0\"/>\n <item
|
39
|
+
name=\"BackupEnabled\" value=\"true\"/>\n <item name=\"BrandingEnabled\"
|
40
|
+
value=\"true\"/>\n <item name=\"ClusterEnabled\" value=\"true\"/>\n <item
|
41
|
+
name=\"CommunityVersion\" value=\"false\"/>\n <item name=\"HAEnabled\" value=\"true\"/>\n <item
|
42
|
+
name=\"InstallType\" value=\"regular\"/>\n <item name=\"IssuedOn\" value=\"20130117220532Z\"/>\n <item
|
43
|
+
name=\"IssuedToEmail\" value=\"compras@inova.net\"/>\n <item name=\"IssuedToName\"
|
44
|
+
value=\"Inova Tecnologias de Informacao e Representacoes Ltda.\"/>\n <item
|
45
|
+
name=\"LicenseId\" value=\"e05ee4ec-1edb-4f38-bd7c-1c0e858a6b34\"/>\n <item
|
46
|
+
name=\"LiteVersion\" value=\"false\"/>\n <item name=\"QuarantineEnabled\"
|
47
|
+
value=\"true\"/>\n <item name=\"ResellerName\" value=\"\"/>\n <item name=\"ValidFrom\"
|
48
|
+
value=\"20121119235959Z\"/>\n <item name=\"ValidUntil\" value=\"20991231235959Z\"/>\n <signature
|
49
|
+
value=\"Oudk4ZJqhE4usRMnUTTFcirihCaLvOtmKNocFQtS+u6RByTVpYEYwreta9uUvxsksm60DlQg/g5j06J4aqWOcc8jU9le1n19tfpS1ya424yJTW0n+CfazLxaFa57NRbWMbYf6j7aRCoanbaQ+NJiUsYoOTARRXd4QU3IhWsRc9VOGXK8Zm1dfvhEOG4gSHpVv4o74Ye6dmEXv+RuEkv2VhSlb75WOx4BWjyQDCojh85e+Ji9SCk/f1bQp6i1LXDqA/Dt3puTeDMpiica6w2i2Xf3Bn9Ufj8aI8hzKi/qgTHsT8JxWFor2fPMw5QbQt3zSqFr+Ks+AXQ8c7ybzj0hsg==\"
|
50
|
+
key=\"mxk1\"/>\n</mxHeroLicense>\n"},{"key":"mail.admin","value":"admin@example.com"},{"key":"mail.smtp.auth","value":"false"},{"key":"mail.smtp.host","value":"localhost"},{"key":"mail.smtp.password","value":null},{"key":"mail.smtp.port","value":"25"},{"key":"mail.smtp.ssl.enable","value":"false"},{"key":"mail.smtp.user","value":null},{"key":"news.feed.enabled","value":"true"},{"key":"preauth.expires","value":"300000"},{"key":"preauth.key","value":"4e2816f16c44fab20ecdee39fb850c3b0bb54d03f1d8e073aaea376a4f407f0c"},{"key":"quarantine_url","value":"/roundcube/?_user=MXHERO_USERNAME"},{"key":"zimbra.bandwidth.cost","value":"0.0"},{"key":"zimbra.currency.symbol","value":"$"},{"key":"zimbra.installation","value":"false"},{"key":"zimbra.ldap.host","value":null},{"key":"zimbra.private.key","value":null},{"key":"zimbra.storage.cost","value":"0.0"}]'
|
51
|
+
http_version:
|
52
|
+
recorded_at: Thu, 09 Jan 2014 15:19:15 GMT
|
53
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,219 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/system/properties/test.key/
|
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: 404
|
19
|
+
message: !binary |-
|
20
|
+
Tm90IEZvdW5k
|
21
|
+
headers:
|
22
|
+
!binary "RGF0ZQ==":
|
23
|
+
- !binary |-
|
24
|
+
VGh1LCAwOSBKYW4gMjAxNCAyMDozMDoyOSBHTVQ=
|
25
|
+
!binary "U2VydmVy":
|
26
|
+
- !binary |-
|
27
|
+
QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
|
28
|
+
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
29
|
+
- !binary |-
|
30
|
+
Y2h1bmtlZA==
|
31
|
+
!binary "Q29udGVudC1UeXBl":
|
32
|
+
- !binary |-
|
33
|
+
YXBwbGljYXRpb24vanNvbg==
|
34
|
+
body:
|
35
|
+
encoding: US-ASCII
|
36
|
+
string: ! '{"status":404,"code":404,"message":"system.property.not.found","developerMessage":"system.property.not.found","moreInfoUrl":"mailto:support@mxhero.com"}'
|
37
|
+
http_version:
|
38
|
+
recorded_at: Thu, 09 Jan 2014 20:30:29 GMT
|
39
|
+
- request:
|
40
|
+
method: post
|
41
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/system/properties/
|
42
|
+
body:
|
43
|
+
encoding: UTF-8
|
44
|
+
string: ! '{"key":"test.key","value":"test.value"}'
|
45
|
+
headers:
|
46
|
+
Accept:
|
47
|
+
- application/json
|
48
|
+
Content-Type:
|
49
|
+
- application/json
|
50
|
+
Authorization:
|
51
|
+
- Basic YWRtaW46cGFzc3dvcmQ=
|
52
|
+
response:
|
53
|
+
status:
|
54
|
+
code: 201
|
55
|
+
message: !binary |-
|
56
|
+
Q3JlYXRlZA==
|
57
|
+
headers:
|
58
|
+
!binary "RGF0ZQ==":
|
59
|
+
- !binary |-
|
60
|
+
VGh1LCAwOSBKYW4gMjAxNCAyMDozMDozMCBHTVQ=
|
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: ! '{"key":"test.key","value":"test.value"}'
|
73
|
+
http_version:
|
74
|
+
recorded_at: Thu, 09 Jan 2014 20:30:29 GMT
|
75
|
+
- request:
|
76
|
+
method: get
|
77
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/system/properties/test.key/
|
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: 200
|
91
|
+
message: !binary |-
|
92
|
+
T0s=
|
93
|
+
headers:
|
94
|
+
!binary "RGF0ZQ==":
|
95
|
+
- !binary |-
|
96
|
+
VGh1LCAwOSBKYW4gMjAxNCAyMDozMDozMCBHTVQ=
|
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: ! '{"key":"test.key","value":"test.value"}'
|
109
|
+
http_version:
|
110
|
+
recorded_at: Thu, 09 Jan 2014 20:30:30 GMT
|
111
|
+
- request:
|
112
|
+
method: get
|
113
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/system/properties/test.key/
|
114
|
+
body:
|
115
|
+
encoding: US-ASCII
|
116
|
+
string: ''
|
117
|
+
headers:
|
118
|
+
Accept:
|
119
|
+
- application/json
|
120
|
+
Content-Type:
|
121
|
+
- application/json
|
122
|
+
Authorization:
|
123
|
+
- Basic YWRtaW46cGFzc3dvcmQ=
|
124
|
+
response:
|
125
|
+
status:
|
126
|
+
code: 200
|
127
|
+
message: !binary |-
|
128
|
+
T0s=
|
129
|
+
headers:
|
130
|
+
!binary "RGF0ZQ==":
|
131
|
+
- !binary |-
|
132
|
+
VGh1LCAwOSBKYW4gMjAxNCAyMDozMDozMCBHTVQ=
|
133
|
+
!binary "U2VydmVy":
|
134
|
+
- !binary |-
|
135
|
+
QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
|
136
|
+
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
137
|
+
- !binary |-
|
138
|
+
Y2h1bmtlZA==
|
139
|
+
!binary "Q29udGVudC1UeXBl":
|
140
|
+
- !binary |-
|
141
|
+
YXBwbGljYXRpb24vanNvbg==
|
142
|
+
body:
|
143
|
+
encoding: US-ASCII
|
144
|
+
string: ! '{"key":"test.key","value":"test.value"}'
|
145
|
+
http_version:
|
146
|
+
recorded_at: Thu, 09 Jan 2014 20:30:30 GMT
|
147
|
+
- request:
|
148
|
+
method: put
|
149
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/system/properties/test.key/
|
150
|
+
body:
|
151
|
+
encoding: UTF-8
|
152
|
+
string: ! '{"key":"test.key","value":"test.value.change"}'
|
153
|
+
headers:
|
154
|
+
Accept:
|
155
|
+
- application/json
|
156
|
+
Content-Type:
|
157
|
+
- application/json
|
158
|
+
Authorization:
|
159
|
+
- Basic YWRtaW46cGFzc3dvcmQ=
|
160
|
+
response:
|
161
|
+
status:
|
162
|
+
code: 200
|
163
|
+
message: !binary |-
|
164
|
+
T0s=
|
165
|
+
headers:
|
166
|
+
!binary "RGF0ZQ==":
|
167
|
+
- !binary |-
|
168
|
+
VGh1LCAwOSBKYW4gMjAxNCAyMDozMDozMSBHTVQ=
|
169
|
+
!binary "U2VydmVy":
|
170
|
+
- !binary |-
|
171
|
+
QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
|
172
|
+
!binary "Q29udGVudC1MZW5ndGg=":
|
173
|
+
- !binary |-
|
174
|
+
MA==
|
175
|
+
!binary "Q29udGVudC1UeXBl":
|
176
|
+
- !binary |-
|
177
|
+
dGV4dC9wbGFpbg==
|
178
|
+
body:
|
179
|
+
encoding: US-ASCII
|
180
|
+
string: ''
|
181
|
+
http_version:
|
182
|
+
recorded_at: Thu, 09 Jan 2014 20:30:30 GMT
|
183
|
+
- request:
|
184
|
+
method: get
|
185
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/system/properties/test.key/
|
186
|
+
body:
|
187
|
+
encoding: US-ASCII
|
188
|
+
string: ''
|
189
|
+
headers:
|
190
|
+
Accept:
|
191
|
+
- application/json
|
192
|
+
Content-Type:
|
193
|
+
- application/json
|
194
|
+
Authorization:
|
195
|
+
- Basic YWRtaW46cGFzc3dvcmQ=
|
196
|
+
response:
|
197
|
+
status:
|
198
|
+
code: 200
|
199
|
+
message: !binary |-
|
200
|
+
T0s=
|
201
|
+
headers:
|
202
|
+
!binary "RGF0ZQ==":
|
203
|
+
- !binary |-
|
204
|
+
VGh1LCAwOSBKYW4gMjAxNCAyMDozMDozMSBHTVQ=
|
205
|
+
!binary "U2VydmVy":
|
206
|
+
- !binary |-
|
207
|
+
QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
|
208
|
+
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
209
|
+
- !binary |-
|
210
|
+
Y2h1bmtlZA==
|
211
|
+
!binary "Q29udGVudC1UeXBl":
|
212
|
+
- !binary |-
|
213
|
+
YXBwbGljYXRpb24vanNvbg==
|
214
|
+
body:
|
215
|
+
encoding: US-ASCII
|
216
|
+
string: ! '{"key":"test.key","value":"test.value.change"}'
|
217
|
+
http_version:
|
218
|
+
recorded_at: Thu, 09 Jan 2014 20:30:31 GMT
|
219
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/system/properties/default.user.language/
|
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: 200
|
19
|
+
message: !binary |-
|
20
|
+
T0s=
|
21
|
+
headers:
|
22
|
+
!binary "RGF0ZQ==":
|
23
|
+
- !binary |-
|
24
|
+
VGh1LCAwOSBKYW4gMjAxNCAxNjoxNzozOCBHTVQ=
|
25
|
+
!binary "U2VydmVy":
|
26
|
+
- !binary |-
|
27
|
+
QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
|
28
|
+
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
29
|
+
- !binary |-
|
30
|
+
Y2h1bmtlZA==
|
31
|
+
!binary "Q29udGVudC1UeXBl":
|
32
|
+
- !binary |-
|
33
|
+
YXBwbGljYXRpb24vanNvbg==
|
34
|
+
body:
|
35
|
+
encoding: US-ASCII
|
36
|
+
string: ! '{"key":"default.user.language","value":"en_US"}'
|
37
|
+
http_version:
|
38
|
+
recorded_at: Thu, 09 Jan 2014 16:17:38 GMT
|
39
|
+
recorded_with: VCR 2.5.0
|
data/test/test_mxhero_api.rb
CHANGED
@@ -221,12 +221,8 @@ class MxHeroAPITest < MiniTest::Unit::TestCase
|
|
221
221
|
assert_equal original + '011', properties['mobile']
|
222
222
|
end
|
223
223
|
end
|
224
|
-
def test_domain_by_name
|
225
|
-
VCR.use_cassette('domain_by_id') do
|
226
|
-
id = domain
|
227
|
-
end
|
228
|
-
end
|
229
224
|
|
225
|
+
|
230
226
|
|
231
227
|
def test_domain
|
232
228
|
VCR.use_cassette('test_domain') do
|
@@ -278,6 +274,36 @@ def test_domain_by_name
|
|
278
274
|
end
|
279
275
|
end
|
280
276
|
|
277
|
+
def test_system_properties
|
278
|
+
VCR.use_cassette('system_properties') do
|
279
|
+
response = @api.system_properties
|
280
|
+
# puts "Response: #{response}"
|
281
|
+
assert response.is_a? Hash
|
282
|
+
assert_equal 'en_US', response['default.user.language']
|
283
|
+
assert_equal 'admin@example.com', response['mail.admin']
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
def test_specific_system_properties
|
288
|
+
VCR.use_cassette('system_properties_element') do
|
289
|
+
response = @api.system_properties('default.user.language')
|
290
|
+
assert_equal 'en_US', response
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
def test_save_system_property
|
295
|
+
VCR.use_cassette('system_properties_create') do
|
296
|
+
response = @api.save_system_property('test.key', 'test.value')
|
297
|
+
assert response
|
298
|
+
assert_equal 'test.value', @api.system_properties('test.key')
|
299
|
+
|
300
|
+
response = @api.save_system_property('test.key', 'test.value.change')
|
301
|
+
assert response
|
302
|
+
assert_equal 'test.value.change', @api.system_properties('test.key')
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
|
281
307
|
private
|
282
308
|
|
283
309
|
def delete_all_rules
|
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.26
|
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: 2014-01-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: vcr
|
@@ -109,6 +109,9 @@ files:
|
|
109
109
|
- test/fixtures/api/rules_for_domain.yml
|
110
110
|
- test/fixtures/api/rules_for_domain_by_component.yml
|
111
111
|
- test/fixtures/api/save_group.yml
|
112
|
+
- test/fixtures/api/system_properties.yml
|
113
|
+
- test/fixtures/api/system_properties_create.yml
|
114
|
+
- test/fixtures/api/system_properties_element.yml
|
112
115
|
- test/fixtures/api/test_domain.yml
|
113
116
|
- test/fixtures/api/update_account_properties.yml
|
114
117
|
- test/fixtures/api/update_accounts_group_scope.yml
|
@@ -178,6 +181,9 @@ test_files:
|
|
178
181
|
- test/fixtures/api/rules_for_domain.yml
|
179
182
|
- test/fixtures/api/rules_for_domain_by_component.yml
|
180
183
|
- test/fixtures/api/save_group.yml
|
184
|
+
- test/fixtures/api/system_properties.yml
|
185
|
+
- test/fixtures/api/system_properties_create.yml
|
186
|
+
- test/fixtures/api/system_properties_element.yml
|
181
187
|
- test/fixtures/api/test_domain.yml
|
182
188
|
- test/fixtures/api/update_account_properties.yml
|
183
189
|
- test/fixtures/api/update_accounts_group_scope.yml
|