pepipost_gem 2.5.0 → 5.0.0
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 +4 -4
- data/LICENSE +6 -13
- data/README.md +123 -77
- data/lib/pepipost.rb +74 -0
- data/lib/{pepipost_gem → pepipost}/api_helper.rb +5 -3
- data/lib/pepipost/configuration.rb +24 -0
- data/lib/{pepipost_gem → pepipost}/controllers/base_controller.rb +10 -5
- data/lib/pepipost/controllers/domain_controller.rb +68 -0
- data/lib/pepipost/controllers/domain_delete_controller.rb +67 -0
- data/lib/pepipost/controllers/events_controller.rb +104 -0
- data/lib/pepipost/controllers/mail_send_controller.rb +54 -0
- data/lib/pepipost/controllers/setrecurringcreditddetails_controller.rb +68 -0
- data/lib/pepipost/controllers/stats_controller.rb +82 -0
- data/lib/pepipost/controllers/subaccounts_controller.rb +68 -0
- data/lib/pepipost/controllers/subaccounts_create_subaccount_controller.rb +68 -0
- data/lib/pepipost/controllers/subaccounts_delete_controller.rb +67 -0
- data/lib/pepipost/controllers/subaccounts_get_sub_accounts_controller.rb +71 -0
- data/lib/pepipost/controllers/subaccounts_setsubaccountcredit_controller.rb +68 -0
- data/lib/pepipost/controllers/subaccounts_update_subaccount_controller.rb +67 -0
- data/lib/pepipost/controllers/suppression_controller.rb +121 -0
- data/lib/{pepipost_gem → pepipost}/exceptions/api_exception.rb +5 -3
- data/lib/pepipost/http/auth/custom_header_auth.rb +16 -0
- data/lib/{pepipost_gem → pepipost}/http/faraday_client.rb +17 -8
- data/lib/{pepipost_gem → pepipost}/http/http_call_back.rb +5 -3
- data/lib/{pepipost_gem → pepipost}/http/http_client.rb +5 -3
- data/lib/{pepipost_gem → pepipost}/http/http_context.rb +5 -3
- data/lib/{pepipost_gem → pepipost}/http/http_method_enum.rb +5 -3
- data/lib/{pepipost_gem → pepipost}/http/http_request.rb +5 -3
- data/lib/{pepipost_gem → pepipost}/http/http_response.rb +5 -3
- data/lib/pepipost/models/action_enum.rb +18 -0
- data/lib/pepipost/models/add_email_or_domain_to_suppression_list.rb +48 -0
- data/lib/pepipost/models/aggregated_by_enum.rb +20 -0
- data/lib/pepipost/models/attachments.rb +44 -0
- data/lib/{pepipost_gem → pepipost}/models/base_model.rb +5 -3
- data/lib/pepipost/models/content.rb +44 -0
- data/lib/pepipost/models/create_subaccount.rb +76 -0
- data/lib/pepipost/models/delete_domain.rb +35 -0
- data/lib/pepipost/models/delete_subacoount.rb +35 -0
- data/lib/pepipost/models/domain_struct.rb +45 -0
- data/lib/pepipost/models/email_struct.rb +44 -0
- data/lib/pepipost/models/enable_or_disable_subacoount.rb +44 -0
- data/lib/pepipost/models/events_enum.rb +44 -0
- data/lib/pepipost/models/from.rb +44 -0
- data/lib/pepipost/models/personalizations.rb +135 -0
- data/lib/pepipost/models/remove_email_or_domain_to_suppression_list.rb +48 -0
- data/lib/pepipost/models/send.rb +164 -0
- data/lib/pepipost/models/settings.rb +71 -0
- data/lib/pepipost/models/sort_enum.rb +17 -0
- data/lib/pepipost/models/timeperiod_enum.rb +20 -0
- data/lib/pepipost/models/type_enum.rb +17 -0
- data/lib/pepipost/models/update_credis_of_subaccount.rb +54 -0
- data/lib/pepipost/models/update_recurring_credis_of_subaccount.rb +80 -0
- data/lib/pepipost/models/update_subaccount.rb +72 -0
- data/lib/pepipost/pepipost_client.rb +99 -0
- metadata +98 -54
- data/lib/pepipost_gem.rb +0 -40
- data/lib/pepipost_gem/configuration.rb +0 -17
- data/lib/pepipost_gem/controllers/email_controller.rb +0 -59
- data/lib/pepipost_gem/models/attachments.rb +0 -42
- data/lib/pepipost_gem/models/attribute.rb +0 -42
- data/lib/pepipost_gem/models/email_body.rb +0 -119
- data/lib/pepipost_gem/models/email_body_attachments.rb +0 -42
- data/lib/pepipost_gem/models/from.rb +0 -42
- data/lib/pepipost_gem/models/personalizations.rb +0 -85
- data/lib/pepipost_gem/models/send_email_error.rb +0 -42
- data/lib/pepipost_gem/models/send_email_response.rb +0 -52
- data/lib/pepipost_gem/models/settings.rb +0 -69
- data/lib/pepipost_gem/pepipost_gem_client.rb +0 -19
@@ -0,0 +1,68 @@
|
|
1
|
+
# pepipost
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module Pepipost
|
7
|
+
# DomainController
|
8
|
+
class DomainController < BaseController
|
9
|
+
@instance = DomainController.new
|
10
|
+
|
11
|
+
class << self
|
12
|
+
attr_accessor :instance
|
13
|
+
end
|
14
|
+
|
15
|
+
def instance
|
16
|
+
self.class.instance
|
17
|
+
end
|
18
|
+
|
19
|
+
# This endpoint enables you to add a sending domain which is one of the
|
20
|
+
# pre-requisites for sending emails.
|
21
|
+
# @param [DomainStruct] body Required parameter: Add new domain
|
22
|
+
# @return Object response from the API call
|
23
|
+
def add_domain(body)
|
24
|
+
# Prepare query url.
|
25
|
+
_path_url = '/domain'
|
26
|
+
_query_builder = Configuration.base_uri.dup
|
27
|
+
_query_builder << _path_url
|
28
|
+
_query_url = APIHelper.clean_url _query_builder
|
29
|
+
# Prepare headers.
|
30
|
+
_headers = {
|
31
|
+
'content-type' => 'application/json; charset=utf-8'
|
32
|
+
}
|
33
|
+
# Prepare and execute HttpRequest.
|
34
|
+
_request = @http_client.post(
|
35
|
+
_query_url,
|
36
|
+
headers: _headers,
|
37
|
+
parameters: body.to_json
|
38
|
+
)
|
39
|
+
CustomHeaderAuth.apply(_request)
|
40
|
+
_context = execute_request(_request)
|
41
|
+
# Validate response against endpoint and global error codes.
|
42
|
+
if _context.response.status_code == 400
|
43
|
+
raise APIException.new(
|
44
|
+
'API Response',
|
45
|
+
_context
|
46
|
+
)
|
47
|
+
elsif _context.response.status_code == 401
|
48
|
+
raise APIException.new(
|
49
|
+
'API Response',
|
50
|
+
_context
|
51
|
+
)
|
52
|
+
elsif _context.response.status_code == 403
|
53
|
+
raise APIException.new(
|
54
|
+
'API Response',
|
55
|
+
_context
|
56
|
+
)
|
57
|
+
elsif _context.response.status_code == 405
|
58
|
+
raise APIException.new(
|
59
|
+
'Invalid input',
|
60
|
+
_context
|
61
|
+
)
|
62
|
+
end
|
63
|
+
validate_response(_context)
|
64
|
+
# Return appropriate response type.
|
65
|
+
_context.response.raw_body
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# pepipost
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module Pepipost
|
7
|
+
# DomainDeleteController
|
8
|
+
class DomainDeleteController < BaseController
|
9
|
+
@instance = DomainDeleteController.new
|
10
|
+
|
11
|
+
class << self
|
12
|
+
attr_accessor :instance
|
13
|
+
end
|
14
|
+
|
15
|
+
def instance
|
16
|
+
self.class.instance
|
17
|
+
end
|
18
|
+
|
19
|
+
# This endpoint allows you to delete a domain from your Pepipost account.
|
20
|
+
# @param [DeleteDomain] body Required parameter: delete domain
|
21
|
+
# @return Object response from the API call
|
22
|
+
def delete_domain(body)
|
23
|
+
# Prepare query url.
|
24
|
+
_path_url = '/domain/delete'
|
25
|
+
_query_builder = Configuration.base_uri.dup
|
26
|
+
_query_builder << _path_url
|
27
|
+
_query_url = APIHelper.clean_url _query_builder
|
28
|
+
# Prepare headers.
|
29
|
+
_headers = {
|
30
|
+
'content-type' => 'application/json; charset=utf-8'
|
31
|
+
}
|
32
|
+
# Prepare and execute HttpRequest.
|
33
|
+
_request = @http_client.delete(
|
34
|
+
_query_url,
|
35
|
+
headers: _headers,
|
36
|
+
parameters: body.to_json
|
37
|
+
)
|
38
|
+
CustomHeaderAuth.apply(_request)
|
39
|
+
_context = execute_request(_request)
|
40
|
+
# Validate response against endpoint and global error codes.
|
41
|
+
if _context.response.status_code == 400
|
42
|
+
raise APIException.new(
|
43
|
+
'API Response',
|
44
|
+
_context
|
45
|
+
)
|
46
|
+
elsif _context.response.status_code == 401
|
47
|
+
raise APIException.new(
|
48
|
+
'API Response',
|
49
|
+
_context
|
50
|
+
)
|
51
|
+
elsif _context.response.status_code == 403
|
52
|
+
raise APIException.new(
|
53
|
+
'API Response',
|
54
|
+
_context
|
55
|
+
)
|
56
|
+
elsif _context.response.status_code == 405
|
57
|
+
raise APIException.new(
|
58
|
+
'Invalid input',
|
59
|
+
_context
|
60
|
+
)
|
61
|
+
end
|
62
|
+
validate_response(_context)
|
63
|
+
# Return appropriate response type.
|
64
|
+
_context.response.raw_body
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# pepipost
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module Pepipost
|
7
|
+
# EventsController
|
8
|
+
class EventsController < BaseController
|
9
|
+
@instance = EventsController.new
|
10
|
+
|
11
|
+
class << self
|
12
|
+
attr_accessor :instance
|
13
|
+
end
|
14
|
+
|
15
|
+
def instance
|
16
|
+
self.class.instance
|
17
|
+
end
|
18
|
+
|
19
|
+
# Lets you to retrieve the email transaction logs.
|
20
|
+
# @param [Date] startdate Required parameter: The starting date of the
|
21
|
+
# statistics to retrieve. Must follow format YYYY-MM-DD.
|
22
|
+
# @param [EventsEnum] events Optional parameter: Filter based on different
|
23
|
+
# email events. If not passed, all events will be fetched. Multiple comma
|
24
|
+
# separated events are allowed
|
25
|
+
# @param [SortEnum] sort Optional parameter: Sort based on email sent time
|
26
|
+
# @param [Date] enddate Optional parameter: The end date of the statistics
|
27
|
+
# to retrieve. Defaults to today. Must follow format YYYY-MM-DD
|
28
|
+
# @param [Integer] offset Optional parameter: The point in the list to begin
|
29
|
+
# retrieving results.
|
30
|
+
# @param [Integer] limit Optional parameter: The number of results to
|
31
|
+
# return.
|
32
|
+
# @param [String] subject Optional parameter: Filter logs based on subject
|
33
|
+
# @param [String] xapiheader Optional parameter: Filter logs based on
|
34
|
+
# recipient's email
|
35
|
+
# @param [String] fromaddress Optional parameter: Filter logs based on
|
36
|
+
# fromaddress
|
37
|
+
# @param [String] email Optional parameter: Filter logs based on recipient's
|
38
|
+
# email
|
39
|
+
# @return Object response from the API call
|
40
|
+
def get_events_get(startdate,
|
41
|
+
events = nil,
|
42
|
+
sort = nil,
|
43
|
+
enddate = nil,
|
44
|
+
offset = 0,
|
45
|
+
limit = 10,
|
46
|
+
subject = nil,
|
47
|
+
xapiheader = nil,
|
48
|
+
fromaddress = nil,
|
49
|
+
email = nil)
|
50
|
+
# Prepare query url.
|
51
|
+
_path_url = '/events'
|
52
|
+
_query_builder = Configuration.base_uri.dup
|
53
|
+
_query_builder << _path_url
|
54
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
55
|
+
_query_builder,
|
56
|
+
{
|
57
|
+
'startdate' => startdate,
|
58
|
+
'events' => events,
|
59
|
+
'sort' => sort,
|
60
|
+
'enddate' => enddate,
|
61
|
+
'offset' => offset,
|
62
|
+
'limit' => limit,
|
63
|
+
'subject' => subject,
|
64
|
+
'xapiheader' => xapiheader,
|
65
|
+
'fromaddress' => fromaddress,
|
66
|
+
'email' => email
|
67
|
+
},
|
68
|
+
array_serialization: Configuration.array_serialization
|
69
|
+
)
|
70
|
+
_query_url = APIHelper.clean_url _query_builder
|
71
|
+
# Prepare and execute HttpRequest.
|
72
|
+
_request = @http_client.get(
|
73
|
+
_query_url
|
74
|
+
)
|
75
|
+
CustomHeaderAuth.apply(_request)
|
76
|
+
_context = execute_request(_request)
|
77
|
+
# Validate response against endpoint and global error codes.
|
78
|
+
if _context.response.status_code == 400
|
79
|
+
raise APIException.new(
|
80
|
+
'API Response',
|
81
|
+
_context
|
82
|
+
)
|
83
|
+
elsif _context.response.status_code == 401
|
84
|
+
raise APIException.new(
|
85
|
+
'API Response',
|
86
|
+
_context
|
87
|
+
)
|
88
|
+
elsif _context.response.status_code == 403
|
89
|
+
raise APIException.new(
|
90
|
+
'API Response',
|
91
|
+
_context
|
92
|
+
)
|
93
|
+
elsif _context.response.status_code == 405
|
94
|
+
raise APIException.new(
|
95
|
+
'Invalid input',
|
96
|
+
_context
|
97
|
+
)
|
98
|
+
end
|
99
|
+
validate_response(_context)
|
100
|
+
# Return appropriate response type.
|
101
|
+
_context.response.raw_body
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# pepipost
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module Pepipost
|
7
|
+
# MailSendController
|
8
|
+
class MailSendController < BaseController
|
9
|
+
@instance = MailSendController.new
|
10
|
+
|
11
|
+
class << self
|
12
|
+
attr_accessor :instance
|
13
|
+
end
|
14
|
+
|
15
|
+
def instance
|
16
|
+
self.class.instance
|
17
|
+
end
|
18
|
+
|
19
|
+
# The endpoint send is used to generate the request to pepipost server for
|
20
|
+
# sending an email to recipients.
|
21
|
+
# @param [Send] body Required parameter: New mail request will be
|
22
|
+
# generated
|
23
|
+
# @return Object response from the API call
|
24
|
+
def create_generatethemailsendrequest(body)
|
25
|
+
# Prepare query url.
|
26
|
+
_path_url = '/mail/send'
|
27
|
+
_query_builder = Configuration.base_uri.dup
|
28
|
+
_query_builder << _path_url
|
29
|
+
_query_url = APIHelper.clean_url _query_builder
|
30
|
+
# Prepare headers.
|
31
|
+
_headers = {
|
32
|
+
'content-type' => 'application/json; charset=utf-8'
|
33
|
+
}
|
34
|
+
# Prepare and execute HttpRequest.
|
35
|
+
_request = @http_client.post(
|
36
|
+
_query_url,
|
37
|
+
headers: _headers,
|
38
|
+
parameters: body.to_json
|
39
|
+
)
|
40
|
+
CustomHeaderAuth.apply(_request)
|
41
|
+
_context = execute_request(_request)
|
42
|
+
# Validate response against endpoint and global error codes.
|
43
|
+
if _context.response.status_code == 405
|
44
|
+
raise APIException.new(
|
45
|
+
'Invalid input',
|
46
|
+
_context
|
47
|
+
)
|
48
|
+
end
|
49
|
+
validate_response(_context)
|
50
|
+
# Return appropriate response type.
|
51
|
+
_context.response.raw_body
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# pepipost
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module Pepipost
|
7
|
+
# SetrecurringcreditddetailsController
|
8
|
+
class SetrecurringcreditddetailsController < BaseController
|
9
|
+
@instance = SetrecurringcreditddetailsController.new
|
10
|
+
|
11
|
+
class << self
|
12
|
+
attr_accessor :instance
|
13
|
+
end
|
14
|
+
|
15
|
+
def instance
|
16
|
+
self.class.instance
|
17
|
+
end
|
18
|
+
|
19
|
+
# Lets you configure a recurring credit allocation to a subaccount
|
20
|
+
# @param [UpdateRecurringCredisOfSubaccount] body Required parameter: Update
|
21
|
+
# recurring credit account
|
22
|
+
# @return Object response from the API call
|
23
|
+
def create_setrecurringcreditddetails_post(body)
|
24
|
+
# Prepare query url.
|
25
|
+
_path_url = '/setrecurringcreditddetails'
|
26
|
+
_query_builder = Configuration.base_uri.dup
|
27
|
+
_query_builder << _path_url
|
28
|
+
_query_url = APIHelper.clean_url _query_builder
|
29
|
+
# Prepare headers.
|
30
|
+
_headers = {
|
31
|
+
'content-type' => 'application/json; charset=utf-8'
|
32
|
+
}
|
33
|
+
# Prepare and execute HttpRequest.
|
34
|
+
_request = @http_client.post(
|
35
|
+
_query_url,
|
36
|
+
headers: _headers,
|
37
|
+
parameters: body.to_json
|
38
|
+
)
|
39
|
+
CustomHeaderAuth.apply(_request)
|
40
|
+
_context = execute_request(_request)
|
41
|
+
# Validate response against endpoint and global error codes.
|
42
|
+
if _context.response.status_code == 400
|
43
|
+
raise APIException.new(
|
44
|
+
'API Response',
|
45
|
+
_context
|
46
|
+
)
|
47
|
+
elsif _context.response.status_code == 401
|
48
|
+
raise APIException.new(
|
49
|
+
'API Response',
|
50
|
+
_context
|
51
|
+
)
|
52
|
+
elsif _context.response.status_code == 403
|
53
|
+
raise APIException.new(
|
54
|
+
'API Response',
|
55
|
+
_context
|
56
|
+
)
|
57
|
+
elsif _context.response.status_code == 405
|
58
|
+
raise APIException.new(
|
59
|
+
'Invalid input',
|
60
|
+
_context
|
61
|
+
)
|
62
|
+
end
|
63
|
+
validate_response(_context)
|
64
|
+
# Return appropriate response type.
|
65
|
+
_context.response.raw_body
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# pepipost
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0 (
|
4
|
+
# https://apimatic.io ).
|
5
|
+
|
6
|
+
module Pepipost
|
7
|
+
# StatsController
|
8
|
+
class StatsController < BaseController
|
9
|
+
@instance = StatsController.new
|
10
|
+
|
11
|
+
class << self
|
12
|
+
attr_accessor :instance
|
13
|
+
end
|
14
|
+
|
15
|
+
def instance
|
16
|
+
self.class.instance
|
17
|
+
end
|
18
|
+
|
19
|
+
# Lets you fetch all the subaccounts created by you
|
20
|
+
# @param [Date] startdate Required parameter: The starting date of the
|
21
|
+
# statistics to retrieve. Must follow format YYYY-MM-DD.
|
22
|
+
# @param [Date] enddate Optional parameter: The end date of the statistics
|
23
|
+
# to retrieve. Defaults to today. Must follow format YYYY-MM-DD.
|
24
|
+
# @param [AggregatedByEnum] aggregated_by Optional parameter: Example:
|
25
|
+
# @param [Integer] offset Optional parameter: Example:1
|
26
|
+
# @param [Integer] limit Optional parameter: Example:100
|
27
|
+
# @return Object response from the API call
|
28
|
+
def get_stats_get(startdate,
|
29
|
+
enddate = nil,
|
30
|
+
aggregated_by = nil,
|
31
|
+
offset = 1,
|
32
|
+
limit = 100)
|
33
|
+
# Prepare query url.
|
34
|
+
_path_url = '/stats'
|
35
|
+
_query_builder = Configuration.base_uri.dup
|
36
|
+
_query_builder << _path_url
|
37
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
38
|
+
_query_builder,
|
39
|
+
{
|
40
|
+
'startdate' => startdate,
|
41
|
+
'enddate' => enddate,
|
42
|
+
'aggregated_by' => aggregated_by,
|
43
|
+
'offset' => offset,
|
44
|
+
'limit' => limit
|
45
|
+
},
|
46
|
+
array_serialization: Configuration.array_serialization
|
47
|
+
)
|
48
|
+
_query_url = APIHelper.clean_url _query_builder
|
49
|
+
# Prepare and execute HttpRequest.
|
50
|
+
_request = @http_client.get(
|
51
|
+
_query_url
|
52
|
+
)
|
53
|
+
CustomHeaderAuth.apply(_request)
|
54
|
+
_context = execute_request(_request)
|
55
|
+
# Validate response against endpoint and global error codes.
|
56
|
+
if _context.response.status_code == 400
|
57
|
+
raise APIException.new(
|
58
|
+
'API Response',
|
59
|
+
_context
|
60
|
+
)
|
61
|
+
elsif _context.response.status_code == 401
|
62
|
+
raise APIException.new(
|
63
|
+
'API Response',
|
64
|
+
_context
|
65
|
+
)
|
66
|
+
elsif _context.response.status_code == 403
|
67
|
+
raise APIException.new(
|
68
|
+
'API Response',
|
69
|
+
_context
|
70
|
+
)
|
71
|
+
elsif _context.response.status_code == 405
|
72
|
+
raise APIException.new(
|
73
|
+
'Invalid input',
|
74
|
+
_context
|
75
|
+
)
|
76
|
+
end
|
77
|
+
validate_response(_context)
|
78
|
+
# Return appropriate response type.
|
79
|
+
_context.response.raw_body
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|