Class: Zyphr::InboundEmailApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zyphr/api/inbound_email_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ InboundEmailApi

Returns a new instance of InboundEmailApi.



19
20
21
# File 'lib/zyphr/api/inbound_email_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zyphr/api/inbound_email_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_inbound_attachment_url(id, attachment_id, opts = {}) ⇒ InboundAttachmentUrlResponse

Get an attachment download URL Return a short-lived presigned S3 download URL for one attachment of a received email. ‘attachmentId` is the positional id from the email’s ‘attachments` array.

Parameters:

  • id (String)
  • attachment_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/zyphr/api/inbound_email_api.rb', line 28

def get_inbound_attachment_url(id, attachment_id, opts = {})
  data, _status_code, _headers = get_inbound_attachment_url_with_http_info(id, attachment_id, opts)
  data
end

#get_inbound_attachment_url_with_http_info(id, attachment_id, opts = {}) ⇒ Array<(InboundAttachmentUrlResponse, Integer, Hash)>

Get an attachment download URL Return a short-lived presigned S3 download URL for one attachment of a received email. &#x60;attachmentId&#x60; is the positional id from the email&#39;s &#x60;attachments&#x60; array.

Parameters:

  • id (String)
  • attachment_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/zyphr/api/inbound_email_api.rb', line 39

def get_inbound_attachment_url_with_http_info(id, attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbound_attachment_url ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.get_inbound_attachment_url"
  end
  # verify the required parameter 'attachment_id' is set
  if @api_client.config.client_side_validation && attachment_id.nil?
    fail ArgumentError, "Missing the required parameter 'attachment_id' when calling InboundEmailApi.get_inbound_attachment_url"
  end
  # resource path
  local_var_path = '/inbound-emails/{id}/attachments/{attachmentId}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'InboundAttachmentUrlResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"InboundEmailApi.get_inbound_attachment_url",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InboundEmailApi#get_inbound_attachment_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_inbound_email(id, opts = {}) ⇒ InboundEmailResponse

Get a received email Retrieve a single inbound email by id (scoped to the project).

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



96
97
98
99
# File 'lib/zyphr/api/inbound_email_api.rb', line 96

def get_inbound_email(id, opts = {})
  data, _status_code, _headers = get_inbound_email_with_http_info(id, opts)
  data
end

#get_inbound_email_with_http_info(id, opts = {}) ⇒ Array<(InboundEmailResponse, Integer, Hash)>

Get a received email Retrieve a single inbound email by id (scoped to the project).

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InboundEmailResponse, Integer, Hash)>)

    InboundEmailResponse data, response status code and response headers



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/zyphr/api/inbound_email_api.rb', line 106

def get_inbound_email_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InboundEmailApi.get_inbound_email ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling InboundEmailApi.get_inbound_email"
  end
  # resource path
  local_var_path = '/inbound-emails/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'InboundEmailResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"InboundEmailApi.get_inbound_email",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InboundEmailApi#get_inbound_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_inbound_emails(opts = {}) ⇒ InboundEmailListResponse

List received emails List inbound (received) emails for the project, newest first. By default only delivered mail (‘received`/`processed`) is returned; pass `include_withheld=true` to also see quarantined/dropped.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)
  • :to (String)

    Filter by receiving address

  • :include_withheld (Boolean)

    Include quarantined/dropped mail

  • :limit (Integer) — default: default to 50
  • :offset (Integer) — default: default to 0

Returns:



163
164
165
166
# File 'lib/zyphr/api/inbound_email_api.rb', line 163

def list_inbound_emails(opts = {})
  data, _status_code, _headers = list_inbound_emails_with_http_info(opts)
  data
end

#list_inbound_emails_with_http_info(opts = {}) ⇒ Array<(InboundEmailListResponse, Integer, Hash)>

List received emails List inbound (received) emails for the project, newest first. By default only delivered mail (&#x60;received&#x60;/&#x60;processed&#x60;) is returned; pass &#x60;include_withheld&#x3D;true&#x60; to also see quarantined/dropped.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)
  • :to (String)

    Filter by receiving address

  • :include_withheld (Boolean)

    Include quarantined/dropped mail

  • :limit (Integer) — default: default to 50
  • :offset (Integer) — default: default to 0

Returns:

  • (Array<(InboundEmailListResponse, Integer, Hash)>)

    InboundEmailListResponse data, response status code and response headers



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/zyphr/api/inbound_email_api.rb', line 177

def list_inbound_emails_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InboundEmailApi.list_inbound_emails ...'
  end
  allowable_values = ["received", "processed", "quarantined", "dropped", "failed"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboundEmailApi.list_inbound_emails, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/inbound-emails'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
  query_params[:'include_withheld'] = opts[:'include_withheld'] if !opts[:'include_withheld'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'InboundEmailListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"InboundEmailApi.list_inbound_emails",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: InboundEmailApi#list_inbound_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end