mailslurp_client 11.0.1 → 11.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mailslurp_client.rb +1 -0
- data/lib/mailslurp_client/api/email_controller_api.rb +136 -0
- data/lib/mailslurp_client/models/email_text_lines_result.rb +228 -0
- data/lib/mailslurp_client/models/send_email_options.rb +1 -1
- data/lib/mailslurp_client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4cffc3d4ad26c6083619d2b55319d076433419ba6ab9191aafc722c667845b3
|
4
|
+
data.tar.gz: 262f90db6488aea3d4d8447da81bac53f44236dbc427728218ee5c91bfcb1120
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 625752091e51d5c99781c83b72949a817282e9a5d8f0d7445221fa4427ccf50567bfc7de87928af346623d6096d577a9104ab1c0e81ad112d64047e1ba599160
|
7
|
+
data.tar.gz: 821885d3019eaa556822ded8ecb2f5d9365e360d22a4da426961dc68d4b5572be3786a676045d37dae447a7420724f1cdfa7bd893b179e0fe711d7ecaa3a5700
|
data/lib/mailslurp_client.rb
CHANGED
@@ -46,6 +46,7 @@ require 'mailslurp_client/models/email_analysis'
|
|
46
46
|
require 'mailslurp_client/models/email_content_match_result'
|
47
47
|
require 'mailslurp_client/models/email_preview'
|
48
48
|
require 'mailslurp_client/models/email_projection'
|
49
|
+
require 'mailslurp_client/models/email_text_lines_result'
|
49
50
|
require 'mailslurp_client/models/email_verification_result'
|
50
51
|
require 'mailslurp_client/models/expired_inbox_dto'
|
51
52
|
require 'mailslurp_client/models/expired_inbox_record_projection'
|
@@ -670,6 +670,142 @@ module MailSlurpClient
|
|
670
670
|
return data, status_code, headers
|
671
671
|
end
|
672
672
|
|
673
|
+
# Parse and return text from an email, stripping HTML and decoding encoded characters
|
674
|
+
# Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors
|
675
|
+
# @param email_id [String] ID of email to perform HTML query on
|
676
|
+
# @param html_selector [String] HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information.
|
677
|
+
# @param [Hash] opts the optional parameters
|
678
|
+
# @return [EmailTextLinesResult]
|
679
|
+
def get_email_html_query(email_id, html_selector, opts = {})
|
680
|
+
data, _status_code, _headers = get_email_html_query_with_http_info(email_id, html_selector, opts)
|
681
|
+
data
|
682
|
+
end
|
683
|
+
|
684
|
+
# Parse and return text from an email, stripping HTML and decoding encoded characters
|
685
|
+
# Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors
|
686
|
+
# @param email_id [String] ID of email to perform HTML query on
|
687
|
+
# @param html_selector [String] HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for more information.
|
688
|
+
# @param [Hash] opts the optional parameters
|
689
|
+
# @return [Array<(EmailTextLinesResult, Integer, Hash)>] EmailTextLinesResult data, response status code and response headers
|
690
|
+
def get_email_html_query_with_http_info(email_id, html_selector, opts = {})
|
691
|
+
if @api_client.config.debugging
|
692
|
+
@api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_html_query ...'
|
693
|
+
end
|
694
|
+
# verify the required parameter 'email_id' is set
|
695
|
+
if @api_client.config.client_side_validation && email_id.nil?
|
696
|
+
fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_html_query"
|
697
|
+
end
|
698
|
+
# verify the required parameter 'html_selector' is set
|
699
|
+
if @api_client.config.client_side_validation && html_selector.nil?
|
700
|
+
fail ArgumentError, "Missing the required parameter 'html_selector' when calling EmailControllerApi.get_email_html_query"
|
701
|
+
end
|
702
|
+
# resource path
|
703
|
+
local_var_path = '/emails/{emailId}/html-query'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)).sub('{' + 'htmlSelector' + '}', CGI.escape(html_selector.to_s))
|
704
|
+
|
705
|
+
# query parameters
|
706
|
+
query_params = opts[:query_params] || {}
|
707
|
+
|
708
|
+
# header parameters
|
709
|
+
header_params = opts[:header_params] || {}
|
710
|
+
# HTTP header 'Accept' (if needed)
|
711
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
712
|
+
|
713
|
+
# form parameters
|
714
|
+
form_params = opts[:form_params] || {}
|
715
|
+
|
716
|
+
# http body (model)
|
717
|
+
post_body = opts[:body]
|
718
|
+
|
719
|
+
# return_type
|
720
|
+
return_type = opts[:return_type] || 'EmailTextLinesResult'
|
721
|
+
|
722
|
+
# auth_names
|
723
|
+
auth_names = opts[:auth_names] || ['API_KEY']
|
724
|
+
|
725
|
+
new_options = opts.merge(
|
726
|
+
:header_params => header_params,
|
727
|
+
:query_params => query_params,
|
728
|
+
:form_params => form_params,
|
729
|
+
:body => post_body,
|
730
|
+
:auth_names => auth_names,
|
731
|
+
:return_type => return_type
|
732
|
+
)
|
733
|
+
|
734
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
735
|
+
if @api_client.config.debugging
|
736
|
+
@api_client.config.logger.debug "API called: EmailControllerApi#get_email_html_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
737
|
+
end
|
738
|
+
return data, status_code, headers
|
739
|
+
end
|
740
|
+
|
741
|
+
# Parse and return text from an email, stripping HTML and decoding encoded characters
|
742
|
+
# Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators.
|
743
|
+
# @param decode_html_entities [Boolean] Decode HTML entities
|
744
|
+
# @param email_id [String] ID of email to fetch text for
|
745
|
+
# @param [Hash] opts the optional parameters
|
746
|
+
# @return [EmailTextLinesResult]
|
747
|
+
def get_email_text_lines(decode_html_entities, email_id, opts = {})
|
748
|
+
data, _status_code, _headers = get_email_text_lines_with_http_info(decode_html_entities, email_id, opts)
|
749
|
+
data
|
750
|
+
end
|
751
|
+
|
752
|
+
# Parse and return text from an email, stripping HTML and decoding encoded characters
|
753
|
+
# Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators.
|
754
|
+
# @param decode_html_entities [Boolean] Decode HTML entities
|
755
|
+
# @param email_id [String] ID of email to fetch text for
|
756
|
+
# @param [Hash] opts the optional parameters
|
757
|
+
# @return [Array<(EmailTextLinesResult, Integer, Hash)>] EmailTextLinesResult data, response status code and response headers
|
758
|
+
def get_email_text_lines_with_http_info(decode_html_entities, email_id, opts = {})
|
759
|
+
if @api_client.config.debugging
|
760
|
+
@api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_text_lines ...'
|
761
|
+
end
|
762
|
+
# verify the required parameter 'decode_html_entities' is set
|
763
|
+
if @api_client.config.client_side_validation && decode_html_entities.nil?
|
764
|
+
fail ArgumentError, "Missing the required parameter 'decode_html_entities' when calling EmailControllerApi.get_email_text_lines"
|
765
|
+
end
|
766
|
+
# verify the required parameter 'email_id' is set
|
767
|
+
if @api_client.config.client_side_validation && email_id.nil?
|
768
|
+
fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_text_lines"
|
769
|
+
end
|
770
|
+
# resource path
|
771
|
+
local_var_path = '/emails/{emailId}/text'.sub('{' + 'decodeHtmlEntities' + '}', CGI.escape(decode_html_entities.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s))
|
772
|
+
|
773
|
+
# query parameters
|
774
|
+
query_params = opts[:query_params] || {}
|
775
|
+
|
776
|
+
# header parameters
|
777
|
+
header_params = opts[:header_params] || {}
|
778
|
+
# HTTP header 'Accept' (if needed)
|
779
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
780
|
+
|
781
|
+
# form parameters
|
782
|
+
form_params = opts[:form_params] || {}
|
783
|
+
|
784
|
+
# http body (model)
|
785
|
+
post_body = opts[:body]
|
786
|
+
|
787
|
+
# return_type
|
788
|
+
return_type = opts[:return_type] || 'EmailTextLinesResult'
|
789
|
+
|
790
|
+
# auth_names
|
791
|
+
auth_names = opts[:auth_names] || ['API_KEY']
|
792
|
+
|
793
|
+
new_options = opts.merge(
|
794
|
+
:header_params => header_params,
|
795
|
+
:query_params => query_params,
|
796
|
+
:form_params => form_params,
|
797
|
+
:body => post_body,
|
798
|
+
:auth_names => auth_names,
|
799
|
+
:return_type => return_type
|
800
|
+
)
|
801
|
+
|
802
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
803
|
+
if @api_client.config.debugging
|
804
|
+
@api_client.config.logger.debug "API called: EmailControllerApi#get_email_text_lines\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
805
|
+
end
|
806
|
+
return data, status_code, headers
|
807
|
+
end
|
808
|
+
|
673
809
|
# Get all emails
|
674
810
|
# By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages
|
675
811
|
# @param [Hash] opts the optional parameters
|
@@ -0,0 +1,228 @@
|
|
1
|
+
=begin
|
2
|
+
#MailSlurp API
|
3
|
+
|
4
|
+
#MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 6.5.2
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module MailSlurpClient
|
16
|
+
# Parsed text of an email
|
17
|
+
class EmailTextLinesResult
|
18
|
+
attr_accessor :body
|
19
|
+
|
20
|
+
attr_accessor :lines
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'body' => :'body',
|
26
|
+
:'lines' => :'lines'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.openapi_types
|
32
|
+
{
|
33
|
+
:'body' => :'String',
|
34
|
+
:'lines' => :'Array<String>'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# List of attributes with nullable: true
|
39
|
+
def self.openapi_nullable
|
40
|
+
Set.new([
|
41
|
+
])
|
42
|
+
end
|
43
|
+
|
44
|
+
# Initializes the object
|
45
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
46
|
+
def initialize(attributes = {})
|
47
|
+
if (!attributes.is_a?(Hash))
|
48
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::EmailTextLinesResult` initialize method"
|
49
|
+
end
|
50
|
+
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
53
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
54
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::EmailTextLinesResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
55
|
+
end
|
56
|
+
h[k.to_sym] = v
|
57
|
+
}
|
58
|
+
|
59
|
+
if attributes.key?(:'body')
|
60
|
+
self.body = attributes[:'body']
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes.key?(:'lines')
|
64
|
+
if (value = attributes[:'lines']).is_a?(Array)
|
65
|
+
self.lines = value
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properties with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
if @body.nil?
|
75
|
+
invalid_properties.push('invalid value for "body", body cannot be nil.')
|
76
|
+
end
|
77
|
+
|
78
|
+
if @lines.nil?
|
79
|
+
invalid_properties.push('invalid value for "lines", lines cannot be nil.')
|
80
|
+
end
|
81
|
+
|
82
|
+
invalid_properties
|
83
|
+
end
|
84
|
+
|
85
|
+
# Check to see if the all the properties in the model are valid
|
86
|
+
# @return true if the model is valid
|
87
|
+
def valid?
|
88
|
+
return false if @body.nil?
|
89
|
+
return false if @lines.nil?
|
90
|
+
true
|
91
|
+
end
|
92
|
+
|
93
|
+
# Checks equality by comparing each attribute.
|
94
|
+
# @param [Object] Object to be compared
|
95
|
+
def ==(o)
|
96
|
+
return true if self.equal?(o)
|
97
|
+
self.class == o.class &&
|
98
|
+
body == o.body &&
|
99
|
+
lines == o.lines
|
100
|
+
end
|
101
|
+
|
102
|
+
# @see the `==` method
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def eql?(o)
|
105
|
+
self == o
|
106
|
+
end
|
107
|
+
|
108
|
+
# Calculates hash code according to all attributes.
|
109
|
+
# @return [Integer] Hash code
|
110
|
+
def hash
|
111
|
+
[body, lines].hash
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def self.build_from_hash(attributes)
|
118
|
+
new.build_from_hash(attributes)
|
119
|
+
end
|
120
|
+
|
121
|
+
# Builds the object from hash
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
123
|
+
# @return [Object] Returns the model itself
|
124
|
+
def build_from_hash(attributes)
|
125
|
+
return nil unless attributes.is_a?(Hash)
|
126
|
+
self.class.openapi_types.each_pair do |key, type|
|
127
|
+
if type =~ /\AArray<(.*)>/i
|
128
|
+
# check to ensure the input is an array given that the attribute
|
129
|
+
# is documented as an array but the input is not
|
130
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
131
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
132
|
+
end
|
133
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
134
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
135
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
136
|
+
end
|
137
|
+
|
138
|
+
self
|
139
|
+
end
|
140
|
+
|
141
|
+
# Deserializes the data based on type
|
142
|
+
# @param string type Data type
|
143
|
+
# @param string value Value to be deserialized
|
144
|
+
# @return [Object] Deserialized data
|
145
|
+
def _deserialize(type, value)
|
146
|
+
case type.to_sym
|
147
|
+
when :DateTime
|
148
|
+
DateTime.parse(value)
|
149
|
+
when :Date
|
150
|
+
Date.parse(value)
|
151
|
+
when :String
|
152
|
+
value.to_s
|
153
|
+
when :Integer
|
154
|
+
value.to_i
|
155
|
+
when :Float
|
156
|
+
value.to_f
|
157
|
+
when :Boolean
|
158
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
159
|
+
true
|
160
|
+
else
|
161
|
+
false
|
162
|
+
end
|
163
|
+
when :Object
|
164
|
+
# generic object (usually a Hash), return directly
|
165
|
+
value
|
166
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
167
|
+
inner_type = Regexp.last_match[:inner_type]
|
168
|
+
value.map { |v| _deserialize(inner_type, v) }
|
169
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
170
|
+
k_type = Regexp.last_match[:k_type]
|
171
|
+
v_type = Regexp.last_match[:v_type]
|
172
|
+
{}.tap do |hash|
|
173
|
+
value.each do |k, v|
|
174
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
else # model
|
178
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the string representation of the object
|
183
|
+
# @return [String] String presentation of the object
|
184
|
+
def to_s
|
185
|
+
to_hash.to_s
|
186
|
+
end
|
187
|
+
|
188
|
+
# to_body is an alias to to_hash (backward compatibility)
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_body
|
191
|
+
to_hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Returns the object in the form of hash
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
196
|
+
def to_hash
|
197
|
+
hash = {}
|
198
|
+
self.class.attribute_map.each_pair do |attr, param|
|
199
|
+
value = self.send(attr)
|
200
|
+
if value.nil?
|
201
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
202
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
203
|
+
end
|
204
|
+
|
205
|
+
hash[param] = _to_hash(value)
|
206
|
+
end
|
207
|
+
hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Outputs non-array value in the form of hash
|
211
|
+
# For object, use to_hash. Otherwise, just return the value
|
212
|
+
# @param [Object] value Any valid value
|
213
|
+
# @return [Hash] Returns the value in the form of hash
|
214
|
+
def _to_hash(value)
|
215
|
+
if value.is_a?(Array)
|
216
|
+
value.compact.map { |v| _to_hash(v) }
|
217
|
+
elsif value.is_a?(Hash)
|
218
|
+
{}.tap do |hash|
|
219
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
220
|
+
end
|
221
|
+
elsif value.respond_to? :to_hash
|
222
|
+
value.to_hash
|
223
|
+
else
|
224
|
+
value
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
@@ -13,7 +13,7 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module MailSlurpClient
|
16
|
-
# Options for sending an email message from an inbox. You must provide one of: `to`, `toGroup`, or `toContacts` to send an email. All other parameters are optional.
|
16
|
+
# Options for sending an email message from an inbox. You must provide one of: `to`, `toGroup`, or `toContacts` to send an email. All other parameters are optional.
|
17
17
|
class SendEmailOptions
|
18
18
|
# Optional list of attachment IDs to send with this email. You must first upload each attachment separately in order to obtain attachment IDs. This way you can reuse attachments with different emails once uploaded.
|
19
19
|
attr_accessor :attachments
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailslurp_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.0
|
4
|
+
version: 11.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mailslurp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Create emails addresses in Ruby then send and receive real emails and
|
14
14
|
attachments. See https://www.mailslurp.com/docs/ruby/ for full Ruby documentation.
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- lib/mailslurp_client/models/email_content_match_result.rb
|
71
71
|
- lib/mailslurp_client/models/email_preview.rb
|
72
72
|
- lib/mailslurp_client/models/email_projection.rb
|
73
|
+
- lib/mailslurp_client/models/email_text_lines_result.rb
|
73
74
|
- lib/mailslurp_client/models/email_verification_result.rb
|
74
75
|
- lib/mailslurp_client/models/expired_inbox_dto.rb
|
75
76
|
- lib/mailslurp_client/models/expired_inbox_record_projection.rb
|