sib-api-v3-sdk 7.1.0 → 7.2.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/README.md +5 -0
- data/docs/BlockDomain.md +8 -0
- data/docs/ContactsApi.md +18 -6
- data/docs/CreateSmtpTemplateSender.md +1 -1
- data/docs/EmailCampaignsApi.md +3 -1
- data/docs/FoldersApi.md +9 -3
- data/docs/GetBlockedDomains.md +8 -0
- data/docs/GetChildDomain.md +2 -2
- data/docs/GetChildrenList.md +1 -1
- data/docs/GetEmailCampaign.md +2 -2
- data/docs/GetEmailCampaigns.md +1 -1
- data/docs/GetEmailEventReportEvents.md +1 -0
- data/docs/GetExtendedCampaignOverview.md +2 -2
- data/docs/GetFolderLists.md +2 -2
- data/docs/GetLists.md +2 -2
- data/docs/GetProcesses.md +1 -1
- data/docs/GetSmsCampaign.md +1 -1
- data/docs/GetSmsCampaignOverview.md +1 -1
- data/docs/GetSmsCampaigns.md +1 -1
- data/docs/GetSmsEventReportEvents.md +4 -4
- data/docs/GetTransacAggregatedSmsReport.md +10 -10
- data/docs/GetTransacSmsReportReports.md +10 -10
- data/docs/ListsApi.md +9 -3
- data/docs/ProcessApi.md +3 -1
- data/docs/SMSCampaignsApi.md +3 -1
- data/docs/SendSmtpEmailSender.md +3 -3
- data/docs/TransactionalEmailsApi.md +187 -5
- data/docs/TransactionalSMSApi.md +6 -2
- data/lib/sib-api-v3-sdk.rb +2 -0
- data/lib/sib-api-v3-sdk/api/account_api.rb +10 -0
- data/lib/sib-api-v3-sdk/api/attributes_api.rb +10 -0
- data/lib/sib-api-v3-sdk/api/contacts_api.rb +40 -0
- data/lib/sib-api-v3-sdk/api/email_campaigns_api.rb +16 -0
- data/lib/sib-api-v3-sdk/api/folders_api.rb +22 -0
- data/lib/sib-api-v3-sdk/api/lists_api.rb +28 -0
- data/lib/sib-api-v3-sdk/api/process_api.rb +16 -0
- data/lib/sib-api-v3-sdk/api/reseller_api.rb +10 -0
- data/lib/sib-api-v3-sdk/api/senders_api.rb +10 -0
- data/lib/sib-api-v3-sdk/api/sms_campaigns_api.rb +16 -0
- data/lib/sib-api-v3-sdk/api/transactional_emails_api.rb +196 -2
- data/lib/sib-api-v3-sdk/api/transactional_sms_api.rb +22 -0
- data/lib/sib-api-v3-sdk/api/webhooks_api.rb +10 -0
- data/lib/sib-api-v3-sdk/models/block_domain.rb +189 -0
- data/lib/sib-api-v3-sdk/models/create_smtp_template_sender.rb +0 -5
- data/lib/sib-api-v3-sdk/models/get_blocked_domains.rb +192 -0
- data/lib/sib-api-v3-sdk/models/get_child_domain.rb +0 -10
- data/lib/sib-api-v3-sdk/models/get_children_list.rb +0 -5
- data/lib/sib-api-v3-sdk/models/get_email_campaign.rb +0 -10
- data/lib/sib-api-v3-sdk/models/get_email_campaigns.rb +0 -5
- data/lib/sib-api-v3-sdk/models/get_email_event_report_events.rb +16 -6
- data/lib/sib-api-v3-sdk/models/get_extended_campaign_overview.rb +0 -10
- data/lib/sib-api-v3-sdk/models/get_folder_lists.rb +0 -10
- data/lib/sib-api-v3-sdk/models/get_lists.rb +0 -10
- data/lib/sib-api-v3-sdk/models/get_processes.rb +0 -5
- data/lib/sib-api-v3-sdk/models/get_sms_campaign.rb +0 -5
- data/lib/sib-api-v3-sdk/models/get_sms_campaign_overview.rb +0 -5
- data/lib/sib-api-v3-sdk/models/get_sms_campaigns.rb +0 -5
- data/lib/sib-api-v3-sdk/models/get_sms_event_report_events.rb +0 -20
- data/lib/sib-api-v3-sdk/models/get_transac_aggregated_sms_report.rb +0 -50
- data/lib/sib-api-v3-sdk/models/get_transac_sms_report_reports.rb +0 -50
- data/lib/sib-api-v3-sdk/models/send_smtp_email_sender.rb +4 -9
- data/lib/sib-api-v3-sdk/version.rb +1 -1
- data/spec/api/contacts_api_spec.rb +5 -0
- data/spec/api/email_campaigns_api_spec.rb +1 -0
- data/spec/api/folders_api_spec.rb +2 -0
- data/spec/api/lists_api_spec.rb +3 -0
- data/spec/api/process_api_spec.rb +1 -0
- data/spec/api/sms_campaigns_api_spec.rb +1 -0
- data/spec/api/transactional_emails_api_spec.rb +40 -0
- data/spec/api/transactional_sms_api_spec.rb +2 -0
- data/spec/models/block_domain_spec.rb +41 -0
- data/spec/models/get_blocked_domains_spec.rb +41 -0
- data/spec/models/get_email_event_report_events_spec.rb +7 -1
- data/testfile.rb +26 -0
- metadata +11 -2
@@ -19,6 +19,16 @@ module SibApiV3Sdk
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
+
|
23
|
+
# Set custom user_agent if explicitly passed in api
|
24
|
+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
|
25
|
+
def setUserAgent(user_agent)
|
26
|
+
@user_agent = user_agent
|
27
|
+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
|
28
|
+
@api_client.default_headers['User-Agent'] = @user_agent
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
# Get all your SMS activity (unaggregated events)
|
23
33
|
# @param [Hash] opts the optional parameters
|
24
34
|
# @option opts [Integer] :limit Number of documents per page (default to 50)
|
@@ -29,6 +39,7 @@ module SibApiV3Sdk
|
|
29
39
|
# @option opts [String] :phone_number Filter the report for a specific phone number
|
30
40
|
# @option opts [String] :event Filter the report for specific events
|
31
41
|
# @option opts [String] :tags Filter the report for specific tags passed as a serialized urlencoded array
|
42
|
+
# @option opts [String] :sort Sort the results in the ascending/descending order of record creation (default to desc)
|
32
43
|
# @return [GetSmsEventReport]
|
33
44
|
def get_sms_events(opts = {})
|
34
45
|
data, _status_code, _headers = get_sms_events_with_http_info(opts)
|
@@ -45,6 +56,7 @@ module SibApiV3Sdk
|
|
45
56
|
# @option opts [String] :phone_number Filter the report for a specific phone number
|
46
57
|
# @option opts [String] :event Filter the report for specific events
|
47
58
|
# @option opts [String] :tags Filter the report for specific tags passed as a serialized urlencoded array
|
59
|
+
# @option opts [String] :sort Sort the results in the ascending/descending order of record creation
|
48
60
|
# @return [Array<(GetSmsEventReport, Fixnum, Hash)>] GetSmsEventReport data, response status code and response headers
|
49
61
|
def get_sms_events_with_http_info(opts = {})
|
50
62
|
if @api_client.config.debugging
|
@@ -57,6 +69,9 @@ module SibApiV3Sdk
|
|
57
69
|
if @api_client.config.client_side_validation && opts[:'event'] && !['bounces', 'hardBounces', 'softBounces', 'delivered', 'sent', 'accepted', 'unsubscription', 'replies', 'blocked'].include?(opts[:'event'])
|
58
70
|
fail ArgumentError, 'invalid value for "event", must be one of bounces, hardBounces, softBounces, delivered, sent, accepted, unsubscription, replies, blocked'
|
59
71
|
end
|
72
|
+
if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
|
73
|
+
fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
|
74
|
+
end
|
60
75
|
# resource path
|
61
76
|
local_var_path = '/transactionalSMS/statistics/events'
|
62
77
|
|
@@ -70,6 +85,7 @@ module SibApiV3Sdk
|
|
70
85
|
query_params[:'phoneNumber'] = opts[:'phone_number'] if !opts[:'phone_number'].nil?
|
71
86
|
query_params[:'event'] = opts[:'event'] if !opts[:'event'].nil?
|
72
87
|
query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?
|
88
|
+
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
73
89
|
|
74
90
|
# header parameters
|
75
91
|
header_params = {}
|
@@ -160,6 +176,7 @@ module SibApiV3Sdk
|
|
160
176
|
# @option opts [String] :end_date Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report
|
161
177
|
# @option opts [Integer] :days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate'
|
162
178
|
# @option opts [String] :tag Filter on a tag
|
179
|
+
# @option opts [String] :sort Sort the results in the ascending/descending order of record creation (default to desc)
|
163
180
|
# @return [GetTransacSmsReport]
|
164
181
|
def get_transac_sms_report(opts = {})
|
165
182
|
data, _status_code, _headers = get_transac_sms_report_with_http_info(opts)
|
@@ -172,11 +189,15 @@ module SibApiV3Sdk
|
|
172
189
|
# @option opts [String] :end_date Mandatory if startDate is used. Ending date (YYYY-MM-DD) of the report
|
173
190
|
# @option opts [Integer] :days Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate'
|
174
191
|
# @option opts [String] :tag Filter on a tag
|
192
|
+
# @option opts [String] :sort Sort the results in the ascending/descending order of record creation
|
175
193
|
# @return [Array<(GetTransacSmsReport, Fixnum, Hash)>] GetTransacSmsReport data, response status code and response headers
|
176
194
|
def get_transac_sms_report_with_http_info(opts = {})
|
177
195
|
if @api_client.config.debugging
|
178
196
|
@api_client.config.logger.debug 'Calling API: TransactionalSMSApi.get_transac_sms_report ...'
|
179
197
|
end
|
198
|
+
if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
|
199
|
+
fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
|
200
|
+
end
|
180
201
|
# resource path
|
181
202
|
local_var_path = '/transactionalSMS/statistics/reports'
|
182
203
|
|
@@ -186,6 +207,7 @@ module SibApiV3Sdk
|
|
186
207
|
query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
|
187
208
|
query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
|
188
209
|
query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].nil?
|
210
|
+
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
|
189
211
|
|
190
212
|
# header parameters
|
191
213
|
header_params = {}
|
@@ -19,6 +19,16 @@ module SibApiV3Sdk
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
+
|
23
|
+
# Set custom user_agent if explicitly passed in api
|
24
|
+
# default will still remain Swagger-Codegen/#{VERSION}/ruby
|
25
|
+
def setUserAgent(user_agent)
|
26
|
+
@user_agent = user_agent
|
27
|
+
if user_agent.is_a?(String) && user_agent.downcase.start_with?('sendinblue_')
|
28
|
+
@api_client.default_headers['User-Agent'] = @user_agent
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
# Create a webhook
|
23
33
|
# @param create_webhook Values to create a webhook
|
24
34
|
# @param [Hash] opts the optional parameters
|
@@ -0,0 +1,189 @@
|
|
1
|
+
=begin
|
2
|
+
#SendinBlue API
|
3
|
+
|
4
|
+
#SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
|
5
|
+
|
6
|
+
OpenAPI spec version: 3.0.0
|
7
|
+
Contact: contact@sendinblue.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.12
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SibApiV3Sdk
|
16
|
+
class BlockDomain
|
17
|
+
# name of the domain to be blocked
|
18
|
+
attr_accessor :domain
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'domain' => :'domain'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.swagger_types
|
29
|
+
{
|
30
|
+
:'domain' => :'String'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Initializes the object
|
35
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
36
|
+
def initialize(attributes = {})
|
37
|
+
return unless attributes.is_a?(Hash)
|
38
|
+
|
39
|
+
# convert string to symbol for hash key
|
40
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
41
|
+
|
42
|
+
if attributes.has_key?(:'domain')
|
43
|
+
self.domain = attributes[:'domain']
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
48
|
+
# @return Array for valid properties with the reasons
|
49
|
+
def list_invalid_properties
|
50
|
+
invalid_properties = Array.new
|
51
|
+
if @domain.nil?
|
52
|
+
invalid_properties.push('invalid value for "domain", domain cannot be nil.')
|
53
|
+
end
|
54
|
+
|
55
|
+
invalid_properties
|
56
|
+
end
|
57
|
+
|
58
|
+
# Check to see if the all the properties in the model are valid
|
59
|
+
# @return true if the model is valid
|
60
|
+
def valid?
|
61
|
+
return false if @domain.nil?
|
62
|
+
true
|
63
|
+
end
|
64
|
+
|
65
|
+
# Checks equality by comparing each attribute.
|
66
|
+
# @param [Object] Object to be compared
|
67
|
+
def ==(o)
|
68
|
+
return true if self.equal?(o)
|
69
|
+
self.class == o.class &&
|
70
|
+
domain == o.domain
|
71
|
+
end
|
72
|
+
|
73
|
+
# @see the `==` method
|
74
|
+
# @param [Object] Object to be compared
|
75
|
+
def eql?(o)
|
76
|
+
self == o
|
77
|
+
end
|
78
|
+
|
79
|
+
# Calculates hash code according to all attributes.
|
80
|
+
# @return [Fixnum] Hash code
|
81
|
+
def hash
|
82
|
+
[domain].hash
|
83
|
+
end
|
84
|
+
|
85
|
+
# Builds the object from hash
|
86
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
87
|
+
# @return [Object] Returns the model itself
|
88
|
+
def build_from_hash(attributes)
|
89
|
+
return nil unless attributes.is_a?(Hash)
|
90
|
+
self.class.swagger_types.each_pair do |key, type|
|
91
|
+
if type =~ /\AArray<(.*)>/i
|
92
|
+
# check to ensure the input is an array given that the the attribute
|
93
|
+
# is documented as an array but the input is not
|
94
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
95
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
96
|
+
end
|
97
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
98
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
99
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
100
|
+
end
|
101
|
+
|
102
|
+
self
|
103
|
+
end
|
104
|
+
|
105
|
+
# Deserializes the data based on type
|
106
|
+
# @param string type Data type
|
107
|
+
# @param string value Value to be deserialized
|
108
|
+
# @return [Object] Deserialized data
|
109
|
+
def _deserialize(type, value)
|
110
|
+
case type.to_sym
|
111
|
+
when :DateTime
|
112
|
+
DateTime.parse(value)
|
113
|
+
when :Date
|
114
|
+
Date.parse(value)
|
115
|
+
when :String
|
116
|
+
value.to_s
|
117
|
+
when :Integer
|
118
|
+
value.to_i
|
119
|
+
when :Float
|
120
|
+
value.to_f
|
121
|
+
when :BOOLEAN
|
122
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
123
|
+
true
|
124
|
+
else
|
125
|
+
false
|
126
|
+
end
|
127
|
+
when :Object
|
128
|
+
# generic object (usually a Hash), return directly
|
129
|
+
value
|
130
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
131
|
+
inner_type = Regexp.last_match[:inner_type]
|
132
|
+
value.map { |v| _deserialize(inner_type, v) }
|
133
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
134
|
+
k_type = Regexp.last_match[:k_type]
|
135
|
+
v_type = Regexp.last_match[:v_type]
|
136
|
+
{}.tap do |hash|
|
137
|
+
value.each do |k, v|
|
138
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
else # model
|
142
|
+
temp_model = SibApiV3Sdk.const_get(type).new
|
143
|
+
temp_model.build_from_hash(value)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Returns the string representation of the object
|
148
|
+
# @return [String] String presentation of the object
|
149
|
+
def to_s
|
150
|
+
to_hash.to_s
|
151
|
+
end
|
152
|
+
|
153
|
+
# to_body is an alias to to_hash (backward compatibility)
|
154
|
+
# @return [Hash] Returns the object in the form of hash
|
155
|
+
def to_body
|
156
|
+
to_hash
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the object in the form of hash
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
161
|
+
def to_hash
|
162
|
+
hash = {}
|
163
|
+
self.class.attribute_map.each_pair do |attr, param|
|
164
|
+
value = self.send(attr)
|
165
|
+
next if value.nil?
|
166
|
+
hash[param] = _to_hash(value)
|
167
|
+
end
|
168
|
+
hash
|
169
|
+
end
|
170
|
+
|
171
|
+
# Outputs non-array value in the form of hash
|
172
|
+
# For object, use to_hash. Otherwise, just return the value
|
173
|
+
# @param [Object] value Any valid value
|
174
|
+
# @return [Hash] Returns the value in the form of hash
|
175
|
+
def _to_hash(value)
|
176
|
+
if value.is_a?(Array)
|
177
|
+
value.compact.map { |v| _to_hash(v) }
|
178
|
+
elsif value.is_a?(Hash)
|
179
|
+
{}.tap do |hash|
|
180
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
181
|
+
end
|
182
|
+
elsif value.respond_to? :to_hash
|
183
|
+
value.to_hash
|
184
|
+
else
|
185
|
+
value
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
@@ -67,17 +67,12 @@ module SibApiV3Sdk
|
|
67
67
|
# @return Array for valid properties with the reasons
|
68
68
|
def list_invalid_properties
|
69
69
|
invalid_properties = Array.new
|
70
|
-
if @email.nil?
|
71
|
-
invalid_properties.push('invalid value for "email", email cannot be nil.')
|
72
|
-
end
|
73
|
-
|
74
70
|
invalid_properties
|
75
71
|
end
|
76
72
|
|
77
73
|
# Check to see if the all the properties in the model are valid
|
78
74
|
# @return true if the model is valid
|
79
75
|
def valid?
|
80
|
-
return false if @email.nil?
|
81
76
|
true
|
82
77
|
end
|
83
78
|
|
@@ -0,0 +1,192 @@
|
|
1
|
+
=begin
|
2
|
+
#SendinBlue API
|
3
|
+
|
4
|
+
#SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
|
5
|
+
|
6
|
+
OpenAPI spec version: 3.0.0
|
7
|
+
Contact: contact@sendinblue.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.12
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module SibApiV3Sdk
|
16
|
+
# list of blocked domains
|
17
|
+
class GetBlockedDomains
|
18
|
+
# List of all blocked domains
|
19
|
+
attr_accessor :domains
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'domains' => :'domains'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.swagger_types
|
30
|
+
{
|
31
|
+
:'domains' => :'Array<String>'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Initializes the object
|
36
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
37
|
+
def initialize(attributes = {})
|
38
|
+
return unless attributes.is_a?(Hash)
|
39
|
+
|
40
|
+
# convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
42
|
+
|
43
|
+
if attributes.has_key?(:'domains')
|
44
|
+
if (value = attributes[:'domains']).is_a?(Array)
|
45
|
+
self.domains = value
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
51
|
+
# @return Array for valid properties with the reasons
|
52
|
+
def list_invalid_properties
|
53
|
+
invalid_properties = Array.new
|
54
|
+
if @domains.nil?
|
55
|
+
invalid_properties.push('invalid value for "domains", domains cannot be nil.')
|
56
|
+
end
|
57
|
+
|
58
|
+
invalid_properties
|
59
|
+
end
|
60
|
+
|
61
|
+
# Check to see if the all the properties in the model are valid
|
62
|
+
# @return true if the model is valid
|
63
|
+
def valid?
|
64
|
+
return false if @domains.nil?
|
65
|
+
true
|
66
|
+
end
|
67
|
+
|
68
|
+
# Checks equality by comparing each attribute.
|
69
|
+
# @param [Object] Object to be compared
|
70
|
+
def ==(o)
|
71
|
+
return true if self.equal?(o)
|
72
|
+
self.class == o.class &&
|
73
|
+
domains == o.domains
|
74
|
+
end
|
75
|
+
|
76
|
+
# @see the `==` method
|
77
|
+
# @param [Object] Object to be compared
|
78
|
+
def eql?(o)
|
79
|
+
self == o
|
80
|
+
end
|
81
|
+
|
82
|
+
# Calculates hash code according to all attributes.
|
83
|
+
# @return [Fixnum] Hash code
|
84
|
+
def hash
|
85
|
+
[domains].hash
|
86
|
+
end
|
87
|
+
|
88
|
+
# Builds the object from hash
|
89
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
90
|
+
# @return [Object] Returns the model itself
|
91
|
+
def build_from_hash(attributes)
|
92
|
+
return nil unless attributes.is_a?(Hash)
|
93
|
+
self.class.swagger_types.each_pair do |key, type|
|
94
|
+
if type =~ /\AArray<(.*)>/i
|
95
|
+
# check to ensure the input is an array given that the the attribute
|
96
|
+
# is documented as an array but the input is not
|
97
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
98
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
99
|
+
end
|
100
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
101
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
102
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
103
|
+
end
|
104
|
+
|
105
|
+
self
|
106
|
+
end
|
107
|
+
|
108
|
+
# Deserializes the data based on type
|
109
|
+
# @param string type Data type
|
110
|
+
# @param string value Value to be deserialized
|
111
|
+
# @return [Object] Deserialized data
|
112
|
+
def _deserialize(type, value)
|
113
|
+
case type.to_sym
|
114
|
+
when :DateTime
|
115
|
+
DateTime.parse(value)
|
116
|
+
when :Date
|
117
|
+
Date.parse(value)
|
118
|
+
when :String
|
119
|
+
value.to_s
|
120
|
+
when :Integer
|
121
|
+
value.to_i
|
122
|
+
when :Float
|
123
|
+
value.to_f
|
124
|
+
when :BOOLEAN
|
125
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
126
|
+
true
|
127
|
+
else
|
128
|
+
false
|
129
|
+
end
|
130
|
+
when :Object
|
131
|
+
# generic object (usually a Hash), return directly
|
132
|
+
value
|
133
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
134
|
+
inner_type = Regexp.last_match[:inner_type]
|
135
|
+
value.map { |v| _deserialize(inner_type, v) }
|
136
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
137
|
+
k_type = Regexp.last_match[:k_type]
|
138
|
+
v_type = Regexp.last_match[:v_type]
|
139
|
+
{}.tap do |hash|
|
140
|
+
value.each do |k, v|
|
141
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
else # model
|
145
|
+
temp_model = SibApiV3Sdk.const_get(type).new
|
146
|
+
temp_model.build_from_hash(value)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# Returns the string representation of the object
|
151
|
+
# @return [String] String presentation of the object
|
152
|
+
def to_s
|
153
|
+
to_hash.to_s
|
154
|
+
end
|
155
|
+
|
156
|
+
# to_body is an alias to to_hash (backward compatibility)
|
157
|
+
# @return [Hash] Returns the object in the form of hash
|
158
|
+
def to_body
|
159
|
+
to_hash
|
160
|
+
end
|
161
|
+
|
162
|
+
# Returns the object in the form of hash
|
163
|
+
# @return [Hash] Returns the object in the form of hash
|
164
|
+
def to_hash
|
165
|
+
hash = {}
|
166
|
+
self.class.attribute_map.each_pair do |attr, param|
|
167
|
+
value = self.send(attr)
|
168
|
+
next if value.nil?
|
169
|
+
hash[param] = _to_hash(value)
|
170
|
+
end
|
171
|
+
hash
|
172
|
+
end
|
173
|
+
|
174
|
+
# Outputs non-array value in the form of hash
|
175
|
+
# For object, use to_hash. Otherwise, just return the value
|
176
|
+
# @param [Object] value Any valid value
|
177
|
+
# @return [Hash] Returns the value in the form of hash
|
178
|
+
def _to_hash(value)
|
179
|
+
if value.is_a?(Array)
|
180
|
+
value.compact.map { |v| _to_hash(v) }
|
181
|
+
elsif value.is_a?(Hash)
|
182
|
+
{}.tap do |hash|
|
183
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
184
|
+
end
|
185
|
+
elsif value.respond_to? :to_hash
|
186
|
+
value.to_hash
|
187
|
+
else
|
188
|
+
value
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|