mxhero-api 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/communication.rb +7 -3
- data/lib/mxhero-api.rb +2 -27
- data/lib/pst-converter.rb +4 -4
- data/lib/response.rb +32 -0
- data/mxhero-api.gemspec +5 -5
- data/test/fixtures/api/pst_inactive_tasks.yml +90 -0
- data/test/test_pst-converter.rb +20 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42101d6ead08f5bf94216d97e70f91a1a673c2bc
|
4
|
+
data.tar.gz: fe1d5b51c2c95cc3896e717c384d4bcfaee4ba87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e96b8b42ae8304bea0fab174c6fc54243221082cf491005b853a3503c6b841947fac11d6c0798f7cdb4d3b616b419669669945846e84abcd8f24c514ee803c11
|
7
|
+
data.tar.gz: be1741093de3f0dfa6c0e844fcd71321962965a27849da2278a3200d4d077584d5632048676ababe5631e22743f7e90585d0ded9699c224c022345c69a5d1b04
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.2
|
data/lib/communication.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
+
require 'httpclient'
|
2
|
+
require 'json'
|
3
|
+
require_relative 'response'
|
4
|
+
|
1
5
|
module MxHero
|
2
6
|
module API
|
3
7
|
module Communication
|
4
|
-
|
5
|
-
# Make a HTTP call
|
8
|
+
|
9
|
+
# Make a HTTP call
|
6
10
|
# @param method [Symbol] indicate the HTTP verb (:get, :post, :put, etc)
|
7
11
|
# @param url [String]
|
8
12
|
# @param body [String] (default: nil)
|
@@ -25,7 +29,7 @@ module MxHero
|
|
25
29
|
def headers
|
26
30
|
@headers ||= { 'Accept' => 'application/json', 'Content-Type' => 'application/json' }
|
27
31
|
end
|
28
|
-
|
32
|
+
|
29
33
|
# @return [Hash]
|
30
34
|
def json_parse(json)
|
31
35
|
JSON.parse(json, symbolize_names: true)
|
data/lib/mxhero-api.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require 'httpclient'
|
3
|
-
require 'json'
|
2
|
+
#require 'httpclient'
|
3
|
+
#require 'json'
|
4
4
|
require 'date'
|
5
5
|
require 'cgi'
|
6
6
|
|
@@ -16,31 +16,6 @@ require 'resources/domain'
|
|
16
16
|
require 'resources/group'
|
17
17
|
|
18
18
|
module MxHero::API
|
19
|
-
# The class that contains the response information
|
20
|
-
#
|
21
|
-
# The *code* represent the HTTP code of the response.
|
22
|
-
#
|
23
|
-
# The *msg* represent a hash with the response information. Example:
|
24
|
-
#
|
25
|
-
# { status: 500, code: 500,
|
26
|
-
# developerMessage: "rules.already.exists.for.component",
|
27
|
-
# moreInfoUrl: "mailto:support@mxhero.com" }
|
28
|
-
#
|
29
|
-
class Response < Struct.new(:code, :msg)
|
30
|
-
|
31
|
-
# Response is successful? Based in HTTP status code
|
32
|
-
def success?
|
33
|
-
code.to_i == 200 || code.to_i == 201
|
34
|
-
end
|
35
|
-
|
36
|
-
# @return [String] the error message
|
37
|
-
def error
|
38
|
-
content[:developerMessage] if content.is_a? Hash
|
39
|
-
end
|
40
|
-
|
41
|
-
alias_method :content, :msg
|
42
|
-
alias_method :content=, :msg=
|
43
|
-
end
|
44
19
|
|
45
20
|
# A client to interact with mxhero engine API
|
46
21
|
class Client
|
data/lib/pst-converter.rb
CHANGED
@@ -24,8 +24,8 @@ module MxHero::API
|
|
24
24
|
# @param [String] account The account to search tasks for
|
25
25
|
# @return [MxHero::API::Response] response
|
26
26
|
['active', 'inactive'].each do |status|
|
27
|
-
define_method("#{status}_tasks") do |account|
|
28
|
-
response = call(:get, url_pst_status(account, status))
|
27
|
+
define_method("#{status}_tasks") do |account, limit = nil|
|
28
|
+
response = call(:get, url_pst_status(account, status, limit))
|
29
29
|
parse_response(response, on_empty: [])
|
30
30
|
end
|
31
31
|
end
|
@@ -61,8 +61,8 @@ module MxHero::API
|
|
61
61
|
"#{url_pst(account)}/#{id}"
|
62
62
|
end
|
63
63
|
|
64
|
-
def url_pst_status(account, status)
|
65
|
-
"#{url_pst(account)}/#{status}"
|
64
|
+
def url_pst_status(account, status, limit)
|
65
|
+
"#{url_pst(account)}/#{status}" + (limit ? "?limit=#{limit}" : "")
|
66
66
|
end
|
67
67
|
|
68
68
|
# @return [MxHero::API::Response] a response object
|
data/lib/response.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
module MxHero
|
3
|
+
module API
|
4
|
+
|
5
|
+
# The class that contains the response information
|
6
|
+
#
|
7
|
+
# The *code* represent the HTTP code of the response.
|
8
|
+
#
|
9
|
+
# The *msg* represent a hash with the response information. Example:
|
10
|
+
#
|
11
|
+
# { status: 500, code: 500,
|
12
|
+
# developerMessage: "rules.already.exists.for.component",
|
13
|
+
# moreInfoUrl: "mailto:support@mxhero.com" }
|
14
|
+
#
|
15
|
+
class Response < Struct.new(:code, :msg)
|
16
|
+
|
17
|
+
# Response is successful? Based in HTTP status code
|
18
|
+
def success?
|
19
|
+
code.to_i == 200 || code.to_i == 201
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [String] the error message
|
23
|
+
def error
|
24
|
+
content[:developerMessage] if content.is_a? Hash
|
25
|
+
end
|
26
|
+
|
27
|
+
alias_method :content, :msg
|
28
|
+
alias_method :content=, :msg=
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
data/mxhero-api.gemspec
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: mxhero-api 1.1.
|
2
|
+
# stub: mxhero-api 1.1.2 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "mxhero-api"
|
6
|
-
s.version = "1.1.
|
6
|
+
s.version = "1.1.2"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Maximiliano Dello Russo", "Juan Pablo Royo", "mxHero"]
|
11
|
-
s.date = "2016-05-
|
11
|
+
s.date = "2016-05-24"
|
12
12
|
s.description = "A gem to provide easy access to the API of MxHero platform (http://www.mxhero.com/)"
|
13
13
|
s.email = ["maxidr@mxhero.com", "juanpablo.royo@gmail.com", "mxhero@mxhero.com"]
|
14
|
-
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/pst-converter.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/associate_user_domain.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/rule_status.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/users_for_domain.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
|
+
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/pst-converter.rb", "lib/resource.rb", "lib/resources/account.rb", "lib/resources/domain.rb", "lib/resources/group.rb", "lib/response.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/associate_user_domain.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/pst_inactive_tasks.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/rule_status.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/users_for_domain.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_pst-converter.rb", "test/test_resource.rb"]
|
15
15
|
s.homepage = "http://github.com/mxhero/mxhero-api"
|
16
16
|
s.licenses = ["GPL-3"]
|
17
17
|
s.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
18
18
|
s.rubygems_version = "2.5.1"
|
19
19
|
s.summary = "A MxHero API client for ruby"
|
20
|
-
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/associate_user_domain.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/rule_status.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/users_for_domain.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
|
+
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/associate_user_domain.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/pst_inactive_tasks.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/rule_status.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/users_for_domain.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_pst-converter.rb", "test/test_resource.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
s.specification_version = 4
|
@@ -0,0 +1,90 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/pst/mxhero.com/inactive?limit=5
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ''
|
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: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- Apache-Coyote/1.1
|
23
|
+
Content-Type:
|
24
|
+
- application/json
|
25
|
+
Transfer-Encoding:
|
26
|
+
- chunked
|
27
|
+
Date:
|
28
|
+
- Tue, 24 May 2016 18:56:41 GMT
|
29
|
+
body:
|
30
|
+
encoding: UTF-8
|
31
|
+
string: '[{"taskId":"e110386d-1eec-481c-abaa-e80ad20216ff","phase":"done","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":true,"storageType":"drive","storageData":{"adminAccount":"jproyo@mxhero.com","storageAccount":"mmarmol@mxhero.com"},"folderStructure":"mail2cloud/pst/mmarmol@mxhero.com/${folder}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"fileName":"richard_shapiro_001_1_1_1_2.pst","emailSent":true,"count":7382016.0,"length":7382016.0,"updateTime":1.461347817717E12,"status":"DONE"},"extract":{"extracted":143.0},"upload":{"uploadedFiles":1.0,"folderUrl":"https://docs.google.com/a/mxhero.com/folderview?id=0B9H_FCIZ3vRhejk5ODRRRlRZQTQ&usp=drivesdk","folder":"mail2cloud/pst/mmarmol@mxhero.com/","updateTime":1.461347865892E12}},"errors":null,"createdAt":1461347816971},{"taskId":"a0ce1ad9-ad95-4145-b654-5c2d1dd77808","phase":"done","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":true,"storageType":"drive","storageData":{"adminAccount":"jproyo@mxhero.com","storageAccount":"mmarmol@mxhero.com"},"folderStructure":"mail2cloud/pst/mmarmol@mxhero.com/${folder}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"fileName":"richard_shapiro_001_1_1_1_2.pst","emailSent":true,"count":7382016.0,"length":7382016.0,"updateTime":1.461357719534E12,"status":"DONE"},"extract":{"extracted":144.0},"upload":{"uploadedFiles":1.0,"folderUrl":"https://docs.google.com/a/mxhero.com/folderview?id=0B9H_FCIZ3vRhejk5ODRRRlRZQTQ&usp=drivesdk","folder":"mail2cloud/pst/mmarmol@mxhero.com/","updateTime":1.461358016794E12}},"errors":null,"createdAt":1461357718269},{"taskId":"5baabdaf-deca-42dc-a177-f5e317b12910","phase":"done","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":false,"storageType":"box","storageData":{"adminAccount":"mmarmol@mxhero.com","storageAccount":"mmarmol@mxhero.com"},"folderStructure":"newdynamodb/M2C
|
32
|
+
PST Importer/${folderName}/${from}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"fileName":"richard_shapiro_001_1_1_1.pst","emailSent":true,"count":7382016.0,"length":7382016.0,"updateTime":1.461363500105E12,"status":"DONE"},"extract":{"extracted":144.0},"upload":{"uploadedFiles":49.0,"folderUrl":"https://app.box.com/files/0/f/7599867885","folder":"newdynamodb/M2C
|
33
|
+
PST Importer/","lastMessageSent_date":"2001-08-27T19:40:39.000Z","lastMessageFrom":"<>","lastMessageSubject":"Stuart","updateTime":1.461363775098E12,"lastMessageSender":"<>"}},"errors":{"upload":{"exception":"com.mxhero.plugin.cloudstorage.service.upload.NotRecoveryException","errorTime":1.461363673174E12,"file":"AAAAAIcQWPRB0PJEr7_Zi6hOf_JEBCAA.msg","code":500.0,"name":"unknown","message":"Error
|
34
|
+
uploading files to box"}},"createdAt":1461363493523},{"taskId":"7fab83e8-3830-4008-8afe-fdf2ae12a822","phase":"done","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":false,"storageType":"box","storageData":{"adminAccount":"jproyo@mxhero.com","storageAccount":"jproyo@mxhero.com"},"folderStructure":"M2C
|
35
|
+
PST Importer/${folderName}/${from}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"fileName":"richard_shapiro_001_1_1_1.pst","emailSent":true,"count":7382016.0,"length":7382016.0,"updateTime":1.46139661239E12,"status":"DONE"},"extract":{"extracted":144.0},"upload":{"uploadedFiles":50.0,"folderUrl":"https://app.box.com/files/0/f/7560539205","folder":"M2C
|
36
|
+
PST Importer/","lastMessageSent_date":"2001-08-27T19:40:39.000Z","lastMessageFrom":"<>","lastMessageSubject":"Stuart","updateTime":1.461396769069E12,"lastMessageSender":"<>"}},"errors":null,"createdAt":1461396607272},{"taskId":"4578d48d-04bf-4645-974a-51a47fab6181","phase":"done","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":false,"storageType":"box","storageData":{"adminAccount":"jproyo@mxhero.com","storageAccount":"jproyo@mxhero.com"},"folderStructure":"M2C
|
37
|
+
PST Importer/${folderName}/${from}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"fileName":"richard_shapiro_001_1_1_1.pst","emailSent":true,"count":7382016.0,"length":7382016.0,"updateTime":1.461396952167E12,"status":"DONE"},"extract":{"extracted":144.0},"upload":{"uploadedFiles":50.0,"folderUrl":"https://app.box.com/files/0/f/7560539205","folder":"M2C
|
38
|
+
PST Importer/","lastMessageSent_date":"2001-10-17T21:14:29.000Z","lastMessageFrom":"Jeff.Dasovich@ENRON.com","lastMessageSubject":"FW:
|
39
|
+
Thoughts on PX Credit Claim with Edison","updateTime":1.461397061623E12,"lastMessageTo":"James.D.Steffes@ENRON.com,Susan.J.Mara@ENRON.com","lastMessageSender":"<>"}},"errors":null,"createdAt":1461396946264}]'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Tue, 24 May 2016 18:56:43 GMT
|
42
|
+
- request:
|
43
|
+
method: get
|
44
|
+
uri: http://admin:password@test.mxhero.com/webapi/api/v1/pst/mxhero.com/inactive
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: ''
|
48
|
+
headers:
|
49
|
+
Accept:
|
50
|
+
- application/json
|
51
|
+
Content-Type:
|
52
|
+
- application/json
|
53
|
+
Authorization:
|
54
|
+
- Basic YWRtaW46bXgraGVybw==
|
55
|
+
response:
|
56
|
+
status:
|
57
|
+
code: 200
|
58
|
+
message: OK
|
59
|
+
headers:
|
60
|
+
Server:
|
61
|
+
- Apache-Coyote/1.1
|
62
|
+
Content-Type:
|
63
|
+
- application/json
|
64
|
+
Transfer-Encoding:
|
65
|
+
- chunked
|
66
|
+
Date:
|
67
|
+
- Tue, 24 May 2016 18:56:41 GMT
|
68
|
+
body:
|
69
|
+
encoding: UTF-8
|
70
|
+
string: '[{"taskId":"e110386d-1eec-481c-abaa-e80ad20216ff","phase":"done","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":true,"storageType":"drive","storageData":{"adminAccount":"jproyo@mxhero.com","storageAccount":"mmarmol@mxhero.com"},"folderStructure":"mail2cloud/pst/mmarmol@mxhero.com/${folder}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"fileName":"richard_shapiro_001_1_1_1_2.pst","emailSent":true,"count":7382016.0,"length":7382016.0,"updateTime":1.461347817717E12,"status":"DONE"},"extract":{"extracted":143.0},"upload":{"uploadedFiles":1.0,"folderUrl":"https://docs.google.com/a/mxhero.com/folderview?id=0B9H_FCIZ3vRhejk5ODRRRlRZQTQ&usp=drivesdk","folder":"mail2cloud/pst/mmarmol@mxhero.com/","updateTime":1.461347865892E12}},"errors":null,"createdAt":1461347816971},{"taskId":"a0ce1ad9-ad95-4145-b654-5c2d1dd77808","phase":"done","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":true,"storageType":"drive","storageData":{"adminAccount":"jproyo@mxhero.com","storageAccount":"mmarmol@mxhero.com"},"folderStructure":"mail2cloud/pst/mmarmol@mxhero.com/${folder}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"fileName":"richard_shapiro_001_1_1_1_2.pst","emailSent":true,"count":7382016.0,"length":7382016.0,"updateTime":1.461357719534E12,"status":"DONE"},"extract":{"extracted":144.0},"upload":{"uploadedFiles":1.0,"folderUrl":"https://docs.google.com/a/mxhero.com/folderview?id=0B9H_FCIZ3vRhejk5ODRRRlRZQTQ&usp=drivesdk","folder":"mail2cloud/pst/mmarmol@mxhero.com/","updateTime":1.461358016794E12}},"errors":null,"createdAt":1461357718269},{"taskId":"5baabdaf-deca-42dc-a177-f5e317b12910","phase":"done","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":false,"storageType":"box","storageData":{"adminAccount":"mmarmol@mxhero.com","storageAccount":"mmarmol@mxhero.com"},"folderStructure":"newdynamodb/M2C
|
71
|
+
PST Importer/${folderName}/${from}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"fileName":"richard_shapiro_001_1_1_1.pst","emailSent":true,"count":7382016.0,"length":7382016.0,"updateTime":1.461363500105E12,"status":"DONE"},"extract":{"extracted":144.0},"upload":{"uploadedFiles":49.0,"folderUrl":"https://app.box.com/files/0/f/7599867885","folder":"newdynamodb/M2C
|
72
|
+
PST Importer/","lastMessageSent_date":"2001-08-27T19:40:39.000Z","lastMessageFrom":"<>","lastMessageSubject":"Stuart","updateTime":1.461363775098E12,"lastMessageSender":"<>"}},"errors":{"upload":{"exception":"com.mxhero.plugin.cloudstorage.service.upload.NotRecoveryException","errorTime":1.461363673174E12,"file":"AAAAAIcQWPRB0PJEr7_Zi6hOf_JEBCAA.msg","code":500.0,"name":"unknown","message":"Error
|
73
|
+
uploading files to box"}},"createdAt":1461363493523},{"taskId":"7fab83e8-3830-4008-8afe-fdf2ae12a822","phase":"done","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":false,"storageType":"box","storageData":{"adminAccount":"jproyo@mxhero.com","storageAccount":"jproyo@mxhero.com"},"folderStructure":"M2C
|
74
|
+
PST Importer/${folderName}/${from}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"fileName":"richard_shapiro_001_1_1_1.pst","emailSent":true,"count":7382016.0,"length":7382016.0,"updateTime":1.46139661239E12,"status":"DONE"},"extract":{"extracted":144.0},"upload":{"uploadedFiles":50.0,"folderUrl":"https://app.box.com/files/0/f/7560539205","folder":"M2C
|
75
|
+
PST Importer/","lastMessageSent_date":"2001-08-27T19:40:39.000Z","lastMessageFrom":"<>","lastMessageSubject":"Stuart","updateTime":1.461396769069E12,"lastMessageSender":"<>"}},"errors":null,"createdAt":1461396607272},{"taskId":"4578d48d-04bf-4645-974a-51a47fab6181","phase":"done","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":false,"storageType":"box","storageData":{"adminAccount":"jproyo@mxhero.com","storageAccount":"jproyo@mxhero.com"},"folderStructure":"M2C
|
76
|
+
PST Importer/${folderName}/${from}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"fileName":"richard_shapiro_001_1_1_1.pst","emailSent":true,"count":7382016.0,"length":7382016.0,"updateTime":1.461396952167E12,"status":"DONE"},"extract":{"extracted":144.0},"upload":{"uploadedFiles":50.0,"folderUrl":"https://app.box.com/files/0/f/7560539205","folder":"M2C
|
77
|
+
PST Importer/","lastMessageSent_date":"2001-10-17T21:14:29.000Z","lastMessageFrom":"Jeff.Dasovich@ENRON.com","lastMessageSubject":"FW:
|
78
|
+
Thoughts on PX Credit Claim with Edison","updateTime":1.461397061623E12,"lastMessageTo":"James.D.Steffes@ENRON.com,Susan.J.Mara@ENRON.com","lastMessageSender":"<>"}},"errors":null,"createdAt":1461396946264},{"taskId":"37db8511-1624-45b2-b84b-015de7192e22","phase":"done","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":false,"storageType":"box","storageData":{"adminAccount":"jproyo@mxhero.com","storageAccount":"jproyo@mxhero.com"},"folderStructure":"M2C
|
79
|
+
PST Importer/${folderName}/${from}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"fileName":"richard_shapiro_001_1_1_1.pst","emailSent":true,"count":7382016.0,"length":7382016.0,"updateTime":1.461397404361E12,"status":"DONE"},"extract":{"extracted":144.0},"upload":{"uploadedFiles":50.0,"folderUrl":"https://app.box.com/files/0/f/7560539205","folder":"M2C
|
80
|
+
PST Importer/","lastMessageSent_date":"2001-08-27T19:40:39.000Z","lastMessageFrom":"<>","lastMessageSubject":"Stuart","updateTime":1.461397517921E12,"lastMessageSender":"<>"}},"errors":null,"createdAt":1461397399256},{"taskId":"8485eec4-7be6-4a96-9c56-0457f465f497","phase":"error","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":false,"storageType":"box","storageData":{"adminAccount":"jproyo@mxhero.com","storageAccount":"jproyo@mxhero.com"},"folderStructure":"M2C
|
81
|
+
PST Importer/${folderName}/${from}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"updateTime":1.461409325241E12,"status":"EXTRACTING"}},"errors":null,"createdAt":1461409325212},{"taskId":"92473d2e-8ccb-47e0-b3e2-3695d050d4e1","phase":"error","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":false,"storageType":"box","storageData":{"adminAccount":"jproyo@mxhero.com","storageAccount":"jproyo@mxhero.com"},"folderStructure":"M2C
|
82
|
+
PST Importer/${folderName}/${from}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"updateTime":1.461409436267E12,"status":"EXTRACTING"}},"errors":null,"createdAt":1461409436252},{"taskId":"5d49abe2-e8ca-4c6d-89f3-df0df2a82bed","phase":"error","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":false,"storageType":"box","storageData":{"adminAccount":"jproyo@mxhero.com","storageAccount":"jproyo@mxhero.com"},"folderStructure":"M2C
|
83
|
+
PST Importer/${folderName}/${from}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"updateTime":1.461409787274E12,"status":"EXTRACTING"}},"errors":null,"createdAt":1461409787261},{"taskId":"e475b2c6-01f4-4973-b170-abe72fca597d","phase":"done","uploadData":{"locale":"en_US","storeMail":true,"storeAttachments":true,"storePdfMessage":true,"doNotoverwriteFiles":false,"storageType":"box","storageData":{"adminAccount":"maxidr@mxhero.com","storageAccount":"maxidr@mxhero.com"},"folderStructure":"M2C
|
84
|
+
PST Importer/${folderName}/${from}/${subject}","maxUploads":0,"attachmentsSubfolder":null,"originalEmailSubfolder":null,"bodySubfolder":null},"account":"mxhero.com","data":{"download":{"fileName":"richard_shapiro_001_1_1_1.pst","emailSent":true,"count":7382016.0,"length":7382016.0,"updateTime":1.462895940246E12,"status":"DONE"},"extract":{"extracted":144.0},"upload":{"uploadedFiles":49.0,"folderUrl":"https://app.box.com/files/0/f/7858049397","folder":"M2C
|
85
|
+
PST Importer/","lastMessageSent_date":"2001-10-09T23:16:10.000Z","lastMessageFrom":"Donna.Fulton@ENRON.com","lastMessageSubject":"FERC
|
86
|
+
ALJ Initial Decision on El Paso affiliate abuse","updateTime":1.462896265425E12,"lastMessageTo":"steve.kean@enron.com,Richard.Shapiro@ENRON.com","lastMessageSender":"<>"}},"errors":{"upload":{"exception":"com.mxhero.plugin.cloudstorage.service.upload.NotRecoveryException","errorTime":1.4628961315E12,"file":"AAAAAIcQWPRB0PJEr7_Zi6hOf_IkBCAA.msg","code":500.0,"name":"unknown","message":"Error
|
87
|
+
uploading files to box"}},"createdAt":1462895933650}]'
|
88
|
+
http_version:
|
89
|
+
recorded_at: Tue, 24 May 2016 18:56:44 GMT
|
90
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative 'helper'
|
2
|
+
|
3
|
+
class PSTConverterTest < Minitest::Test
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@api = MxHero::API::PSTConverter.new(username: TEST_API_USER, password: TEST_API_PASSWORD, verbose: false, api_url: TEST_API_URL)
|
7
|
+
end
|
8
|
+
|
9
|
+
def domain
|
10
|
+
TEST_API_DOMAIN
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_fetch_inactive_tasks
|
14
|
+
VCR.use_cassette('pst_inactive_tasks') do
|
15
|
+
assert_equal 5, @api.inactive_tasks('mxhero.com', 5).msg.length
|
16
|
+
assert_equal 10, @api.inactive_tasks('mxhero.com').msg.length
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
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: 1.1.
|
4
|
+
version: 1.1.2
|
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: 2016-05-
|
13
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: vcr
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- lib/resources/account.rb
|
82
82
|
- lib/resources/domain.rb
|
83
83
|
- lib/resources/group.rb
|
84
|
+
- lib/response.rb
|
84
85
|
- lib/urls.rb
|
85
86
|
- mxhero-api.gemspec
|
86
87
|
- test/fixtures/api/account_properties.yml
|
@@ -110,6 +111,7 @@ files:
|
|
110
111
|
- test/fixtures/api/fetch_user.yml
|
111
112
|
- test/fixtures/api/ldap_info.yml
|
112
113
|
- test/fixtures/api/move_to_trial.yml
|
114
|
+
- test/fixtures/api/pst_inactive_tasks.yml
|
113
115
|
- test/fixtures/api/refresh_directory.yml
|
114
116
|
- test/fixtures/api/remove_account_from_group_twice.yml
|
115
117
|
- test/fixtures/api/remove_inexistente_account_from_group.yml
|
@@ -139,6 +141,7 @@ files:
|
|
139
141
|
- test/test_groups.rb
|
140
142
|
- test/test_mxhero_api.rb
|
141
143
|
- test/test_mxhero_api_response.rb
|
144
|
+
- test/test_pst-converter.rb
|
142
145
|
- test/test_resource.rb
|
143
146
|
homepage: http://github.com/mxhero/mxhero-api
|
144
147
|
licenses:
|
@@ -192,6 +195,7 @@ test_files:
|
|
192
195
|
- test/fixtures/api/fetch_user.yml
|
193
196
|
- test/fixtures/api/ldap_info.yml
|
194
197
|
- test/fixtures/api/move_to_trial.yml
|
198
|
+
- test/fixtures/api/pst_inactive_tasks.yml
|
195
199
|
- test/fixtures/api/refresh_directory.yml
|
196
200
|
- test/fixtures/api/remove_account_from_group_twice.yml
|
197
201
|
- test/fixtures/api/remove_inexistente_account_from_group.yml
|
@@ -221,4 +225,5 @@ test_files:
|
|
221
225
|
- test/test_groups.rb
|
222
226
|
- test/test_mxhero_api.rb
|
223
227
|
- test/test_mxhero_api_response.rb
|
228
|
+
- test/test_pst-converter.rb
|
224
229
|
- test/test_resource.rb
|