sendpost_ruby_sdk 1.0.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +109 -0
- data/config-ruby.json +1 -1
- data/docs/EventMetadata.md +4 -0
- data/generate-libs.bash +1 -1
- data/git_push.sh +2 -2
- data/lib/sendpost_ruby_sdk/api/email_api.rb +1 -1
- data/lib/sendpost_ruby_sdk/api/suppression_api.rb +1 -1
- data/lib/sendpost_ruby_sdk/api_client.rb +1 -1
- data/lib/sendpost_ruby_sdk/api_error.rb +1 -1
- data/lib/sendpost_ruby_sdk/configuration.rb +12 -10
- data/lib/sendpost_ruby_sdk/models/attachment.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/city.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/copy_to.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/count_stat.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/delete_response.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/device.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/email_message.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/email_response.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/event_metadata.rb +32 -19
- data/lib/sendpost_ruby_sdk/models/from.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/os.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/q_email_message.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/q_event.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/r_suppression.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/rd_suppression.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/reply_to.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/suppression.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/suppression_email.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/to.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/user_agent.rb +13 -18
- data/lib/sendpost_ruby_sdk/models/webhook_event.rb +13 -18
- data/lib/sendpost_ruby_sdk/version.rb +2 -2
- data/lib/sendpost_ruby_sdk.rb +1 -1
- data/sendpost.yaml +4 -0
- data/sendpost_ruby_sdk.gemspec +1 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e454f81043b5693663756f6fc7e51ef326e55ac28a117c965b62d09db98dd432
|
4
|
+
data.tar.gz: bb22b794b02c71a78d315bcee4d6dfceca53abff1b821eb6f07736087faed250
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72adb05a860d07149b9d17c7be4dd8ff754d0efae495e9a9d35554df89dce54d01f77b02afbda460cec20666e182e82efcf0e9350945e2dabefae41380cbd5d9
|
7
|
+
data.tar.gz: 572e819e7769b08316ecde125c1054eb7313a14e596098d94c9cc5204c495d91a1f72b7271d27af417909d5ee065b92a896c77a6ccc300bcc44b5acc26a8b90e
|
data/README.md
CHANGED
@@ -79,6 +79,115 @@ end
|
|
79
79
|
|
80
80
|
```
|
81
81
|
|
82
|
+
## Suppressions
|
83
|
+
|
84
|
+
Create Suppressions
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
require 'sendpost_ruby_sdk'
|
88
|
+
api_instance = Sendpost::SuppressionApi.new
|
89
|
+
|
90
|
+
x_sub_account_api_key = 'your_api_key'
|
91
|
+
|
92
|
+
r_suppression = Sendpost::RSuppression.new
|
93
|
+
|
94
|
+
r_suppression.hard_bounce = [{ email: 'richard@piedpiper_fake.com' }]
|
95
|
+
|
96
|
+
# fields are optional, but you have to send at least one of them.
|
97
|
+
|
98
|
+
# r_suppression.manual = [{ email: 'richard@piedpiper_fake2.com' }]
|
99
|
+
# r_suppression.spam_complaint = [{ email: 'richard@piedpiper_fake3.com' }]
|
100
|
+
# r_suppression.unsubscribe = [{ email: 'richard@piedpiper_fake4.com' }]
|
101
|
+
|
102
|
+
opts = {
|
103
|
+
r_suppression: r_suppression
|
104
|
+
}
|
105
|
+
|
106
|
+
p opts
|
107
|
+
|
108
|
+
begin
|
109
|
+
result = api_instance.create_suppressions(x_sub_account_api_key, opts)
|
110
|
+
p result
|
111
|
+
rescue Sendpost::ApiError => e
|
112
|
+
puts "Exception when calling SuppressionApi->create_suppressions: #{e}"
|
113
|
+
end
|
114
|
+
```
|
115
|
+
|
116
|
+
Get Suppressions
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
require 'sendpost_ruby_sdk'
|
120
|
+
api_instance = Sendpost::SuppressionApi.new
|
121
|
+
|
122
|
+
x_sub_account_api_key = 'your_api_key'
|
123
|
+
|
124
|
+
opts = {
|
125
|
+
offset: 0,
|
126
|
+
limit: 20,
|
127
|
+
search: nil,
|
128
|
+
from: '2023-06-07',
|
129
|
+
to: '2023-08-04'
|
130
|
+
}
|
131
|
+
|
132
|
+
p opts
|
133
|
+
|
134
|
+
begin
|
135
|
+
result = api_instance.get_suppressions(x_sub_account_api_key, opts)
|
136
|
+
p result
|
137
|
+
rescue Sendpost::ApiError => e
|
138
|
+
puts "Exception when calling SuppressionApi->get_suppressions: #{e}"
|
139
|
+
end
|
140
|
+
```
|
141
|
+
|
142
|
+
Delete Suppression
|
143
|
+
|
144
|
+
```ruby
|
145
|
+
require 'sendpost_ruby_sdk'
|
146
|
+
api_instance = Sendpost::SuppressionApi.new
|
147
|
+
|
148
|
+
x_sub_account_api_key = 'your_api_key'
|
149
|
+
|
150
|
+
rd_suppression = Sendpost::RDSuppression.new
|
151
|
+
|
152
|
+
rd_suppression.suppressions = [{ email: 'richard@piedpiper_fake4.com' }]
|
153
|
+
|
154
|
+
opts = {
|
155
|
+
rd_suppression: rd_suppression
|
156
|
+
}
|
157
|
+
|
158
|
+
p opts
|
159
|
+
|
160
|
+
begin
|
161
|
+
result = api_instance.delete_suppression(x_sub_account_api_key, opts)
|
162
|
+
p result
|
163
|
+
rescue Sendpost::ApiError => e
|
164
|
+
puts "Exception when calling SuppressionApi->delete_suppression: #{e}"
|
165
|
+
end
|
166
|
+
```
|
167
|
+
|
168
|
+
Count Suppression
|
169
|
+
|
170
|
+
```ruby
|
171
|
+
require 'sendpost_ruby_sdk'
|
172
|
+
api_instance = Sendpost::SuppressionApi.new
|
173
|
+
|
174
|
+
x_sub_account_api_key = 'your_api_key'
|
175
|
+
|
176
|
+
opts = {
|
177
|
+
from: '2023-06-07',
|
178
|
+
to: '2023-08-04'
|
179
|
+
}
|
180
|
+
|
181
|
+
p opts
|
182
|
+
|
183
|
+
begin
|
184
|
+
result = api_instance.count(x_sub_account_api_key, opts)
|
185
|
+
p result
|
186
|
+
rescue Sendpost::ApiError => e
|
187
|
+
puts "Exception when calling SuppressionApi->count: #{e}"
|
188
|
+
end
|
189
|
+
```
|
190
|
+
|
82
191
|
## Documentation for API Endpoints
|
83
192
|
|
84
193
|
All URIs are relative to *https://api.sendpost.io/api/v1*
|
data/config-ruby.json
CHANGED
data/docs/EventMetadata.md
CHANGED
@@ -5,6 +5,8 @@
|
|
5
5
|
| Name | Type | Description | Notes |
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
7
7
|
| **clicked_url** | **String** | | [optional] |
|
8
|
+
| **tracked_ip** | **String** | | [optional] |
|
9
|
+
| **raw_user_agent** | **String** | | [optional] |
|
8
10
|
| **device** | [**Device**](Device.md) | | [optional] |
|
9
11
|
| **geo** | [**City**](City.md) | | [optional] |
|
10
12
|
| **os** | [**Os**](Os.md) | | [optional] |
|
@@ -19,6 +21,8 @@ require 'sendpost_ruby_sdk'
|
|
19
21
|
|
20
22
|
instance = Sendpost::EventMetadata.new(
|
21
23
|
clicked_url: null,
|
24
|
+
tracked_ip: null,
|
25
|
+
raw_user_agent: null,
|
22
26
|
device: null,
|
23
27
|
geo: null,
|
24
28
|
os: null,
|
data/generate-libs.bash
CHANGED
@@ -1 +1 @@
|
|
1
|
-
openapi-generator generate -i sendpost.yaml -g ruby -o ./ -c ./config-ruby.json
|
1
|
+
openapi-generator generate -i sendpost.yaml -g ruby -o ./ -c ./config-ruby.json --git-repo-id sendpost_go_sdk --git-user-id sendpost
|
data/git_push.sh
CHANGED
@@ -14,12 +14,12 @@ if [ "$git_host" = "" ]; then
|
|
14
14
|
fi
|
15
15
|
|
16
16
|
if [ "$git_user_id" = "" ]; then
|
17
|
-
git_user_id="
|
17
|
+
git_user_id="sendpost"
|
18
18
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
19
19
|
fi
|
20
20
|
|
21
21
|
if [ "$git_repo_id" = "" ]; then
|
22
|
-
git_repo_id="
|
22
|
+
git_repo_id="sendpost_go_sdk"
|
23
23
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
24
24
|
fi
|
25
25
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
Contact: hello@sendpost.io
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -152,7 +152,7 @@ module Sendpost
|
|
152
152
|
@scheme = 'https'
|
153
153
|
@host = 'api.sendpost.io'
|
154
154
|
@base_path = '/api/v1'
|
155
|
-
@server_index =
|
155
|
+
@server_index = nil
|
156
156
|
@server_operation_index = {}
|
157
157
|
@server_variables = {}
|
158
158
|
@server_operation_variables = {}
|
@@ -200,10 +200,12 @@ module Sendpost
|
|
200
200
|
|
201
201
|
# Returns base URL for specified operation based on server settings
|
202
202
|
def base_url(operation = nil)
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
203
|
+
if operation_server_settings.key?(operation) then
|
204
|
+
index = server_operation_index.fetch(operation, server_index)
|
205
|
+
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
206
|
+
else
|
207
|
+
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
|
208
|
+
end
|
207
209
|
end
|
208
210
|
|
209
211
|
# Gets API key (with prefix if set).
|
@@ -220,8 +222,8 @@ module Sendpost
|
|
220
222
|
|
221
223
|
# Gets access_token using access_token_getter or uses the static access_token
|
222
224
|
def access_token_with_refresh
|
223
|
-
|
224
|
-
|
225
|
+
return access_token if access_token_getter.nil?
|
226
|
+
access_token_getter.call
|
225
227
|
end
|
226
228
|
|
227
229
|
# Gets Basic Auth token string
|
@@ -258,8 +260,8 @@ module Sendpost
|
|
258
260
|
servers = server_settings if servers == nil
|
259
261
|
|
260
262
|
# check array index out of bound
|
261
|
-
if (index < 0 || index >= servers.size)
|
262
|
-
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
263
|
+
if (index.nil? || index < 0 || index >= servers.size)
|
264
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
|
263
265
|
end
|
264
266
|
|
265
267
|
server = servers[index]
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
Contact: hello@sendpost.io
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -73,6 +73,7 @@ module Sendpost
|
|
73
73
|
# Show invalid properties with the reasons. Usually used together with valid?
|
74
74
|
# @return Array for valid properties with the reasons
|
75
75
|
def list_invalid_properties
|
76
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
76
77
|
invalid_properties = Array.new
|
77
78
|
invalid_properties
|
78
79
|
end
|
@@ -80,6 +81,7 @@ module Sendpost
|
|
80
81
|
# Check to see if the all the properties in the model are valid
|
81
82
|
# @return true if the model is valid
|
82
83
|
def valid?
|
84
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
83
85
|
true
|
84
86
|
end
|
85
87
|
|
@@ -108,37 +110,30 @@ module Sendpost
|
|
108
110
|
# @param [Hash] attributes Model attributes in the form of hash
|
109
111
|
# @return [Object] Returns the model itself
|
110
112
|
def self.build_from_hash(attributes)
|
111
|
-
new.build_from_hash(attributes)
|
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 build_from_hash(attributes)
|
118
113
|
return nil unless attributes.is_a?(Hash)
|
119
114
|
attributes = attributes.transform_keys(&:to_sym)
|
120
|
-
|
121
|
-
|
122
|
-
|
115
|
+
transformed_hash = {}
|
116
|
+
openapi_types.each_pair do |key, type|
|
117
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
118
|
+
transformed_hash["#{key}"] = nil
|
123
119
|
elsif type =~ /\AArray<(.*)>/i
|
124
120
|
# check to ensure the input is an array given that the attribute
|
125
121
|
# is documented as an array but the input is not
|
126
|
-
if attributes[
|
127
|
-
|
122
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
123
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
128
124
|
end
|
129
|
-
elsif !attributes[
|
130
|
-
|
125
|
+
elsif !attributes[attribute_map[key]].nil?
|
126
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
131
127
|
end
|
132
128
|
end
|
133
|
-
|
134
|
-
self
|
129
|
+
new(transformed_hash)
|
135
130
|
end
|
136
131
|
|
137
132
|
# Deserializes the data based on type
|
138
133
|
# @param string type Data type
|
139
134
|
# @param string value Value to be deserialized
|
140
135
|
# @return [Object] Deserialized data
|
141
|
-
def _deserialize(type, value)
|
136
|
+
def self._deserialize(type, value)
|
142
137
|
case type.to_sym
|
143
138
|
when :Time
|
144
139
|
Time.parse(value)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
Contact: hello@sendpost.io
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -97,6 +97,7 @@ module Sendpost
|
|
97
97
|
# Show invalid properties with the reasons. Usually used together with valid?
|
98
98
|
# @return Array for valid properties with the reasons
|
99
99
|
def list_invalid_properties
|
100
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
100
101
|
invalid_properties = Array.new
|
101
102
|
invalid_properties
|
102
103
|
end
|
@@ -104,6 +105,7 @@ module Sendpost
|
|
104
105
|
# Check to see if the all the properties in the model are valid
|
105
106
|
# @return true if the model is valid
|
106
107
|
def valid?
|
108
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
107
109
|
true
|
108
110
|
end
|
109
111
|
|
@@ -135,37 +137,30 @@ module Sendpost
|
|
135
137
|
# @param [Hash] attributes Model attributes in the form of hash
|
136
138
|
# @return [Object] Returns the model itself
|
137
139
|
def self.build_from_hash(attributes)
|
138
|
-
new.build_from_hash(attributes)
|
139
|
-
end
|
140
|
-
|
141
|
-
# Builds the object from hash
|
142
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
143
|
-
# @return [Object] Returns the model itself
|
144
|
-
def build_from_hash(attributes)
|
145
140
|
return nil unless attributes.is_a?(Hash)
|
146
141
|
attributes = attributes.transform_keys(&:to_sym)
|
147
|
-
|
148
|
-
|
149
|
-
|
142
|
+
transformed_hash = {}
|
143
|
+
openapi_types.each_pair do |key, type|
|
144
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
145
|
+
transformed_hash["#{key}"] = nil
|
150
146
|
elsif type =~ /\AArray<(.*)>/i
|
151
147
|
# check to ensure the input is an array given that the attribute
|
152
148
|
# is documented as an array but the input is not
|
153
|
-
if attributes[
|
154
|
-
|
149
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
150
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
155
151
|
end
|
156
|
-
elsif !attributes[
|
157
|
-
|
152
|
+
elsif !attributes[attribute_map[key]].nil?
|
153
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
158
154
|
end
|
159
155
|
end
|
160
|
-
|
161
|
-
self
|
156
|
+
new(transformed_hash)
|
162
157
|
end
|
163
158
|
|
164
159
|
# Deserializes the data based on type
|
165
160
|
# @param string type Data type
|
166
161
|
# @param string value Value to be deserialized
|
167
162
|
# @return [Object] Deserialized data
|
168
|
-
def _deserialize(type, value)
|
163
|
+
def self._deserialize(type, value)
|
169
164
|
case type.to_sym
|
170
165
|
when :Time
|
171
166
|
Time.parse(value)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
Contact: hello@sendpost.io
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -81,6 +81,7 @@ module Sendpost
|
|
81
81
|
# Show invalid properties with the reasons. Usually used together with valid?
|
82
82
|
# @return Array for valid properties with the reasons
|
83
83
|
def list_invalid_properties
|
84
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
84
85
|
invalid_properties = Array.new
|
85
86
|
invalid_properties
|
86
87
|
end
|
@@ -88,6 +89,7 @@ module Sendpost
|
|
88
89
|
# Check to see if the all the properties in the model are valid
|
89
90
|
# @return true if the model is valid
|
90
91
|
def valid?
|
92
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
91
93
|
true
|
92
94
|
end
|
93
95
|
|
@@ -117,37 +119,30 @@ module Sendpost
|
|
117
119
|
# @param [Hash] attributes Model attributes in the form of hash
|
118
120
|
# @return [Object] Returns the model itself
|
119
121
|
def self.build_from_hash(attributes)
|
120
|
-
new.build_from_hash(attributes)
|
121
|
-
end
|
122
|
-
|
123
|
-
# Builds the object from hash
|
124
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
-
# @return [Object] Returns the model itself
|
126
|
-
def build_from_hash(attributes)
|
127
122
|
return nil unless attributes.is_a?(Hash)
|
128
123
|
attributes = attributes.transform_keys(&:to_sym)
|
129
|
-
|
130
|
-
|
131
|
-
|
124
|
+
transformed_hash = {}
|
125
|
+
openapi_types.each_pair do |key, type|
|
126
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
127
|
+
transformed_hash["#{key}"] = nil
|
132
128
|
elsif type =~ /\AArray<(.*)>/i
|
133
129
|
# check to ensure the input is an array given that the attribute
|
134
130
|
# is documented as an array but the input is not
|
135
|
-
if attributes[
|
136
|
-
|
131
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
132
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
137
133
|
end
|
138
|
-
elsif !attributes[
|
139
|
-
|
134
|
+
elsif !attributes[attribute_map[key]].nil?
|
135
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
140
136
|
end
|
141
137
|
end
|
142
|
-
|
143
|
-
self
|
138
|
+
new(transformed_hash)
|
144
139
|
end
|
145
140
|
|
146
141
|
# Deserializes the data based on type
|
147
142
|
# @param string type Data type
|
148
143
|
# @param string value Value to be deserialized
|
149
144
|
# @return [Object] Deserialized data
|
150
|
-
def _deserialize(type, value)
|
145
|
+
def self._deserialize(type, value)
|
151
146
|
case type.to_sym
|
152
147
|
when :Time
|
153
148
|
Time.parse(value)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
Contact: hello@sendpost.io
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -65,6 +65,7 @@ module Sendpost
|
|
65
65
|
# Show invalid properties with the reasons. Usually used together with valid?
|
66
66
|
# @return Array for valid properties with the reasons
|
67
67
|
def list_invalid_properties
|
68
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
68
69
|
invalid_properties = Array.new
|
69
70
|
invalid_properties
|
70
71
|
end
|
@@ -72,6 +73,7 @@ module Sendpost
|
|
72
73
|
# Check to see if the all the properties in the model are valid
|
73
74
|
# @return true if the model is valid
|
74
75
|
def valid?
|
76
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
75
77
|
true
|
76
78
|
end
|
77
79
|
|
@@ -99,37 +101,30 @@ module Sendpost
|
|
99
101
|
# @param [Hash] attributes Model attributes in the form of hash
|
100
102
|
# @return [Object] Returns the model itself
|
101
103
|
def self.build_from_hash(attributes)
|
102
|
-
new.build_from_hash(attributes)
|
103
|
-
end
|
104
|
-
|
105
|
-
# Builds the object from hash
|
106
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
107
|
-
# @return [Object] Returns the model itself
|
108
|
-
def build_from_hash(attributes)
|
109
104
|
return nil unless attributes.is_a?(Hash)
|
110
105
|
attributes = attributes.transform_keys(&:to_sym)
|
111
|
-
|
112
|
-
|
113
|
-
|
106
|
+
transformed_hash = {}
|
107
|
+
openapi_types.each_pair do |key, type|
|
108
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
109
|
+
transformed_hash["#{key}"] = nil
|
114
110
|
elsif type =~ /\AArray<(.*)>/i
|
115
111
|
# check to ensure the input is an array given that the attribute
|
116
112
|
# is documented as an array but the input is not
|
117
|
-
if attributes[
|
118
|
-
|
113
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
114
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
119
115
|
end
|
120
|
-
elsif !attributes[
|
121
|
-
|
116
|
+
elsif !attributes[attribute_map[key]].nil?
|
117
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
122
118
|
end
|
123
119
|
end
|
124
|
-
|
125
|
-
self
|
120
|
+
new(transformed_hash)
|
126
121
|
end
|
127
122
|
|
128
123
|
# Deserializes the data based on type
|
129
124
|
# @param string type Data type
|
130
125
|
# @param string value Value to be deserialized
|
131
126
|
# @return [Object] Deserialized data
|
132
|
-
def _deserialize(type, value)
|
127
|
+
def self._deserialize(type, value)
|
133
128
|
case type.to_sym
|
134
129
|
when :Time
|
135
130
|
Time.parse(value)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
Contact: hello@sendpost.io
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version:
|
9
|
+
OpenAPI Generator version: 7.0.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -73,6 +73,7 @@ module Sendpost
|
|
73
73
|
# Show invalid properties with the reasons. Usually used together with valid?
|
74
74
|
# @return Array for valid properties with the reasons
|
75
75
|
def list_invalid_properties
|
76
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
76
77
|
invalid_properties = Array.new
|
77
78
|
invalid_properties
|
78
79
|
end
|
@@ -80,6 +81,7 @@ module Sendpost
|
|
80
81
|
# Check to see if the all the properties in the model are valid
|
81
82
|
# @return true if the model is valid
|
82
83
|
def valid?
|
84
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
83
85
|
true
|
84
86
|
end
|
85
87
|
|
@@ -108,37 +110,30 @@ module Sendpost
|
|
108
110
|
# @param [Hash] attributes Model attributes in the form of hash
|
109
111
|
# @return [Object] Returns the model itself
|
110
112
|
def self.build_from_hash(attributes)
|
111
|
-
new.build_from_hash(attributes)
|
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 build_from_hash(attributes)
|
118
113
|
return nil unless attributes.is_a?(Hash)
|
119
114
|
attributes = attributes.transform_keys(&:to_sym)
|
120
|
-
|
121
|
-
|
122
|
-
|
115
|
+
transformed_hash = {}
|
116
|
+
openapi_types.each_pair do |key, type|
|
117
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
118
|
+
transformed_hash["#{key}"] = nil
|
123
119
|
elsif type =~ /\AArray<(.*)>/i
|
124
120
|
# check to ensure the input is an array given that the attribute
|
125
121
|
# is documented as an array but the input is not
|
126
|
-
if attributes[
|
127
|
-
|
122
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
123
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
128
124
|
end
|
129
|
-
elsif !attributes[
|
130
|
-
|
125
|
+
elsif !attributes[attribute_map[key]].nil?
|
126
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
131
127
|
end
|
132
128
|
end
|
133
|
-
|
134
|
-
self
|
129
|
+
new(transformed_hash)
|
135
130
|
end
|
136
131
|
|
137
132
|
# Deserializes the data based on type
|
138
133
|
# @param string type Data type
|
139
134
|
# @param string value Value to be deserialized
|
140
135
|
# @return [Object] Deserialized data
|
141
|
-
def _deserialize(type, value)
|
136
|
+
def self._deserialize(type, value)
|
142
137
|
case type.to_sym
|
143
138
|
when :Time
|
144
139
|
Time.parse(value)
|