cloudmersive-spam-detection-api-client 2.3.0 → 2.4.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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -8
  3. data/cloudmersive-spam-detection-api-client.gemspec +1 -1
  4. data/docs/SpamDetectionAdvancedFormField.md +9 -0
  5. data/docs/SpamDetectionAdvancedFormSubmissionRequest.md +11 -0
  6. data/docs/SpamDetectionAdvancedResponse.md +2 -0
  7. data/docs/SpamDetectionApi.md +174 -0
  8. data/docs/SpamDetectionFormSubmissionAdvancedResponse.md +14 -0
  9. data/lib/cloudmersive-spam-detection-api-client/api/spam_detection_api.rb +165 -1
  10. data/lib/cloudmersive-spam-detection-api-client/api_client.rb +1 -1
  11. data/lib/cloudmersive-spam-detection-api-client/api_error.rb +1 -1
  12. data/lib/cloudmersive-spam-detection-api-client/configuration.rb +1 -1
  13. data/lib/cloudmersive-spam-detection-api-client/models/spam_detection_advanced_form_field.rb +196 -0
  14. data/lib/cloudmersive-spam-detection-api-client/models/spam_detection_advanced_form_submission_request.rb +218 -0
  15. data/lib/cloudmersive-spam-detection-api-client/models/spam_detection_advanced_request.rb +1 -1
  16. data/lib/cloudmersive-spam-detection-api-client/models/spam_detection_advanced_response.rb +25 -5
  17. data/lib/cloudmersive-spam-detection-api-client/models/spam_detection_form_submission_advanced_response.rb +246 -0
  18. data/lib/cloudmersive-spam-detection-api-client/models/spam_detection_request.rb +1 -1
  19. data/lib/cloudmersive-spam-detection-api-client/models/spam_detection_response.rb +1 -1
  20. data/lib/cloudmersive-spam-detection-api-client/version.rb +2 -2
  21. data/lib/cloudmersive-spam-detection-api-client.rb +4 -1
  22. data/spec/api/spam_detection_api_spec.rb +40 -1
  23. data/spec/api_client_spec.rb +1 -1
  24. data/spec/configuration_spec.rb +1 -1
  25. data/spec/models/spam_detection_advanced_form_field_spec.rb +47 -0
  26. data/spec/models/spam_detection_advanced_form_submission_request_spec.rb +59 -0
  27. data/spec/models/spam_detection_advanced_request_spec.rb +1 -1
  28. data/spec/models/spam_detection_advanced_response_spec.rb +13 -1
  29. data/spec/models/spam_detection_form_submission_advanced_response_spec.rb +77 -0
  30. data/spec/models/spam_detection_request_spec.rb +1 -1
  31. data/spec/models/spam_detection_response_spec.rb +1 -1
  32. data/spec/spec_helper.rb +1 -1
  33. metadata +11 -2
