ultracart_api 4.1.234 → 4.1.235
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 +11 -2
- data/docs/SfvbApi.md +59 -0
- data/docs/SfvbTrackingCheckPlan.md +42 -0
- data/docs/SfvbTrackingCheckPlanEvent.md +22 -0
- data/docs/SfvbTrackingCheckPlanGate.md +20 -0
- data/docs/SfvbTrackingCheckPlanProvider.md +34 -0
- data/docs/SfvbTrackingCheckPlanRequest.md +24 -0
- data/docs/SfvbTrackingCheckPlanServerSide.md +20 -0
- data/docs/SfvbTrackingCheckPlanUnchecked.md +20 -0
- data/lib/ultracart_api/api/sfvb_api.rb +83 -0
- data/lib/ultracart_api/models/sfvb_tracking_check_plan.rb +394 -0
- data/lib/ultracart_api/models/sfvb_tracking_check_plan_event.rb +274 -0
- data/lib/ultracart_api/models/sfvb_tracking_check_plan_gate.rb +276 -0
- data/lib/ultracart_api/models/sfvb_tracking_check_plan_provider.rb +349 -0
- data/lib/ultracart_api/models/sfvb_tracking_check_plan_request.rb +284 -0
- data/lib/ultracart_api/models/sfvb_tracking_check_plan_server_side.rb +230 -0
- data/lib/ultracart_api/models/sfvb_tracking_check_plan_unchecked.rb +230 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +7 -0
- metadata +15 -1
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#UltraCart Rest API V2
|
|
3
|
+
|
|
4
|
+
#UltraCart REST API Version 2
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
|
7
|
+
Contact: support@ultracart.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
OpenAPI Generator version: 6.0.1-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module UltracartClient
|
|
17
|
+
class SfvbTrackingCheckPlanGate
|
|
18
|
+
# Where the gate applies. all, eea or non_us.
|
|
19
|
+
attr_accessor :region
|
|
20
|
+
|
|
21
|
+
# The consent category that must be granted. Statistics, Preferences or Marketing.
|
|
22
|
+
attr_accessor :type
|
|
23
|
+
|
|
24
|
+
class EnumAttributeValidator
|
|
25
|
+
attr_reader :datatype
|
|
26
|
+
attr_reader :allowable_values
|
|
27
|
+
|
|
28
|
+
def initialize(datatype, allowable_values)
|
|
29
|
+
@allowable_values = allowable_values.map do |value|
|
|
30
|
+
case datatype.to_s
|
|
31
|
+
when /Integer/i
|
|
32
|
+
value.to_i
|
|
33
|
+
when /Float/i
|
|
34
|
+
value.to_f
|
|
35
|
+
else
|
|
36
|
+
value
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def valid?(value)
|
|
42
|
+
!value || allowable_values.include?(value)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
47
|
+
def self.attribute_map
|
|
48
|
+
{
|
|
49
|
+
:'region' => :'region',
|
|
50
|
+
:'type' => :'type'
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Returns all the JSON keys this model knows about
|
|
55
|
+
def self.acceptable_attributes
|
|
56
|
+
attribute_map.values
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Attribute type mapping.
|
|
60
|
+
def self.openapi_types
|
|
61
|
+
{
|
|
62
|
+
:'region' => :'String',
|
|
63
|
+
:'type' => :'String'
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# List of attributes with nullable: true
|
|
68
|
+
def self.openapi_nullable
|
|
69
|
+
Set.new([
|
|
70
|
+
])
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Initializes the object
|
|
74
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
75
|
+
def initialize(attributes = {})
|
|
76
|
+
if (!attributes.is_a?(Hash))
|
|
77
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbTrackingCheckPlanGate` initialize method"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
81
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
82
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
83
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbTrackingCheckPlanGate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
84
|
+
end
|
|
85
|
+
h[k.to_sym] = v
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:'region')
|
|
89
|
+
self.region = attributes[:'region']
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
if attributes.key?(:'type')
|
|
93
|
+
self.type = attributes[:'type']
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
98
|
+
# @return Array for valid properties with the reasons
|
|
99
|
+
def list_invalid_properties
|
|
100
|
+
invalid_properties = Array.new
|
|
101
|
+
invalid_properties
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Check to see if the all the properties in the model are valid
|
|
105
|
+
# @return true if the model is valid
|
|
106
|
+
def valid?
|
|
107
|
+
region_validator = EnumAttributeValidator.new('String', ["all", "eea", "non_us"])
|
|
108
|
+
return false unless region_validator.valid?(@region)
|
|
109
|
+
type_validator = EnumAttributeValidator.new('String', ["Statistics", "Preferences", "Marketing"])
|
|
110
|
+
return false unless type_validator.valid?(@type)
|
|
111
|
+
true
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
115
|
+
# @param [Object] region Object to be assigned
|
|
116
|
+
def region=(region)
|
|
117
|
+
validator = EnumAttributeValidator.new('String', ["all", "eea", "non_us"])
|
|
118
|
+
unless validator.valid?(region)
|
|
119
|
+
fail ArgumentError, "invalid value for \"region\", must be one of #{validator.allowable_values}."
|
|
120
|
+
end
|
|
121
|
+
@region = region
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
125
|
+
# @param [Object] type Object to be assigned
|
|
126
|
+
def type=(type)
|
|
127
|
+
validator = EnumAttributeValidator.new('String', ["Statistics", "Preferences", "Marketing"])
|
|
128
|
+
unless validator.valid?(type)
|
|
129
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
130
|
+
end
|
|
131
|
+
@type = type
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Checks equality by comparing each attribute.
|
|
135
|
+
# @param [Object] Object to be compared
|
|
136
|
+
def ==(o)
|
|
137
|
+
return true if self.equal?(o)
|
|
138
|
+
self.class == o.class &&
|
|
139
|
+
region == o.region &&
|
|
140
|
+
type == o.type
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# @see the `==` method
|
|
144
|
+
# @param [Object] Object to be compared
|
|
145
|
+
def eql?(o)
|
|
146
|
+
self == o
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Calculates hash code according to all attributes.
|
|
150
|
+
# @return [Integer] Hash code
|
|
151
|
+
def hash
|
|
152
|
+
[region, type].hash
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Builds the object from hash
|
|
156
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
157
|
+
# @return [Object] Returns the model itself
|
|
158
|
+
def self.build_from_hash(attributes)
|
|
159
|
+
new.build_from_hash(attributes)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Builds the object from hash
|
|
163
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
164
|
+
# @return [Object] Returns the model itself
|
|
165
|
+
def build_from_hash(attributes)
|
|
166
|
+
return nil unless attributes.is_a?(Hash)
|
|
167
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
168
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
169
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
170
|
+
self.send("#{key}=", nil)
|
|
171
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
172
|
+
# check to ensure the input is an array given that the attribute
|
|
173
|
+
# is documented as an array but the input is not
|
|
174
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
175
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
176
|
+
end
|
|
177
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
178
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
self
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Deserializes the data based on type
|
|
186
|
+
# @param string type Data type
|
|
187
|
+
# @param string value Value to be deserialized
|
|
188
|
+
# @return [Object] Deserialized data
|
|
189
|
+
def _deserialize(type, value)
|
|
190
|
+
case type.to_sym
|
|
191
|
+
when :Time
|
|
192
|
+
Time.parse(value)
|
|
193
|
+
when :Date
|
|
194
|
+
Date.parse(value)
|
|
195
|
+
when :String
|
|
196
|
+
value.to_s
|
|
197
|
+
when :Integer
|
|
198
|
+
value.to_i
|
|
199
|
+
when :Float
|
|
200
|
+
value.to_f
|
|
201
|
+
when :Boolean
|
|
202
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
203
|
+
true
|
|
204
|
+
else
|
|
205
|
+
false
|
|
206
|
+
end
|
|
207
|
+
when :Object
|
|
208
|
+
# generic object (usually a Hash), return directly
|
|
209
|
+
value
|
|
210
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
211
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
212
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
213
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
214
|
+
k_type = Regexp.last_match[:k_type]
|
|
215
|
+
v_type = Regexp.last_match[:v_type]
|
|
216
|
+
{}.tap do |hash|
|
|
217
|
+
value.each do |k, v|
|
|
218
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
else # model
|
|
222
|
+
# models (e.g. Pet) or oneOf
|
|
223
|
+
klass = UltracartClient.const_get(type)
|
|
224
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Returns the string representation of the object
|
|
229
|
+
# @return [String] String presentation of the object
|
|
230
|
+
def to_s
|
|
231
|
+
to_hash.to_s
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
235
|
+
# @return [Hash] Returns the object in the form of hash
|
|
236
|
+
def to_body
|
|
237
|
+
to_hash
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Returns the object in the form of hash
|
|
241
|
+
# @return [Hash] Returns the object in the form of hash
|
|
242
|
+
def to_hash
|
|
243
|
+
hash = {}
|
|
244
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
245
|
+
value = self.send(attr)
|
|
246
|
+
if value.nil?
|
|
247
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
248
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
hash[param] = _to_hash(value)
|
|
252
|
+
end
|
|
253
|
+
hash
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Outputs non-array value in the form of hash
|
|
257
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
258
|
+
# @param [Object] value Any valid value
|
|
259
|
+
# @return [Hash] Returns the value in the form of hash
|
|
260
|
+
def _to_hash(value)
|
|
261
|
+
if value.is_a?(Array)
|
|
262
|
+
value.compact.map { |v| _to_hash(v) }
|
|
263
|
+
elsif value.is_a?(Hash)
|
|
264
|
+
{}.tap do |hash|
|
|
265
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
266
|
+
end
|
|
267
|
+
elsif value.respond_to? :to_hash
|
|
268
|
+
value.to_hash
|
|
269
|
+
else
|
|
270
|
+
value
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
end
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#UltraCart Rest API V2
|
|
3
|
+
|
|
4
|
+
#UltraCart REST API Version 2
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
|
7
|
+
Contact: support@ultracart.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
OpenAPI Generator version: 6.0.1-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module UltracartClient
|
|
17
|
+
class SfvbTrackingCheckPlanProvider
|
|
18
|
+
# The dataLayer, gtag and fbq calls it makes, where the template makes them.
|
|
19
|
+
attr_accessor :events
|
|
20
|
+
|
|
21
|
+
# must_load, must_not_load (held back by a gate this consent state and region have not granted, or never sent for this event), or may_load (depends on something the plan cannot know). A missing may_load request is a warning, never a fail.
|
|
22
|
+
attr_accessor :expect
|
|
23
|
+
|
|
24
|
+
attr_accessor :gate
|
|
25
|
+
|
|
26
|
+
# A name to show.
|
|
27
|
+
attr_accessor :name
|
|
28
|
+
|
|
29
|
+
# Why the expectation is what it is, when that is not obvious.
|
|
30
|
+
attr_accessor :note
|
|
31
|
+
|
|
32
|
+
# The provider key, as tracking/providers names it. For custom or affiliate network HTML, the host.
|
|
33
|
+
attr_accessor :provider
|
|
34
|
+
|
|
35
|
+
# The requests it makes.
|
|
36
|
+
attr_accessor :requests
|
|
37
|
+
|
|
38
|
+
# provider for a provider in the catalog, custom_html for the storefront Tracking or Conversion HTML, affiliate_network for an affiliate network pixel.
|
|
39
|
+
attr_accessor :source
|
|
40
|
+
|
|
41
|
+
# The storefront template that writes it, tracking.vm or conversion.vm. Left out for custom and affiliate network HTML.
|
|
42
|
+
attr_accessor :template
|
|
43
|
+
|
|
44
|
+
class EnumAttributeValidator
|
|
45
|
+
attr_reader :datatype
|
|
46
|
+
attr_reader :allowable_values
|
|
47
|
+
|
|
48
|
+
def initialize(datatype, allowable_values)
|
|
49
|
+
@allowable_values = allowable_values.map do |value|
|
|
50
|
+
case datatype.to_s
|
|
51
|
+
when /Integer/i
|
|
52
|
+
value.to_i
|
|
53
|
+
when /Float/i
|
|
54
|
+
value.to_f
|
|
55
|
+
else
|
|
56
|
+
value
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def valid?(value)
|
|
62
|
+
!value || allowable_values.include?(value)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
67
|
+
def self.attribute_map
|
|
68
|
+
{
|
|
69
|
+
:'events' => :'events',
|
|
70
|
+
:'expect' => :'expect',
|
|
71
|
+
:'gate' => :'gate',
|
|
72
|
+
:'name' => :'name',
|
|
73
|
+
:'note' => :'note',
|
|
74
|
+
:'provider' => :'provider',
|
|
75
|
+
:'requests' => :'requests',
|
|
76
|
+
:'source' => :'source',
|
|
77
|
+
:'template' => :'template'
|
|
78
|
+
}
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Returns all the JSON keys this model knows about
|
|
82
|
+
def self.acceptable_attributes
|
|
83
|
+
attribute_map.values
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Attribute type mapping.
|
|
87
|
+
def self.openapi_types
|
|
88
|
+
{
|
|
89
|
+
:'events' => :'Array<SfvbTrackingCheckPlanEvent>',
|
|
90
|
+
:'expect' => :'String',
|
|
91
|
+
:'gate' => :'SfvbTrackingCheckPlanGate',
|
|
92
|
+
:'name' => :'String',
|
|
93
|
+
:'note' => :'String',
|
|
94
|
+
:'provider' => :'String',
|
|
95
|
+
:'requests' => :'Array<SfvbTrackingCheckPlanRequest>',
|
|
96
|
+
:'source' => :'String',
|
|
97
|
+
:'template' => :'String'
|
|
98
|
+
}
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# List of attributes with nullable: true
|
|
102
|
+
def self.openapi_nullable
|
|
103
|
+
Set.new([
|
|
104
|
+
])
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Initializes the object
|
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
109
|
+
def initialize(attributes = {})
|
|
110
|
+
if (!attributes.is_a?(Hash))
|
|
111
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbTrackingCheckPlanProvider` initialize method"
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
115
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
116
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
117
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbTrackingCheckPlanProvider`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
118
|
+
end
|
|
119
|
+
h[k.to_sym] = v
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'events')
|
|
123
|
+
if (value = attributes[:'events']).is_a?(Array)
|
|
124
|
+
self.events = value
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'expect')
|
|
129
|
+
self.expect = attributes[:'expect']
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if attributes.key?(:'gate')
|
|
133
|
+
self.gate = attributes[:'gate']
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if attributes.key?(:'name')
|
|
137
|
+
self.name = attributes[:'name']
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if attributes.key?(:'note')
|
|
141
|
+
self.note = attributes[:'note']
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if attributes.key?(:'provider')
|
|
145
|
+
self.provider = attributes[:'provider']
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
if attributes.key?(:'requests')
|
|
149
|
+
if (value = attributes[:'requests']).is_a?(Array)
|
|
150
|
+
self.requests = value
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if attributes.key?(:'source')
|
|
155
|
+
self.source = attributes[:'source']
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if attributes.key?(:'template')
|
|
159
|
+
self.template = attributes[:'template']
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
164
|
+
# @return Array for valid properties with the reasons
|
|
165
|
+
def list_invalid_properties
|
|
166
|
+
invalid_properties = Array.new
|
|
167
|
+
invalid_properties
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Check to see if the all the properties in the model are valid
|
|
171
|
+
# @return true if the model is valid
|
|
172
|
+
def valid?
|
|
173
|
+
expect_validator = EnumAttributeValidator.new('String', ["must_load", "must_not_load", "may_load"])
|
|
174
|
+
return false unless expect_validator.valid?(@expect)
|
|
175
|
+
source_validator = EnumAttributeValidator.new('String', ["provider", "custom_html", "affiliate_network"])
|
|
176
|
+
return false unless source_validator.valid?(@source)
|
|
177
|
+
true
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
181
|
+
# @param [Object] expect Object to be assigned
|
|
182
|
+
def expect=(expect)
|
|
183
|
+
validator = EnumAttributeValidator.new('String', ["must_load", "must_not_load", "may_load"])
|
|
184
|
+
unless validator.valid?(expect)
|
|
185
|
+
fail ArgumentError, "invalid value for \"expect\", must be one of #{validator.allowable_values}."
|
|
186
|
+
end
|
|
187
|
+
@expect = expect
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
191
|
+
# @param [Object] source Object to be assigned
|
|
192
|
+
def source=(source)
|
|
193
|
+
validator = EnumAttributeValidator.new('String', ["provider", "custom_html", "affiliate_network"])
|
|
194
|
+
unless validator.valid?(source)
|
|
195
|
+
fail ArgumentError, "invalid value for \"source\", must be one of #{validator.allowable_values}."
|
|
196
|
+
end
|
|
197
|
+
@source = source
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Checks equality by comparing each attribute.
|
|
201
|
+
# @param [Object] Object to be compared
|
|
202
|
+
def ==(o)
|
|
203
|
+
return true if self.equal?(o)
|
|
204
|
+
self.class == o.class &&
|
|
205
|
+
events == o.events &&
|
|
206
|
+
expect == o.expect &&
|
|
207
|
+
gate == o.gate &&
|
|
208
|
+
name == o.name &&
|
|
209
|
+
note == o.note &&
|
|
210
|
+
provider == o.provider &&
|
|
211
|
+
requests == o.requests &&
|
|
212
|
+
source == o.source &&
|
|
213
|
+
template == o.template
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# @see the `==` method
|
|
217
|
+
# @param [Object] Object to be compared
|
|
218
|
+
def eql?(o)
|
|
219
|
+
self == o
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Calculates hash code according to all attributes.
|
|
223
|
+
# @return [Integer] Hash code
|
|
224
|
+
def hash
|
|
225
|
+
[events, expect, gate, name, note, provider, requests, source, template].hash
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Builds the object from hash
|
|
229
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
230
|
+
# @return [Object] Returns the model itself
|
|
231
|
+
def self.build_from_hash(attributes)
|
|
232
|
+
new.build_from_hash(attributes)
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Builds the object from hash
|
|
236
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
237
|
+
# @return [Object] Returns the model itself
|
|
238
|
+
def build_from_hash(attributes)
|
|
239
|
+
return nil unless attributes.is_a?(Hash)
|
|
240
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
241
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
242
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
243
|
+
self.send("#{key}=", nil)
|
|
244
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
245
|
+
# check to ensure the input is an array given that the attribute
|
|
246
|
+
# is documented as an array but the input is not
|
|
247
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
248
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
249
|
+
end
|
|
250
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
251
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
self
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# Deserializes the data based on type
|
|
259
|
+
# @param string type Data type
|
|
260
|
+
# @param string value Value to be deserialized
|
|
261
|
+
# @return [Object] Deserialized data
|
|
262
|
+
def _deserialize(type, value)
|
|
263
|
+
case type.to_sym
|
|
264
|
+
when :Time
|
|
265
|
+
Time.parse(value)
|
|
266
|
+
when :Date
|
|
267
|
+
Date.parse(value)
|
|
268
|
+
when :String
|
|
269
|
+
value.to_s
|
|
270
|
+
when :Integer
|
|
271
|
+
value.to_i
|
|
272
|
+
when :Float
|
|
273
|
+
value.to_f
|
|
274
|
+
when :Boolean
|
|
275
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
276
|
+
true
|
|
277
|
+
else
|
|
278
|
+
false
|
|
279
|
+
end
|
|
280
|
+
when :Object
|
|
281
|
+
# generic object (usually a Hash), return directly
|
|
282
|
+
value
|
|
283
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
284
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
285
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
286
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
287
|
+
k_type = Regexp.last_match[:k_type]
|
|
288
|
+
v_type = Regexp.last_match[:v_type]
|
|
289
|
+
{}.tap do |hash|
|
|
290
|
+
value.each do |k, v|
|
|
291
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
292
|
+
end
|
|
293
|
+
end
|
|
294
|
+
else # model
|
|
295
|
+
# models (e.g. Pet) or oneOf
|
|
296
|
+
klass = UltracartClient.const_get(type)
|
|
297
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
# Returns the string representation of the object
|
|
302
|
+
# @return [String] String presentation of the object
|
|
303
|
+
def to_s
|
|
304
|
+
to_hash.to_s
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
308
|
+
# @return [Hash] Returns the object in the form of hash
|
|
309
|
+
def to_body
|
|
310
|
+
to_hash
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
# Returns the object in the form of hash
|
|
314
|
+
# @return [Hash] Returns the object in the form of hash
|
|
315
|
+
def to_hash
|
|
316
|
+
hash = {}
|
|
317
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
318
|
+
value = self.send(attr)
|
|
319
|
+
if value.nil?
|
|
320
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
321
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
hash[param] = _to_hash(value)
|
|
325
|
+
end
|
|
326
|
+
hash
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# Outputs non-array value in the form of hash
|
|
330
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
331
|
+
# @param [Object] value Any valid value
|
|
332
|
+
# @return [Hash] Returns the value in the form of hash
|
|
333
|
+
def _to_hash(value)
|
|
334
|
+
if value.is_a?(Array)
|
|
335
|
+
value.compact.map { |v| _to_hash(v) }
|
|
336
|
+
elsif value.is_a?(Hash)
|
|
337
|
+
{}.tap do |hash|
|
|
338
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
339
|
+
end
|
|
340
|
+
elsif value.respond_to? :to_hash
|
|
341
|
+
value.to_hash
|
|
342
|
+
else
|
|
343
|
+
value
|
|
344
|
+
end
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
end
|