mxhero-api 0.1.34 → 0.1.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +16 -16
- data/VERSION +1 -1
- data/lib/mxhero-api.rb +50 -0
- data/mxhero-api.gemspec +5 -5
- data/test/fixtures/api/add_feature.yml +78 -0
- data/test/fixtures/api/create_domain.yml +83 -0
- data/test/test_mxhero_api.rb +25 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWI4NmM5MzljMmYxYTk4MDdkMzhmMWMxMjZkNzU0ZjIxNzRjNjI2NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGNhOTFlODQzMjJmNTgzNGFhNDc1ZTNlYzAwYjRjNDQ0ZjA4OTk3Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTQ4NWU1NzkwZDZiMmE3ZTE1YjdlY2ZkMDVlN2NhOGM0MWFjZGVlNWRiMzYz
|
10
|
+
YzYwZjJhYjBiMDUxNTlhYzIxMjA1NjUyZmJiN2Q0OGY5M2Q0ZThkZmI1NmQy
|
11
|
+
MmVkMGMxOWIyNGUxNzM1MmM4YmQ5MjUxMWMwNzNiNjlkMzRiODc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2ViNzJkYzEwZWU3MGNmOTk3OTA3NDljMzQwN2UxNjEzZTk3NDMzZTI1OTI5
|
14
|
+
MTMzNThjY2JmYWI5N2Y1ZjdjMmU5ODk4YWVjZjUyNjc2MmMyNDU0ZjZkMGFj
|
15
|
+
Y2VlNzU4YWNmYTc1NTA2NDA0NWUxYzQzYjI2YWQ1MzRiYTM1YzU=
|
data/README.md
CHANGED
@@ -6,19 +6,19 @@ A ruby client to interact with the MxHero API
|
|
6
6
|
|
7
7
|
gem install mxhero-api
|
8
8
|
|
9
|
-
or in your Gemfile:
|
9
|
+
or in your Gemfile:
|
10
10
|
|
11
11
|
gem 'mxhero-api'
|
12
12
|
|
13
13
|
## Example of uses
|
14
14
|
|
15
|
-
Some examples, **complete documentation in the [API client documentation](http://www.rubydoc.info/
|
15
|
+
Some examples, **complete documentation in the [API client documentation](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html)**
|
16
16
|
|
17
17
|
### Instanciate a client
|
18
18
|
|
19
19
|
client = MxHero::API::Client.new(username: 'api username', password: 'api password', api_url: 'http://api-url-example.mxhero.com/api')
|
20
20
|
|
21
|
-
[See more](http://www.rubydoc.info/
|
21
|
+
[See more](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html#initialize-instance_method)
|
22
22
|
|
23
23
|
### Retrieve all the domains
|
24
24
|
|
@@ -27,21 +27,21 @@ Some examples, **complete documentation in the [API client documentation](http:/
|
|
27
27
|
|
28
28
|
# Return a hash, example:
|
29
29
|
#
|
30
|
-
# { :elements => [
|
30
|
+
# { :elements => [
|
31
31
|
# { :domain=>"tesla.com", :server=>"tesla.com", :creationDate=>1369837819000, :updatedDate=>1369837819000, :aliases=>nil, :ldap=>nil }
|
32
|
-
# ],
|
33
|
-
# :totalElements=>1,
|
34
|
-
# :totalPages=>1,
|
32
|
+
# ],
|
33
|
+
# :totalElements=>1,
|
34
|
+
# :totalPages=>1,
|
35
35
|
# :actualPage=>1
|
36
|
-
# }
|
36
|
+
# }
|
37
37
|
|
38
|
-
[See more](http://www.rubydoc.info/
|
38
|
+
[See more](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html#domains-instance_method)
|
39
39
|
|
40
40
|
### Retrieve all rules for one domain
|
41
41
|
|
42
|
-
rules = client.rules_for_domain('tesla.com')
|
42
|
+
rules = client.rules_for_domain('tesla.com')
|
43
43
|
|
44
|
-
[See more](http://www.rubydoc.info/
|
44
|
+
[See more](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html#rule_for_domain-instance_method)
|
45
45
|
|
46
46
|
### Create a rule for one domain
|
47
47
|
|
@@ -60,24 +60,24 @@ Some examples, **complete documentation in the [API client documentation](http:/
|
|
60
60
|
],
|
61
61
|
component: 'org.mxhero.feature.disclaimer'
|
62
62
|
}
|
63
|
-
|
63
|
+
|
64
64
|
# Create a rule for one domain
|
65
65
|
client.create_rule_for_domain('test.com', rule)
|
66
66
|
|
67
|
-
[See more](http://www.rubydoc.info/
|
67
|
+
[See more](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html#create_rule_for_domain-instance_method)
|
68
68
|
|
69
69
|
### Update a rule
|
70
70
|
|
71
71
|
client.update_rule(rule)
|
72
72
|
|
73
|
-
[See more](http://www.rubydoc.info/
|
73
|
+
[See more](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html#update_rule-instance_method)
|
74
74
|
|
75
75
|
### find a rule for one domain
|
76
76
|
|
77
77
|
client.domain_rule('tesla.com', 12)
|
78
78
|
|
79
|
-
[See more](http://www.rubydoc.info/
|
79
|
+
[See more](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html#domain_rule-instance_method)
|
80
80
|
|
81
81
|
## Complete documentation
|
82
82
|
|
83
|
-
Complete documentation in the [API client documentation](http://www.rubydoc.info/
|
83
|
+
Complete documentation in the [API client documentation](http://www.rubydoc.info/gems/mxhero-api/MxHero/API/Client.html)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.35
|
data/lib/mxhero-api.rb
CHANGED
@@ -123,6 +123,52 @@ module MxHero::API
|
|
123
123
|
end
|
124
124
|
|
125
125
|
|
126
|
+
# Create a new domain base on domain_obj hash
|
127
|
+
#
|
128
|
+
# @param domain_obj The domain to be created. For example:
|
129
|
+
# [Hash] with detailed domain
|
130
|
+
# * :domain [String]
|
131
|
+
# * :server [String]
|
132
|
+
# * :inbound [Boolean]
|
133
|
+
# * :outbound [Boolean]
|
134
|
+
# * :features [Array<Hash>]
|
135
|
+
# * :cos [Hash]
|
136
|
+
# * :source [String] (gapps|on_premise|ms_agent|office365)
|
137
|
+
# * :aliases [Array<String>]
|
138
|
+
# * :ldap [Hash]
|
139
|
+
#
|
140
|
+
# @return [Boolean] true if was successfully created
|
141
|
+
#
|
142
|
+
def create_domain(domain_obj = {})
|
143
|
+
response = call(:post, domains_url, domain_obj.to_json, throw_exception: false)
|
144
|
+
response.status == 201
|
145
|
+
end
|
146
|
+
|
147
|
+
# Create a new domain base on domain_obj hash
|
148
|
+
#
|
149
|
+
# @param domain_obj The domain to be created. For example:
|
150
|
+
# [Hash] with detailed domain
|
151
|
+
# * :domain [String]
|
152
|
+
# * :server [String]
|
153
|
+
# * :inbound [Boolean]
|
154
|
+
# * :outbound [Boolean]
|
155
|
+
# * :features [Array<Hash>]
|
156
|
+
# * :cos [Hash]
|
157
|
+
# * :source [String] (gapps|on_premise|ms_agent|office365)
|
158
|
+
# * :aliases [Array<String>]
|
159
|
+
# * :ldap [Hash]
|
160
|
+
#
|
161
|
+
# @return [Boolean] true if was successfully created
|
162
|
+
#
|
163
|
+
def add_feature(domain_name, feature_component)
|
164
|
+
feature = {
|
165
|
+
feature: feature_component,
|
166
|
+
maxRulesAmount: 1
|
167
|
+
}
|
168
|
+
response = call(:post, features_url(domain_name), feature.to_json, throw_exception: false)
|
169
|
+
response.status == 200
|
170
|
+
end
|
171
|
+
|
126
172
|
# Retrive the domain information
|
127
173
|
#
|
128
174
|
# @param name The domain name or id. For example: 'mydomain.com'
|
@@ -526,6 +572,10 @@ module MxHero::API
|
|
526
572
|
rules_for_domain_url(domain) + "/#{id}"
|
527
573
|
end
|
528
574
|
|
575
|
+
def features_url(domain)
|
576
|
+
domain_by_id_url(domain) + "/features"
|
577
|
+
end
|
578
|
+
|
529
579
|
def account_properties_url(domain, account)
|
530
580
|
accounts_by_domain_url(domain) + "/#{account}/properties"
|
531
581
|
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.35 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.35"
|
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-
|
10
|
+
s.date = "2014-11-06"
|
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/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"]
|
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"]
|
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/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/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,78 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/domains/newdomain_create.com//features
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ! '{"feature":"com.mxhero.application.mail2cloud.archive","maxRulesAmount":1}'
|
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
|
+
VGh1LCAwNiBOb3YgMjAxNCAxNTo1NDoyOSBHTVQ=
|
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: Thu, 06 Nov 2014 15:54:28 GMT
|
39
|
+
- request:
|
40
|
+
method: post
|
41
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/domains/newdomain_create.com//features
|
42
|
+
body:
|
43
|
+
encoding: UTF-8
|
44
|
+
string: ! '{"feature":"com.mxhero.application.mail2cloud.archive","maxRulesAmount":1}'
|
45
|
+
headers:
|
46
|
+
Accept:
|
47
|
+
- application/json
|
48
|
+
Content-Type:
|
49
|
+
- application/json
|
50
|
+
Authorization:
|
51
|
+
- Basic YWRtaW46cGFzc3dvcmQ=
|
52
|
+
response:
|
53
|
+
status:
|
54
|
+
code: 500
|
55
|
+
message: !binary |-
|
56
|
+
SW50ZXJuYWwgU2VydmVyIEVycm9y
|
57
|
+
headers:
|
58
|
+
!binary "RGF0ZQ==":
|
59
|
+
- !binary |-
|
60
|
+
VGh1LCAwNiBOb3YgMjAxNCAxNTo1NDoyOSBHTVQ=
|
61
|
+
!binary "U2VydmVy":
|
62
|
+
- !binary |-
|
63
|
+
QXBhY2hlLzIuMi4xNCAoVWJ1bnR1KQ==
|
64
|
+
!binary "Q29ubmVjdGlvbg==":
|
65
|
+
- !binary |-
|
66
|
+
Y2xvc2U=
|
67
|
+
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
68
|
+
- !binary |-
|
69
|
+
Y2h1bmtlZA==
|
70
|
+
!binary "Q29udGVudC1UeXBl":
|
71
|
+
- !binary |-
|
72
|
+
YXBwbGljYXRpb24vanNvbg==
|
73
|
+
body:
|
74
|
+
encoding: US-ASCII
|
75
|
+
string: ! '{"status":500,"code":500,"developerMessage":"domain.feature.already.exists","moreInfoUrl":"mailto:support@mxhero.com"}'
|
76
|
+
http_version:
|
77
|
+
recorded_at: Thu, 06 Nov 2014 15:54:29 GMT
|
78
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,83 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/domains
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ! '{"domain":"newdomain_create.com","inbound":false,"outbound":false,"aliases":["newdomain_create.com"],"source":"on_premise","cos":{"cos":"free"}}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic YWRtaW46cGFzc3dvcmQ=
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 201
|
19
|
+
message: !binary |-
|
20
|
+
Q3JlYXRlZA==
|
21
|
+
headers:
|
22
|
+
!binary "RGF0ZQ==":
|
23
|
+
- !binary |-
|
24
|
+
VGh1LCAwNiBOb3YgMjAxNCAxNTo0NDoxNSBHTVQ=
|
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: ! '{"domain":"newdomain_create.com","server":null,"relayServer":null,"inbound":false,"outbound":false,"creationDate":1415288655000,"updatedDate":1415288655000,"aliases":["newdomain_create.com"],"ldap":null,"features":[],"cos":{"cos":"free","edition":null},"cosLastChange":null,"allowedTransportAgents":null,"allowedIpMasks":null,"source":"on_premise","metadata":null}'
|
37
|
+
http_version:
|
38
|
+
recorded_at: Thu, 06 Nov 2014 15:44:15 GMT
|
39
|
+
- request:
|
40
|
+
method: post
|
41
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/domains
|
42
|
+
body:
|
43
|
+
encoding: UTF-8
|
44
|
+
string: ! '{"domain":"newdomain_create.com","inbound":false,"outbound":false,"aliases":["newdomain_create.com"],"source":"on_premise","cos":{"cos":"free"}}'
|
45
|
+
headers:
|
46
|
+
Accept:
|
47
|
+
- application/json
|
48
|
+
Content-Type:
|
49
|
+
- application/json
|
50
|
+
Authorization:
|
51
|
+
- Basic YWRtaW46cGFzc3dvcmQ=
|
52
|
+
response:
|
53
|
+
status:
|
54
|
+
code: 409
|
55
|
+
message: !binary |-
|
56
|
+
Q29uZmxpY3Q=
|
57
|
+
headers:
|
58
|
+
!binary "RGF0ZQ==":
|
59
|
+
- !binary |-
|
60
|
+
VGh1LCAwNiBOb3YgMjAxNCAxNTo0NDoxNSBHTVQ=
|
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":409,"code":409,"message":"PreparedStatementCallback; SQL
|
73
|
+
[INSERT INTO `mxhero`.`domain` (`domain`,`server`,`creation`,`updated`,`inbound`,`outbound`,`relay_server`,`cos`,`allowed_ip_masks`,`allowed_transport_agents`,`metadata`,`source`)
|
74
|
+
VALUES(?,?,?,?,?,?,?,?,?,?,?,?);]; Duplicate entry ''newdomain_create.com''
|
75
|
+
for key ''PRIMARY''; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
|
76
|
+
Duplicate entry ''newdomain_create.com'' for key ''PRIMARY''","developerMessage":"PreparedStatementCallback;
|
77
|
+
SQL [INSERT INTO `mxhero`.`domain` (`domain`,`server`,`creation`,`updated`,`inbound`,`outbound`,`relay_server`,`cos`,`allowed_ip_masks`,`allowed_transport_agents`,`metadata`,`source`)
|
78
|
+
VALUES(?,?,?,?,?,?,?,?,?,?,?,?);]; Duplicate entry ''newdomain_create.com''
|
79
|
+
for key ''PRIMARY''; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
|
80
|
+
Duplicate entry ''newdomain_create.com'' for key ''PRIMARY''","moreInfoUrl":"mailto:support@mxhero.com"}'
|
81
|
+
http_version:
|
82
|
+
recorded_at: Thu, 06 Nov 2014 15:44:15 GMT
|
83
|
+
recorded_with: VCR 2.5.0
|
data/test/test_mxhero_api.rb
CHANGED
@@ -75,6 +75,31 @@ class MxHeroAPITest < MiniTest::Unit::TestCase
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
+
def test_create_domain
|
79
|
+
VCR.use_cassette('create_domain') do
|
80
|
+
domain = {
|
81
|
+
domain: 'newdomain_create.com',
|
82
|
+
inbound: false,
|
83
|
+
outbound: false,
|
84
|
+
aliases: [ 'newdomain_create.com' ],
|
85
|
+
source: 'on_premise',
|
86
|
+
cos: {
|
87
|
+
cos: 'free'
|
88
|
+
}
|
89
|
+
}
|
90
|
+
assert @api.create_domain(domain)
|
91
|
+
assert !@api.create_domain(domain)
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_add_feature
|
97
|
+
VCR.use_cassette('add_feature') do
|
98
|
+
assert @api.add_feature('newdomain_create.com','com.mxhero.application.mail2cloud.archive')
|
99
|
+
assert !@api.add_feature('newdomain_create.com','com.mxhero.application.mail2cloud.archive')
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
78
103
|
def test_accounts_by_domain
|
79
104
|
VCR.use_cassette('accounts_from_domain') do
|
80
105
|
response = @api.accounts_by_domain(domain)
|
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.35
|
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-
|
13
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: vcr
|
@@ -91,8 +91,10 @@ files:
|
|
91
91
|
- test/fixtures/api/accounts_without_group.yml
|
92
92
|
- test/fixtures/api/add_an_inexistent_account_to_group.yml
|
93
93
|
- test/fixtures/api/add_and_remove_account.yml
|
94
|
+
- test/fixtures/api/add_feature.yml
|
94
95
|
- test/fixtures/api/all_groups.yml
|
95
96
|
- test/fixtures/api/create_directory.yml
|
97
|
+
- test/fixtures/api/create_domain.yml
|
96
98
|
- test/fixtures/api/create_rule_for_domain.yml
|
97
99
|
- test/fixtures/api/create_user.yml
|
98
100
|
- test/fixtures/api/delete_directory.yml
|
@@ -168,8 +170,10 @@ test_files:
|
|
168
170
|
- test/fixtures/api/accounts_without_group.yml
|
169
171
|
- test/fixtures/api/add_an_inexistent_account_to_group.yml
|
170
172
|
- test/fixtures/api/add_and_remove_account.yml
|
173
|
+
- test/fixtures/api/add_feature.yml
|
171
174
|
- test/fixtures/api/all_groups.yml
|
172
175
|
- test/fixtures/api/create_directory.yml
|
176
|
+
- test/fixtures/api/create_domain.yml
|
173
177
|
- test/fixtures/api/create_rule_for_domain.yml
|
174
178
|
- test/fixtures/api/create_user.yml
|
175
179
|
- test/fixtures/api/delete_directory.yml
|