@@ -0,0 +1,196 @@
1
+ =begin
2
+ #spamapi
3
+
4
+ #Easily and directly scan and block spam security threats in input.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveSpamDetectionApiClient
16
+ # Form field submitted to run spam detection on
17
+ class SpamDetectionAdvancedFormField
18
+ # Title of the field
19
+ attr_accessor :field_title
20
+
21
+ # Value of the field
22
+ attr_accessor :field_value
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'field_title' => :'FieldTitle',
28
+ :'field_value' => :'FieldValue'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'field_title' => :'String',
36
+ :'field_value' => :'String'
37
+ }
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
47
+
48
+ if attributes.has_key?(:'FieldTitle')
49
+ self.field_title = attributes[:'FieldTitle']
50
+ end
51
+
52
+ if attributes.has_key?(:'FieldValue')
53
+ self.field_value = attributes[:'FieldValue']
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ field_title == o.field_title &&
76
+ field_value == o.field_value
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [field_title, field_value].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.swagger_types.each_pair do |key, type|
97
+ if type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Deserializes the data based on type
112
+ # @param string type Data type
113
+ # @param string value Value to be deserialized
114
+ # @return [Object] Deserialized data
115
+ def _deserialize(type, value)
116
+ case type.to_sym
117
+ when :DateTime
118
+ DateTime.parse(value)
119
+ when :Date
120
+ Date.parse(value)
121
+ when :String
122
+ value.to_s
123
+ when :Integer
124
+ value.to_i
125
+ when :Float
126
+ value.to_f
127
+ when :BOOLEAN
128
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
+ true
130
+ else
131
+ false
132
+ end
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ else # model
148
+ temp_model = CloudmersiveSpamDetectionApiClient.const_get(type).new
149
+ temp_model.build_from_hash(value)
150
+ end
151
+ end
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # to_body is an alias to to_hash (backward compatibility)
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_body
162
+ to_hash
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+
195
+ end
196
+ end
@@ -0,0 +1,218 @@
1
+ =begin
2
+ #spamapi
3
+
4
+ #Easily and directly scan and block spam security threats in input.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveSpamDetectionApiClient
16
+ # AI advanced spam detection request
17
+ class SpamDetectionAdvancedFormSubmissionRequest
18
+ # Form fields and values that you received in your form submission
19
+ attr_accessor :input_form_fields
20
+
21
+ # True if unsolicited sales should be allowed, false otherwise
22
+ attr_accessor :allow_unsolicited_sales
23
+
24
+ # True if promotional content should be allowed, false otherwise
25
+ attr_accessor :allow_promotional_content
26
+
27
+ # True if phishing should be allowed, false otherwise
28
+ attr_accessor :allow_phishing
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'input_form_fields' => :'InputFormFields',
34
+ :'allow_unsolicited_sales' => :'AllowUnsolicitedSales',
35
+ :'allow_promotional_content' => :'AllowPromotionalContent',
36
+ :'allow_phishing' => :'AllowPhishing'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.swagger_types
42
+ {
43
+ :'input_form_fields' => :'Array<SpamDetectionAdvancedFormField>',
44
+ :'allow_unsolicited_sales' => :'BOOLEAN',
45
+ :'allow_promotional_content' => :'BOOLEAN',
46
+ :'allow_phishing' => :'BOOLEAN'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'InputFormFields')
59
+ if (value = attributes[:'InputFormFields']).is_a?(Array)
60
+ self.input_form_fields = value
61
+ end
62
+ end
63
+
64
+ if attributes.has_key?(:'AllowUnsolicitedSales')
65
+ self.allow_unsolicited_sales = attributes[:'AllowUnsolicitedSales']
66
+ end
67
+
68
+ if attributes.has_key?(:'AllowPromotionalContent')
69
+ self.allow_promotional_content = attributes[:'AllowPromotionalContent']
70
+ end
71
+
72
+ if attributes.has_key?(:'AllowPhishing')
73
+ self.allow_phishing = attributes[:'AllowPhishing']
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ true
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ input_form_fields == o.input_form_fields &&
96
+ allow_unsolicited_sales == o.allow_unsolicited_sales &&
97
+ allow_promotional_content == o.allow_promotional_content &&
98
+ allow_phishing == o.allow_phishing
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Fixnum] Hash code
109
+ def hash
110
+ [input_form_fields, allow_unsolicited_sales, allow_promotional_content, allow_phishing].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.swagger_types.each_pair do |key, type|
119
+ if type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
124
+ end
125
+ elsif !attributes[self.class.attribute_map[key]].nil?
126
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
127
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
128
+ end
129
+
130
+ self
131
+ end
132
+
133
+ # Deserializes the data based on type
134
+ # @param string type Data type
135
+ # @param string value Value to be deserialized
136
+ # @return [Object] Deserialized data
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :BOOLEAN
150
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when :Object
156
+ # generic object (usually a Hash), return directly
157
+ value
158
+ when /\AArray<(?<inner_type>.+)>\z/
159
+ inner_type = Regexp.last_match[:inner_type]
160
+ value.map { |v| _deserialize(inner_type, v) }
161
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
162
+ k_type = Regexp.last_match[:k_type]
163
+ v_type = Regexp.last_match[:v_type]
164
+ {}.tap do |hash|
165
+ value.each do |k, v|
166
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
167
+ end
168
+ end
169
+ else # model
170
+ temp_model = CloudmersiveSpamDetectionApiClient.const_get(type).new
171
+ temp_model.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ next if value.nil?
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+ end
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #spamapi
3
3
 
4
- #Easily and directly scan and block phishing security threats.
4
+ #Easily and directly scan and block spam security threats in input.
5
5
 
6
6
  OpenAPI spec version: v1
7
7
 
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #spamapi
3
3
 
4
- #Easily and directly scan and block phishing security threats.
4
+ #Easily and directly scan and block spam security threats in input.
5
5
 
6
6
  OpenAPI spec version: v1
7
7
 
@@ -18,6 +18,9 @@ module CloudmersiveSpamDetectionApiClient
18
18
  # True if the result is not spam (clean), and false otherwise
19
19
  attr_accessor :clean_result
20
20
 
21
+ # Overall spam risk level between 0.0 and 1.0
22
+ attr_accessor :spam_risk_level
23
+
21
24
  # True if the input text contains spam, false otherwise
22
25
  attr_accessor :contains_spam
23
26
 
@@ -30,14 +33,19 @@ module CloudmersiveSpamDetectionApiClient
30
33
  # True if the input text contains a phishing attempt, false otherwise
31
34
  attr_accessor :contains_phishing_attempt
32
35
 
36
+ # Rationale for why the conclusion was formed
37
+ attr_accessor :analysis_rationale
38
+
33
39
  # Attribute mapping from ruby-style variable name to JSON key.
34
40
  def self.attribute_map
35
41
  {
36
42
  :'clean_result' => :'CleanResult',
43
+ :'spam_risk_level' => :'SpamRiskLevel',
37
44
  :'contains_spam' => :'ContainsSpam',
38
45
  :'contains_unsolicited_sales' => :'ContainsUnsolicitedSales',
39
46
  :'contains_promotional_content' => :'ContainsPromotionalContent',
40
- :'contains_phishing_attempt' => :'ContainsPhishingAttempt'
47
+ :'contains_phishing_attempt' => :'ContainsPhishingAttempt',
48
+ :'analysis_rationale' => :'AnalysisRationale'
41
49
  }
42
50
  end
43
51
 
@@ -45,10 +53,12 @@ module CloudmersiveSpamDetectionApiClient
45
53
  def self.swagger_types
46
54
  {
47
55
  :'clean_result' => :'BOOLEAN',
56
+ :'spam_risk_level' => :'Float',
48
57
  :'contains_spam' => :'BOOLEAN',
49
58
  :'contains_unsolicited_sales' => :'BOOLEAN',
50
59
  :'contains_promotional_content' => :'BOOLEAN',
51
- :'contains_phishing_attempt' => :'BOOLEAN'
60
+ :'contains_phishing_attempt' => :'BOOLEAN',
61
+ :'analysis_rationale' => :'String'
52
62
  }
53
63
  end
54
64
 
@@ -64,6 +74,10 @@ module CloudmersiveSpamDetectionApiClient
64
74
  self.clean_result = attributes[:'CleanResult']
65
75
  end
66
76
 
77
+ if attributes.has_key?(:'SpamRiskLevel')
78
+ self.spam_risk_level = attributes[:'SpamRiskLevel']
79
+ end
80
+
67
81
  if attributes.has_key?(:'ContainsSpam')
68
82
  self.contains_spam = attributes[:'ContainsSpam']
69
83
  end
@@ -79,6 +93,10 @@ module CloudmersiveSpamDetectionApiClient
79
93
  if attributes.has_key?(:'ContainsPhishingAttempt')
80
94
  self.contains_phishing_attempt = attributes[:'ContainsPhishingAttempt']
81
95
  end
96
+
97
+ if attributes.has_key?(:'AnalysisRationale')
98
+ self.analysis_rationale = attributes[:'AnalysisRationale']
99
+ end
82
100
  end
83
101
 
84
102
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -100,10 +118,12 @@ module CloudmersiveSpamDetectionApiClient
100
118
  return true if self.equal?(o)
101
119
  self.class == o.class &&
102
120
  clean_result == o.clean_result &&
121
+ spam_risk_level == o.spam_risk_level &&
103
122
  contains_spam == o.contains_spam &&
104
123
  contains_unsolicited_sales == o.contains_unsolicited_sales &&
105
124
  contains_promotional_content == o.contains_promotional_content &&
106
- contains_phishing_attempt == o.contains_phishing_attempt
125
+ contains_phishing_attempt == o.contains_phishing_attempt &&
126
+ analysis_rationale == o.analysis_rationale
107
127
  end
108
128
 
109
129
  # @see the `==` method
@@ -115,7 +135,7 @@ module CloudmersiveSpamDetectionApiClient
115
135
  # Calculates hash code according to all attributes.
116
136
  # @return [Fixnum] Hash code
117
137
  def hash
118
- [clean_result, contains_spam, contains_unsolicited_sales, contains_promotional_content, contains_phishing_attempt].hash
138
+ [clean_result, spam_risk_level, contains_spam, contains_unsolicited_sales, contains_promotional_content, contains_phishing_attempt, analysis_rationale].hash
119
139
  end
120
140
 
121
141
  # Builds the object from hash